通过uiviewcontroller添加的navigationbar怎么展示
1个回答
推荐于2016-07-18
展开全部
如果你创建的Controller本身就是UINavigationController,你可以直接在当前的UIViewController的ViewDidLoad中直接写代码,如下:
- (void)viewDidLoad
{
// Add our custom add button as the nav bar's custom right view
UIBarButtonItem *addButton = [[[UIBarButtonItem alloc]initWithTitle:NSLocalizedString(@"AddTitle", @"")
style:UIBarButtonItemStyleBordered
target:self
action:@selector(addAction:)] autorelease];
self.navigationItem.rightBarButtonItem = addButton;
}
- (void)viewDidLoad
{
// Add our custom add button as the nav bar's custom right view
UIBarButtonItem *addButton = [[[UIBarButtonItem alloc]initWithTitle:NSLocalizedString(@"AddTitle", @"")
style:UIBarButtonItemStyleBordered
target:self
action:@selector(addAction:)] autorelease];
self.navigationItem.rightBarButtonItem = addButton;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询