Adding left button to UINavigationBar (iPhone)

前端 未结 3 1799
无人及你
无人及你 2021-02-02 09:23

I\'ve created a new navigation based iPhone app. I added this to the RootViewController.

- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem *add         


        
3条回答
  •  后悔当初
    2021-02-02 10:10

    You don't define what the button actually does. This is a line from my app:

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelEdit:)];
    

    cancelEdit:, the selector, is in the current class (self) and is defined as:

    - (void) cancelEdit: (id) sender;
    

提交回复
热议问题