iPhone Storyboard Editing a table view

前端 未结 7 1376
囚心锁ツ
囚心锁ツ 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

    one can use the dumb, not working Edit button from the Storyboard editor and then programmatically replace it with the UIViewController.editButtonItem.

    in viewDidLoad:

     NSMutableArray *toolbarItems = [NSMutableArray arrayWithArray:self.toolbarItems];
    
    [toolbarItems replaceObjectAtIndex:0 withObject:self.editButtonItem];
    
    [self setToolbarItems:toolbarItems];    
    

    this code assumes one has added the dumb Edit button as the leftmost item on the toolbar in the Storyboard.

提交回复
热议问题