创建按钮 ,添加到导航栏

 

UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancel:)];
    self.navigationItem.leftBarButtonItem = cancelButton;
    [cancelButton release];

 

上面@select()对应的cancel:

- (IBAction)cancel:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
 

你可能感兴趣的:(创建)