iPhone:在代码中的导航栏中将信息按钮添加为右侧栏按钮项 [英] iPhone: Adding Info button as right bar button item in navigation bar in code

查看:100
本文介绍了iPhone:在代码中的导航栏中将信息按钮添加为右侧栏按钮项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人在代码中创建信息按钮(圆形中的i),然后将其指定为导航栏的右侧栏按钮项目?

Has anyone had any success creating an info button (italic 'i' in a circle) in code (read: without Interface Builder), and then assigning it as the right bar button item of a navigation bar?

我看过无处不在,我甚至不能找到如何在代码中创建信息按钮。任何帮助将非常感激。

I've looked everywhere, and I can't even find how to create an info button in code. Any help would be greatly appreciated.

推荐答案

UIButton *btn = [UIButton buttonWithType:UIButtonTypeInfoDark];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];

这篇关于iPhone:在代码中的导航栏中将信息按钮添加为右侧栏按钮项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆