修改UIAlertView背景
转自:http://www.cocoachina.com/bbs/read.php?tid=11741 感谢
修改了一下,下面的代码能达到原来的效果
UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention"
message: @"I'm a Chinese!"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Okay",nil] autorelease];
[theAlert show];
UIView *additonBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, alert.frame.size.width-30, alert.frame.size.height-20)];
additonBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"loveChina.png"]];
#if TARGET_IPHONE_SIMULATOR
[theAlert insertSubview:additonBackgroundView atIndex:1];
#else
[theAlert insertSubview:additonBackgroundView atIndex:0];
#endif
[additonBackgroundView release];
UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention"
message: @"I'm a Chinese!"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Okay",nil] autorelease];
[theAlert show];
UIView *additonBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, alert.frame.size.width-30, alert.frame.size.height-20)];
additonBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"loveChina.png"]];
#if TARGET_IPHONE_SIMULATOR
[theAlert insertSubview:additonBackgroundView atIndex:1];
#else
[theAlert insertSubview:additonBackgroundView atIndex:0];
#endif
[additonBackgroundView release];
[ 此帖被bright在2011-11-24 16:42重新编辑 ]
图片:图片 1.png


posted on 2012-03-22 09:58 kiao295338444 阅读(387) 评论(1) 收藏 举报
浙公网安备 33010602011771号