我正在尝试将添加按钮推送到不同的视图控制器,但我没有使用情节提要。该按钮出现,但单击时不执行任何操作。这是我的代码:
-(void)pushLogin
{
[self.navigationController pushViewController:[[AddListingViewController alloc] init] animated:YES];
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.title = @"Listings";
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:nil
action:@selector(pushLogin)];
self.navigationItem.rightBarButtonItem = addButton;
}
有什么建议么?