Can you set the edit button of the navigation bar in Interface Builder?

Easy to customize table view for editing. Just add one line to your UITableViewController:

self.navigationItem.rightBarButtonItem = self.editButtonItem;

This line adds an edit button to the navigation bar, which changes the table to edit mode and changes its text to the Finish button during editing.

Is it possible to install this in Interface Builder? I see that you can add a UIBarButtonItem and you can set its "Identifier" to "Edit", but I do not see the expected behavior.

By the way, what does the “Identifier” do in the “Attributes” panel?

+3
source share
2

, UIBarButtonItems Interface Builder, .

(, "" "" ), "" .

: , , UIBarButtonItems, IB, .

UPDATE: UIViewController.editButtonItem - , UIBarButtonItem, setEditing. , , , UIBarButtonItem IB.

:

- IBAction edit:(id)sender;

:

- (IBAction) edit:(id)sender {
    [self setEditing:YES animated:YES];
}

UIBarButtonItem.

, .

+1

Source: https://habr.com/ru/post/1702866/


All Articles