我正在尝试以编程方式向viewController添加一个返回按钮,但它不会通过模拟器显示在界面上。我在代码中遗漏了什么?只有空白屏幕存在构建错误!
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void) performAdd:(id)paramSender{
NSLog(@"Button got called");
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.view.backgroundColor = [UIColor blackColor];
self.title =@"go Back";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:(UIBarButtonSystemItemAdd)
target:self
action:@selector(performAdd:)];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end