【发布时间】:2014-07-11 09:43:27
【问题描述】:
我使用以下代码在警报视图中添加图像。但它不起作用。
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];
提前致谢
【问题讨论】:
-
在 iOS7 中,Apple 删除了将子视图附加到标准 UIAlertView 的这一功能。对于自定义 UIAlertView,请参阅链接 -- stackoverflow.com/questions/18729220/…
-
在 ios7 中,您需要以 stackoverflow.com/a/21067447/2066428 中描述的方式添加子视图
标签: ios objective-c ios7