iPhone Storyboard Editing a table view

前端 未结 7 1496
囚心锁ツ
囚心锁ツ 2021-02-06 04:15

I\'ve been trying to learn the new Storyboard feature in Xcode and I\'ve run into a problem with trying to set a UITableView to edit mode.

So far my storyboard looks lik

7条回答
  •  南旧
    南旧 (楼主)
    2021-02-06 05:03

    To add to @Graham answer, you might also want to change the style so you can have the "Done" button style (the blue color). Something like this:

    - (IBAction)setEditMode:(UIBarButtonItem *)sender {
        if (self.editing) {
            sender.title = @"Edit";
            sender.style = UIBarButtonItemStylePlain;
            [super setEditing:NO animated:YES];
        } else {
            sender.title = @"Done";
            sender.style = UIBarButtonItemStyleDone;
            [super setEditing:YES animated:YES];
        } 
    }
    

提交回复
热议问题