Xcode自定义alertview
2015-07-24 17:14
253 查看
CustomIOS7AlertView *alert = [[CustomIOS7AlertViewalloc]
init];
UIView *mainView = [[UIViewalloc]
initWithFrame:CGRectMake(0,0,
280, 140)];
UIImageView *imgView = [[UIImageViewalloc]
initWithFrame:CGRectMake(10,10,
20, 20)];
[imgViewsetImage:[UIImageimageNamed:@"log-120.png"]];
UILabel *labelaAppName = [[UILabelalloc]
initWithFrame:CGRectMake(35,10,
100, 20)];
[labelaAppName
setBackgroundColor:[UIColorclearColor]];
labelaAppName.text =@"测试";
UILabel *labelContext = [[UILabelalloc]
initWithFrame:CGRectMake(10,40,
260, 90)];
labelContext.text = message;
[labelContext
setFont:[UIFontsystemFontOfSize:14]];
[labelContext
setBackgroundColor:[UIColorclearColor]];
[labelContext
setTextAlignment:NSTextAlignmentLeft];
labelContext.lineBreakMode =NSLineBreakByWordWrapping;
labelContext.numberOfLines =0;
[labelContextsizeToFit];
[labelContextsetCenter:CGPointMake(140.0,
labelContext.center.y)];
[mainViewsetFrame:CGRectMake(mainView.frame.origin.x,
mainView.frame.origin.y,280.0, labelContext.frame.origin.y
+ labelContext.frame.size.height +
14.0)];
[mainViewaddSubview:imgView];
[mainViewaddSubview:labelaAppName];
[mainViewaddSubview:labelContext];
[alert setButtonTitles:@[@"确定"]];
[alertsetContainerView:mainView];
[alertsetOnButtonTouchUpInside:^(CustomIOS7AlertView *alertView,int
buttonIndex){
[alertViewclose];
}];
[alertshow];
CustomIOS7AlertView类源文件内容
init];
UIView *mainView = [[UIViewalloc]
initWithFrame:CGRectMake(0,0,
280, 140)];
UIImageView *imgView = [[UIImageViewalloc]
initWithFrame:CGRectMake(10,10,
20, 20)];
[imgViewsetImage:[UIImageimageNamed:@"log-120.png"]];
UILabel *labelaAppName = [[UILabelalloc]
initWithFrame:CGRectMake(35,10,
100, 20)];
[labelaAppName
setBackgroundColor:[UIColorclearColor]];
labelaAppName.text =@"测试";
UILabel *labelContext = [[UILabelalloc]
initWithFrame:CGRectMake(10,40,
260, 90)];
labelContext.text = message;
[labelContext
setFont:[UIFontsystemFontOfSize:14]];
[labelContext
setBackgroundColor:[UIColorclearColor]];
[labelContext
setTextAlignment:NSTextAlignmentLeft];
labelContext.lineBreakMode =NSLineBreakByWordWrapping;
labelContext.numberOfLines =0;
[labelContextsizeToFit];
[labelContextsetCenter:CGPointMake(140.0,
labelContext.center.y)];
[mainViewsetFrame:CGRectMake(mainView.frame.origin.x,
mainView.frame.origin.y,280.0, labelContext.frame.origin.y
+ labelContext.frame.size.height +
14.0)];
[mainViewaddSubview:imgView];
[mainViewaddSubview:labelaAppName];
[mainViewaddSubview:labelContext];
[alert setButtonTitles:@[@"确定"]];
[alertsetContainerView:mainView];
[alertsetOnButtonTouchUpInside:^(CustomIOS7AlertView *alertView,int
buttonIndex){
[alertViewclose];
}];
[alertshow];
CustomIOS7AlertView类源文件内容
相关文章推荐
- mysql优化limit查询语句的5个方法
- jsp 页面添加视频并显示播放时间
- 性能计数器监控typeperf
- Survival(ZOJ 2297状压dp)
- 【Java】将构造函数声明为私有有什么作用?
- MYSQL数据插入 乱码问题 default-character-set=latin1改成default-character-set=utf8 在my.ini文件中。需要改动两处
- pandas options and settings
- 在linux系统下添加新硬盘
- Arcgis Server开发使用query报错
- Arduino硬件开发--红外遥控舵机
- html5之多媒体
- 使用Android am命令启动相关程序
- Online Judge System For SzNOI 题库 语法百题 c++ d023
- gtk防止窗口最大化
- 打开设备管理器的快捷方式
- cookie 和session 的区别详解
- MFC会播放的界面,动态界面
- 北航12年机试--统计关键字的C语言实现
- 类的加载(load)和初始化(initialize)
- spring基础