点击Button弹出警告表
2015-06-13 15:06
369 查看
按钮代码 UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom]; [myButton setTitle:@"求最佳哦~" forState:UIControlStateNormal]; [myButton setTitle:@"可以松手~" forState:UIControlStateHighlighted]; [myButton addTarget:self action:@selector(myButton:) forControlEvents:UIControlEventTouchUpInside]; myButton.backgroundColor = [UIColor yellowColor]; myButton.bounds = CGRectMake(0, 0, 200, 100); myButton.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2); [self.view addSubview:myButton]; 按钮响事件函数 -(void)myButton:(UIButton *)sender{ UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"按钮点击提示" delegate:self cancelButtonTitle:@"确定" otherButtonTitles: nil]; [myAlertView show]; }
相关文章推荐
- iOS 代码触发button点击事件 objective-c怎么代码触发按钮点击事件
- Insert All的妙用
- 线程的
- Qt 5.5 beta 让我高兴的新东西 Qt Quick Extras
- Shell中的${},##和%%的使用
- 实现记住用户名和密码(加了一个引导页)
- 写给新手程序员的一封信
- 【ASP.NET】——SQL注入
- 使用Java完成《算法导论》习题2.3-7
- Python的zip函数
- CWnd中PreCreateWindow、PreSubclassWindow、SubclassWindow的区别
- uIP中国的协议文件:Ch01
- expr的简单应用
- android studio 安装启动出现 The environment variable Java_home does not point to JVm。。
- 测试登录界面
- JAVA读取classess下的.properties配置文件封装类
- C++ 中调用执行Python文件
- 实现一个自适应布局 两列布局
- Gaussian distribution
- jsrender for array 和for object语法