iOS 添加导航栏两侧按钮
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"首页" style:UIBarButtonItemStyleBordered target:self action:@selector(popToRootView)] ; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"测试" style:UIBarButtonItemStyleBordered target:self action:@selector(test)] ;
//有时需要设置按钮大小才行
- (void)popToRootView{ [self.navigationController popToRootViewControllerAnimated:YES]; } - (void) test{ NSLog(@"test"); }