Iphone 在编辑模式下选择Rowatindexpath以更新数据

Iphone 在编辑模式下选择Rowatindexpath以更新数据,iphone,objective-c,Iphone,Objective C,我尝试修改我的didSelectRowatineXpath方法,以使用我的AddView进行编辑(仅使用填充文本字段)。但它不起作用!我只需进入编辑模式,检查是否(self.editing)并执行以下操作: if (self.editing) { AddViewController *viewController = [[AddViewController alloc] initWi

我尝试修改我的didSelectRowatineXpath方法,以使用我的AddView进行编辑(仅使用填充文本字段)。但它不起作用!我只需进入编辑模式,检查是否(self.editing)并执行以下操作:

   if (self.editing) {
        AddViewController *viewController = [[AddViewController alloc] 
                                             initWithNibName:@"AddView" bundle:[NSBundle mainBundle]];
    //get selected Object  
    User *userEdit = [[User alloc] init];
    userEdit = [self.users objectAtIndex:indexPath.row];
    viewController.user = userEdit;
    [viewController setEditUser];

    [self.navigationController pushViewController:viewController animated:YES];
    [viewController release];
    //deselect Row after navigate back
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
我做错了什么?我还尝试发送用户对象,如[viewController setEditUser:editUser],但这也不起作用,所以我尝试使用init

我的setEditUser方法看起来像(在视图中)

}


谢谢你的帮助

我不太清楚你在问什么,但也许你应该看看


@编辑期间属性(非原子)布尔允许选择

讨论

如果此属性的值为“是”,则用户可以在编辑期间选择行。默认值为“否”。如果要限制单元格的选择而不考虑模式,请使用AllowSelection


在UITableView文档中。

不太清楚您要问什么,但也许您应该看看


@编辑期间属性(非原子)布尔允许选择

讨论

如果此属性的值为“是”,则用户可以在编辑期间选择行。默认值为“否”。如果要限制单元格的选择而不考虑模式,请使用AllowSelection


在UITableView文档中。

如果在

- (void)viewDidAppear:(BOOL)animated{
self.userTitle.text = self.user.title;}

如果我在设置textfield值时

- (void)viewDidAppear:(BOOL)animated{
self.userTitle.text = self.user.title;}

首先,
userEdit=[[User alloc]init]错误并导致内存泄漏。把它拿走。其次,您没有向我们展示相关代码。如果
self.user.servertitle
显然包含您期望的字符串,而
self.user.title
可能不包含该字符串,那么我们应该从中扣除什么呢?我们对这些对象以及您如何创建它们一无所知。很抱歉,键入错误,在这两种情况下都应该是user.title。我的视图中有以下参数:@synthesis user,userTitle;在我的头文件@property(nonatomic,retain)中,输入IBOutlet UITextField*userTitle;和用户*用户;首先,
userEdit=[[User alloc]init]错误并导致内存泄漏。把它拿走。其次,您没有向我们展示相关代码。如果
self.user.servertitle
显然包含您期望的字符串,而
self.user.title
可能不包含该字符串,那么我们应该从中扣除什么呢?我们对这些对象以及您如何创建它们一无所知。很抱歉,键入错误,在这两种情况下都应该是user.title。我的视图中有以下参数:@synthesis user,userTitle;在我的头文件@property(nonatomic,retain)中,输入IBOutlet UITextField*userTitle;和用户*用户;谢谢,我可以编辑:)但我不能向我的视图发送数据(文本字段不显示值,NSLog显示)谢谢,我可以编辑:)但我不能向我的视图发送数据(文本字段不显示值,NSLog显示)