如何解决iPhone中的默认alertView带有背景色iPhone
|| 我已经在iPhone应用程序中使用了默认警报视图很多次。但是有时它不能正常运行,它的背景颜色像是背景色(它只在视图中显示文本)。请帮帮我。 谢谢与问候 纳拉亚纳解决方法
试试这个替代
看看这个网址也http://kwigbo.com/post/318396305/iphone-sdk-custom-uialertview-background-color
Background of AlertView is an image And you can change this image
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,theSize.width,theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[[theAlert layer] setContents:[theImage CGImage]];
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。