iOS开发 UIToolBar的使用
1、创建工程项目和视图控制器 1、创建一个Sing View Application工程项目; 2、选中Main.storyboard进行编辑; 3、添加Navigation Controller并将箭头指向它; 4、将Navigation Controller的rootViewController指向View Controller。

3、设置UIToolBar属性(在iOS7以后使用) 1、设置半透明:setTranslucent; 2、设置痕迹颜色:barTintColor; 3、设置背景颜色:setBarTintColor; 4、设置背景图片:setBackgroundImage:forToolbarPosition:barMetrics:。

5、为UIToolBar添加UIBarButtonItem 1、创建一个数组itemsArray; 2、数组上添加UIBarButtonItem; 3、将itemsArray传给UIToolBar:self.toolbarItems = itemsArray。注意:要平均排版就需要添加空格space。

7、完成 效果如图

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。