【发布时间】:2011-10-05 06:17:29
【问题描述】:
各位,我需要在 UIAlertView 上设置一张图片..
我已将我的 UIAlertview 附加到图像问题中。
我已经使用了这个代码行..
UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention"
message: @"YOUR MESSAGE HERE", nil)
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[theAlert show];
UILabel *theTitle = [theAlert valueForKey:@"_titleLabel"];
[theTitle setTextColor:[UIColor redColor]];
UILabel *theBody = [theAlert valueForKey:@"_bodyTextLabel"];
[theBody setTextColor:[UIColor blueColor]];
UIImage *theImage = [UIImage imageNamed:@"Background.png"];
theImage = [theImage stretchableImageWithLeftCapWidth:16 topCapHeight:16];
CGSize theSize = [theAlert frame].size;
UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[[theAlert layer] setContents:[theImage CGImage]];
请解决这个问题.. 我只需要带有警报的图像..
【问题讨论】:
-
恕我直言 - 如果我看到那种警报视图,我会刺伤我的眼睛......
-
所以,除了解决我的问题,请你有什么想法......
标签: objective-c ios cocoa-touch uikit uialertview