Button按钮的使用和弹出对话框
2015-06-15 20:02
302 查看
//弹出对话框
UIAlertView *alter=[[UIAlertView alloc] initWithTitle:@"第一次" message:@"第一次点击我" delegate:selfcancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alter show];
按住control键并拖动button按钮到@implementation ViewController 下,可以自动生成代码
![](https://img-blog.csdn.net/20150615201330365)
附代码:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (IBAction)btnclick:(id)sender {
NSLog(@"已经点击我了");
//弹出对话框
UIAlertView *alter=[[UIAlertView alloc] initWithTitle:@"第一次" message:@"第一次点击我" delegate:selfcancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alter show];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
UIAlertView *alter=[[UIAlertView alloc] initWithTitle:@"第一次" message:@"第一次点击我" delegate:selfcancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alter show];
按住control键并拖动button按钮到@implementation ViewController 下,可以自动生成代码
附代码:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (IBAction)btnclick:(id)sender {
NSLog(@"已经点击我了");
//弹出对话框
UIAlertView *alter=[[UIAlertView alloc] initWithTitle:@"第一次" message:@"第一次点击我" delegate:selfcancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alter show];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
相关文章推荐
- [LeetCode] Remove Duplicates from Sorted Array
- 在Excel里快速插入目录
- C++11.1 章 泛型算法---能够作用在不同类型的容器和元素上的算法
- Android LayoutInflater详解
- ubuntu常用命令
- Android之单元测试学习
- UIButton
- leetcode -Swap Nodes in Pairs
- [技巧篇]03.关于MyBatis的简单批量处理
- android.content.SharedPreferences.edit()
- Android之菜单总结
- Java产生随机数
- Jenkins源码分析
- jQuery实战:创建元素包装集,选择将被操作的元素
- Java集合类型(一)
- Valid Sudoku
- jenkins中使用到的Jelly标签库
- NLPIR(ICTCLAS2015)python调用接口配置
- Hadoop单机模式安装
- ubuntu开启sshd服务(转)