码迷,mamicode.com
首页 > 其他好文 > 详细

Xcode自定义alertview

时间:2015-07-24 18:21:31      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:

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];

版权声明:本文为博主原创文章,未经博主允许不得转载。

Xcode自定义alertview

标签:

原文地址:http://blog.csdn.net/liuyinghui523/article/details/47044027

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!