我在secondView
中创建了一个委托,因为从第二个视图我必须传递在textfield中输入的值,此值应该传递给单元格上的firstview。但我的第二个查看字符串没有firstView
didSelectRowAtIndexPath:
这是我的错误?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
secondview *secondVC = [[secondview alloc] init];
secondVC.editText = indexPath.row;//i get error why but i create string variable editText on secondview
secondVC.delegate = self;
[self.navigationController pushViewController:[secondVC autorelease] animated:YES];
}
#pragma mark - SecondViewControllerDelegate methods
- (void)updateString:(NSString *)aString {
self.displaytext = aString;
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
if (![self.delegate respondsToSelector:@selector(updateString:)]) {
return;
}
[self.view endEditing:YES];
[self.delegate updateString:entryfield.text];
}