我花了几个小时试图解决这个问题我试图用参数初始化一个类
- (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 方法
谢谢您的帮助