您的位置:首页 > 产品设计 > UI/UE

Change background color of a UIAlertView

2010-02-08 15:38 381 查看
UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention"

message: @"I'm a Chinese!"

delegate:nil

cancelButtonTitle:@"Cancel"

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

[theAlert show];

/*

for(UIView *view in [theAlert subviews]){

if(view.tag ==1){

view.backgroundColor = [UIColor greenColor];

}

}

*/

UIImage *theImage = [UIImage imageNamed:@"loveChina.png"];

theImage = [theImage stretchableImageWithLeftCapWidth:0. topCapHeight:0.];

CGSize theSize = [theAlert frame].size;

UIGraphicsBeginImageContext(theSize);

[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];

theImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

theAlert.layer.contents = (id)[theImage CGImage];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: