UI基础:UIActionSheet和UIAlterView
2015-08-22 17:48
453 查看
iOS中有两个弹出视图的控件,分别是UIActionSheet和UIAlterView.效果图如下:
主要代码如下:
主要代码如下:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UIButton * button1 = [UIButton buttonWithType:UIButtonTypeCustom]; button1.frame = CGRectMake(100, 100, 100, 50); button1.backgroundColor = [UIColor cyanColor]; [button1 addTarget:self action:@selector(onclick1:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button1]; UIButton * button2 = [UIButton buttonWithType:UIButtonTypeCustom]; button2.frame = CGRectMake(100 , 200, 100, 50); button2.backgroundColor = [UIColor redColor]; [button2 addTarget:self action:@selector(onclick2:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button2]; } -(void)onclick1:(UIButton *)btn{ UIActionSheet * actionsheet = [[UIActionSheet alloc]initWithTitle:@"提示信息" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确认" otherButtonTitles:nil]; [actionsheet showInView:self.view]; } -(void)onclick2:(UIButton *)btn{ UIAlertView * alterView = [[UIAlertView alloc]initWithTitle:@"警告" message:@"您的言论违法中华人民共和国法律,有可能查你水表" delegate:self cancelButtonTitle:@"继续发表" otherButtonTitles:nil]; [alterView show]; }
相关文章推荐
- IT该忍者神龟Instant client required
- UI基础:UICollectionView
- hdu 2818 Building Block(加权并查集)2009 Multi-University Training Contest 1
- LeetCode-N-Queens
- VS2012加载DLL编译出现试图加载格式不正确的程序; 以及运行出现Mixed mode assembly is built against version 'v2.0.50727' of the
- 动态限制UITextField或UITextView用户输入中英文混编字数统计
- uint16,uint32是什么?
- uint16,uint32是什么?
- GDI+ 使用指南(basic guiding of GDI plus )
- 如何在UEFI+GPT下使用rEFind实现Win10 + Kali2.0 双引导!
- hdu5400 Arithmetic Sequence
- UIButton及UITextfield
- UI-封装
- UIViewController
- UI-UIImageView
- HTML初体验之1——关于HBuilder文件放置
- UI -视图控制器UIViewController
- UIView及其子类
- iOS 笔记三: UITextView和视图控制器生命周期(View Controller LifeCycle)
- The one who can give anything you want is only yourself. The rating is the only you should pursue.