首页 > 其他 > 详细

给AlertView添加图片背景

时间:2016-11-17 01:34:39      阅读:228      评论:0      收藏:0      [点我收藏+]

UIAlertView *theAlert = [[[UIAlertViewalloc]

initWithTitle:@"Attention"

message:@"I‘m a Chinese!"delegate:nilcancelButtonTitle:@"Cancel"

otherButtonTitles:@"Okay",nil] autorelease];

[theAlert show];

UIImage *theImage =

[UIImageimageNamed:@"loveChina.png"];

theImage = [theImage

stretchableImageWithLeftCapWidth:0topCapHeight:0];

CGSize theSize = [theAlert frame].size;

UIGraphicsBeginImageContext(theSize);

[theImage drawInRect:CGRectMake(5, 5,

theSize.width-10, theSize.height-20)];

theImage =

UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

theAlert.layer.contents = (id)[theImage CGImage];

给AlertView添加图片背景

原文:http://www.cnblogs.com/CJH5209/p/6072137.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!