パラメータでクラスを初期化しようとしているこの問題を解決するために何時間も費やしました
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Fetch the value of the selected row in NSString
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
// NSString *tableRowValue = cell.text;
tableRowValue = [[listOfItems objectAtIndex:indexPath.row]objectForKey: @"clientId"];
//Call the next view
ContactsList *contactsList = [[ContactsList alloc] initWithNibName:NSStringFromClass([ContactsList class]) bundle:nil];
@try {
[self presentModalViewController:contactsList animated:YES];
}
@catch (NSException *ex) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"%@",ex]
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
contactsList.modalTransitionStyle = UIModalTransitionStyleCrossDissolve ;
//Initialize the view with the clicked row value thwough NSString variable
[contactsList init:tableRowValue];
}
このコード行
[contactsList init:tableRowValue];
次の警告が表示されます: 式の結果は未使用です
ContactsList クラスでは、init メソッドが呼び出されていません。
ご協力ありがとうございました