IOS UIToolBar
来源:互联网 发布:如何淘宝开店 编辑:程序博客网 时间:2024/06/04 18:15
是一条显示 上面可以放一些东西 如UiBarButtonItem
首先创建两个 UIBarButtonItem
UIBarButtonItem *mybb1 = [[UIBarButtonItem alloc]initWithTitle:@"MYBB1" style:UIBarButtonItemStylePlain target:self action:@selector(item1Action)]; UIBarButtonItem *mybb2 = [[UIBarButtonItem alloc]initWithTitle:@"MYBB1" style:UIBarButtonItemStylePlain target:self action:@selector(item2Action)];
再创建一个UIBarbuttonItem的Label
UILabel *mytblabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; mytblabel.text = @"title"; UIBarButtonItem *mybarLabel = [[UIBarButtonItem alloc]initWithCustomView:mytblabel];
然后创建UIToolbar 并把三个Item加到toolbar里
NSArray *myItems = [NSArray arrayWithObjects:mybb1,mybb2,mybarLabel,nil];UIToolbar *myDemoToolBar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 200, self.view.bounds.size.width, 40)];myDemoToolBar.barStyle = UIBarStyleBlack;myDemoToolBar.alpha = 0.3;myDemoToolBar.items = myItems;[self.view addSubview:myDemoToolBar];
接下来再实现两个selector,一个显示UIAlertView,一个显示UIActionSheet
- (void) item1Action{ UIAlertView *myAlertView = [[UIAlertView alloc]initWithTitle:@"标题" message:@"继续" delegate:self cancelButtonTitle:@"false" otherButtonTitles:@"yes", nil]; [myAlertView show];}- (void) item2Action{ UIActionSheet *myActionSheet = [[UIActionSheet alloc]initWithTitle:@"title" delegate:self cancelButtonTitle:@"cancle" destructiveButtonTitle:@"yes" otherButtonTitles:@"go on",@"pause", nil]; [myActionSheet showInView:self.view];}
0 0
- IOS UIToolbar
- IOS UIToolBar
- ios 构建工具栏UIToolBar
- IOS UIToolbar 工具条实例
- 【ios】UIToolBar使用示例
- IOS控件UIToolBar、UIView
- 【iOS学习】----UIToolbar
- IOS之【UIToolbar】
- IOS--UIToolBar详细使用
- iOS UIToolBar的使用
- 轻松玩转iOS UIToolbar
- iOS 之UIActionSheet+UIToolBar+UIDatePickerView
- iOS之UIToolBar的使用
- iOS SDK详解之UIToolBar
- iOS中 UIToolBar 技术分享
- IOS学习笔记之UIToolBar
- iOS开发 UIToolBar的使用
- UIToolBar
- MySql事务详解
- java缓存框架详解
- linux下mail命令发送邮件
- 新型的遍历,用block + stop + obj
- nyoj27---水池数目
- IOS UIToolBar
- Android四大组件之BroadcastReceiver
- Android——Volley学习
- Web前端开发规范文档
- FieldRetrievingFactoryBean
- 2013 Office Word 编辑常用功能
- Activity中fragment管理(回退)
- idea2016.1 使用Kotlin + Gradle 创建工程
- SpringMVC测试