繁体   English   中英

AlertView中的图像在iOS7中不起作用

[英]Image in alertview is not working in ios7

我使用以下代码在警报视图中添加图像。 但是它不起作用。

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Popup" message:@"popup" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];

UIImageView *tempImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"gg.jpg"]];

tempImg.contentMode = UIViewContentModeScaleToFill;

tempImg.frame = CGRectMake(90, 40, 100, 120);

//    tempImg.image = [UIImage imageNamed:@"gg.jpg"];

[alert addSubview:tempImg];

[alert show];

提前致谢

您不能在iOS 7中将addSubview用于UIAlertView。如果要自定义,则必须创建自己的alertView。 网上也有很多自定义的alertview。 你可以试试这一个

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM