您的位置:首页 > 其它

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类源文件内容
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: