phx
phx

Reputation: 5937

didSelectRowAtIndexPath in editing mode to update data

i try to modify my didSelectRowAtIndexPath Method to use my AddView also for editing (only with filled textfields). But it is not working! I just enter edit mode, check if(self.editing) and do something like:

   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];

What am I doing wrong? I also try to send the User object like [viewController setEditUser:editUser] but this is also not working, so i tried it with init.

My setEditUser Method looks like (in the view)

- (void)setEditUser{
self.userTitle.text = self.user.title; //this is not working!!! ?????
NSLog(@"blub %@", self.user.title); //this is working!!!!

}

Thanks for your Help

Upvotes: 1

Views: 651

Answers (2)

phx
phx

Reputation: 5937

It works if i do the textfield value setting at

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

Upvotes: 0

pfandrade
pfandrade

Reputation: 2419

Not exactly sure what you are asking, but maybe you should have a look at

@property(nonatomic) BOOL allowsSelectionDuringEditing

Discussion

If the value of this property is YES , users can select rows during editing. The default value is NO. If you want to restrict selection of cells regardless of mode, use allowsSelection.

on the UITableView documentation.

Upvotes: 1

Related Questions