开发者社区> 问答> 正文

关于Navigationbar按钮不显示 的问题

有个UINavigationController,需要显示导航条按钮,代码如下:

UINavigationController *nav=[[UINavigationController alloc] init];
[self.view addSubview:nav.view];

UIImage *info_iphone=[UIImage imageNamed:@"button.png"];
UIButton *infobtn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 48, 30)];
[infobtn setBackgroundImage:info_iphone forState:UIControlStateNormal];
[infobtn addTarget:self action:@selector(show_info:) forControlEvents:UIControlEventTouchUpInside];

self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:infobtn];

展开
收起
爵霸 2016-03-19 09:37:24 2076 0
0 条回答
写回答
取消 提交回答
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载