开发者社区 问答 正文

关于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 2255 分享 版权
0 条回答
写回答
取消 提交回答
问答地址: