iOS基础控件-UIToolBar 导航控制器的重要属性-工具栏
来源:互联网 发布:淘宝没有高仿手表 编辑:程序博客网 时间:2024/06/15 04:26
<XSRootViewController.m>
/***UIToolBar的使用**
** UINavigationController有一个toolBar属性
** UIToolBar继承与UIView
** UINavigationController底部工具栏默认处于掩藏状态
** 每个是同控制器可以通过toolBarItems属性来定制toolBar
**UIToolBar常用属性**
@property(nonatomic) UIBarStyle barStyle; // default is UIBarStyleDefault (blue)
@property(nonatomic,copy) NSArray *items; // get/set visible UIBarButtonItem. default is nil. changes not animated. shown in order
*/
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor= [UIColorredColor];
[self.navigationItemsetTitle:@"显示工具栏"];
//显示工具栏
//self.navigationController.toolbarHidden = NO;
//显示工具栏并伴有动画
[self.navigationControllersetToolbarHidden:NOanimated:YES];
/*
// 设置toolbar的背景图片,
//forToolbarPosition
toolbar位置,UIBarPositionAny = 0,
UIBarPositionBottom = 1,
// The bar is at the bottom of its local context, and directional decoration draws accordingly (e.g., shadow above the bar).
UIBarPositionTop = 2,
// The bar is at the top of its local context, and directional decoration draws accordingly (e.g., shadow below the bar)
UIBarPositionTopAttached = 3,
// The bar is at the top of the screen (as well as its local context), and its background extends upward—currently only enough for the status bar.
barMetrics 工具栏的度量
UIBarMetricsDefault, 默认(竖屏)
UIBarMetricsLandscapePhone, 风景模式(横屏)
UIBarMetricsDefaultPrompt = 101, // Applicable only in bars with the prompt property, such as UINavigationBar and UISearchBar
UIBarMetricsLandscapePhonePrompt,
*/
[self.navigationController.toolbarsetBackgroundImage:[UIImageimageNamed:@"composeiconbg@2x.png"]forToolbarPosition:UIBarPositionAnybarMetrics:UIBarMetricsDefault];
//通过toolBarItems来定制工具栏的显示,数组中方的时UIBarButtonItem实例
//@property (nonatomic, retain) NSArray *toolbarItems NS_AVAILABLE_IOS(3_0);
UIBarButtonItem*btnItem1 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAddtarget:selfaction:nil];
UIBarButtonItem*btnItem2 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarkstarget:selfaction:nil];
//item的间隔,间隔是自动算出来的
UIBarButtonItem*spaceItem = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpacetarget:selfaction:nil];
NSArray *array = [[NSArrayalloc]initWithObjects:btnItem1,spaceItem,btnItem2,nil];
//通过toolbarItems来定制工具栏的显示,数组中方的是UIButtonItem实例
self.toolbarItems= array;
}
0 0
- iOS基础控件-UIToolBar 导航控制器的重要属性-工具栏
- iOS基本控件-UINavigationItem 导航控制器的重要属性,UINavigationBar的重要属性UINavigationItem
- iOS基础控件-导航栏控制器UINavigationController的UINavigationBar导航条
- iOS基础控件-UITabBarController - 2 之UITabBarItem 详解,结合视图控制器和导航控制器的用法
- IOS-导航控制器和工具栏
- ios 构建工具栏UIToolBar
- iOS基础控件-UIViewController,视图控制器
- UIToolBar工具栏的使用
- UINavigationController--导航控制器(UINavigationBar、UIToolBar)
- IOS控件UIToolBar、UIView
- 【IOS 开发学习总结-OC-50】★ios开发之UI控件——UIToolBar(工具栏)
- iPhone导航控制器的重要“方法”
- iPhone导航控制器的重要“方法”
- iOS开发基础学习笔记——导航控制器2->导航栏(UINavigationBar)/工具栏(toolBar)/导航元素按钮(UINavigationItem)
- iOS 导航控制器、导航条、导航项、控制器的关系
- ios--导航控制器的基本概念
- iOS导航控制器的使用
- iOS导航控制器的注意事项
- android之android.intent.category.DEFAULT的用途和使用
- SVD在推荐系统中的应用
- 获取下拉选的值
- 关于Unicode字符集
- 修改Weblogic默认的SERVER NAME
- iOS基础控件-UIToolBar 导航控制器的重要属性-工具栏
- 盘点中国知名网络游戏公司
- 《程序员修炼之道》读书笔记
- 如何实现缓存系统的更新机制
- [数据结构与算法]归并排序
- Rotated Sorted Array(合辑)
- WCF学习
- 关于LaTeX中pdf和eps图片格式处理
- Java_eclipse_字体大小设置问题;