iPhone NavigationBar和UIToolbar基础
navigation bar 分为三个部分,左按钮,右按钮和中间的View.
在Controller中可以通过以三个方式来引用:
- self.navigationItem.titleView
- self.navigationItem.leftBarButtonItem
- self.navigationItem.rightBarButtonItem
- typedef enum {
- UIBarButtonSystemItemDone,
- UIBarButtonSystemItemCancel,
- UIBarButtonSystemItemEdit,
- UIBarButtonSystemItemSave,
- UIBarButtonSystemItemAdd,
- UIBarButtonSystemItemFlexibleSpace,
- UIBarButtonSystemItemFixedSpace,
- UIBarButtonSystemItemCompose,
- UIBarButtonSystemItemReply,
- UIBarButtonSystemItemAction,
- UIBarButtonSystemItemOrganize,
- UIBarButtonSystemItemBookmarks,
- UIBarButtonSystemItemSearch,
- UIBarButtonSystemItemRefresh,
- UIBarButtonSystemItemStop,
- UIBarButtonSystemItemCamera,
- UIBarButtonSystemItemTrash,
- UIBarButtonSystemItemPlay,
- UIBarButtonSystemItemPause,
- UIBarButtonSystemItemRewind,
- UIBarButtonSystemItemFastForward,
- UIBarButtonSystemItemUndo, // available in iPhone 3.0
- UIBarButtonSystemItemRedo, // available in iPhone 3.0
- } UIBarButtonSystemItem;
- [[[UIBarButtonItem alloc]
- initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
- target:nil action:NULL] autorelease];
- typedef enum {
- UIBarButtonItemStylePlain, // shows glow when pressed
- UIBarButtonItemStyleBordered,
- UIBarButtonItemStyleDone,
- } UIBarButtonItemStyle;
- typedef enum {
- UIBarStyleDefault = 0,
- UIBarStyleBlack = 1,
- UIBarStyleBlackOpaque = 1, // Deprecated. Use UIBarStyleBlack
- UIBarStyleBlackTranslucent = 2, // Deprecated. Use UIBarStyleBlack and set the translucent property to YES
- } UIBarStyle;
- NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:4];
- UIBarButtonItem *flexibleSpaceItem;
- flexibleSpaceItem = [[[UIBarButtonItem alloc]
- initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
- target:nil action:NULL] autorelease];
- [buttons addObject:flexibleSpaceItem];
- [flexibleSpaceItem release];
- UIBarButtonItem *item;
- item = [[UIBarButtonItem alloc]
- initWithImage:[UIImage imageNamed:@"down.png"]
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector(decrement:)];
- [buttons addObject:item];
- [item release];
- item = [[UIBarButtonItem alloc]
- initWithImage:[UIImage imageNamed:@"up.png"]
- style:UIBarButtonItemStylePlain target:self
- action:@selector(increment:)];
- [buttons addObject:item];
- [item release];
- item = [[[UIBarButtonItem alloc]
- initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
- target:nil action:NULL] autorelease];
- [buttons addObject:item];
- [item release];
- flexibleSpaceItem = [[[UIBarButtonItem alloc]
- initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
- target:nil action:NULL] autorelease];
- [buttons addObject:flexibleSpaceItem];
- [flexibleSpaceItem release];
- UIToolbar *toolbar = [[UIToolbar alloc] init];
- toolbar.barStyle = UIBarStyleBlackOpaque;
- [toolbar setItems:buttons animated:YES];
- [toolbar sizeToFit];
转载于:https://www.cnblogs.com/KiloNet/archive/2010/08/24/1807328.html
iPhone NavigationBar和UIToolbar基础相关推荐
- 疯狂iOS 讲义(上) Objective-C 2.0与iPhone/iPad应用开发基础(国内首部iOS 7相关著作,小伙伴们,学好iPhone/iPad应用开发,我们一起做土豪吧)
疯狂iOS 讲义(上) Objective-C 2.0与iPhone/iPad应用开发基础(国内首部iOS 7相关著作,小伙伴们,学好iPhone/iPad应用开发,我们一起做土豪吧) 李刚 编 IS ...
- 疯狂iOS 讲义(上) Objective-C 2.0与iPhone/iPad应用开发基础
疯狂iOS 讲义(上)Objective-C 2.0与iPhone/iPad应用开发基础(国内首部iOS 7相关著作,小伙伴们,学好iPhone/iPad应用开发,我们一起做土豪吧) 李刚编 ISBN ...
- iPhone开发教程 UI基础课程(58课时)
qianqianlianmeng iPhone开发教程 UI基础课程(58课时) 第一章 iPhone开发入门 UI基础课程 第一章 iPhone开发入门 1.1 iOS概述和架构 ...
- 吃鸡神器iPhone苹果7Plus手机基础使用教程
吃鸡神器iPhone苹果7Plus手机基础使用教程 #和平精英#吃鸡神器 #数码家电 觉得行的压个AK给我看看,@我 轻喷 吃鸡神器iPhone苹果7Plus手机基础使用教程
- iPhone手机的这些基础功能 你都知道吗?
iOS作为独立的手机操作系统,不仅异于各类深度定制的安卓系统,即便与原生的安卓相比,在一些功能与体验上也有蛮大的区别! 功能一:浏览器长截图 iPhone自带的Safari浏览器可以长截图,同时按住& ...
- IOS 学习笔记 Toolbar NavigationBar 导航栏 工具栏
Toolbar使用gif图展示效果图: NavigationBar使用gif效果图 导航栏和工具栏(UIToolbar and NavigationBar) 工具栏和导航栏实际上是有很大差距的,这里放 ...
- 苹果正在研发iPhone检测抑郁症功能
近日,据国外媒体报道,知情人士透露,苹果公司正在与加州大学洛杉矶分校和制药公司百健公司合作,开发能够帮助诊断抑郁症和认知能力下降的iPhone功能. 据悉,研究人员希望通过对数据的分析,比如行动能力. ...
- iPhone又降价了!京东、苏宁安排上了 iPhone XS系列最高直降1700元
为了促进产品销量以及回馈用户,京东方面宣布对部分Apple产品开启促销活动.其中,针对iPhone XS及iPhone XS Max进行价格调整:iPhone XS Max官网价最高直降1700元,i ...
- iPhone开发视频教程 Objective-C部分 (51课时)
第一.二章 OC基础语法 iPhone开发教程 第一章 OC基础语法 iPhone开发概述-必看(1.1) http://www.apkbus.com/android-102215-1-1.htm ...
最新文章
- Docker最全教程——从理论到实战(六)
- JQuery 模糊匹配
- linux正则表达式awk讲解
- 5.1 上网本安装安卓x86_生信工具 | antiSMASH 安装教程
- redis的bigkeys命令之原理
- 正則表達式,终极使用!3个工具,搞定一切
- POS打印机系列之 = 并口
- python -day16-模块介绍
- 分区字段必须包含在主键字段_十年Java开发经验分享:24 个必须掌握的数据库面试问题...
- Django signal
- window10运行python弹出商店_Python上架Windows 10应用商店,但主要用于学习,正式项目还...
- 软件测试中动态测试与静态测试的区别
- 红包码收款码合二为一
- 第三章 分布式扩展(一)
- C++偶遇-菱形继承
- 苹果手表支持心电图功能,可能还是逃不过噱头的命运
- Docker commit 联系
- 网络层协议介绍与概述
- 出现数据库不给访问的情况
- geoserver发布TIF格式瓦片地图