簡體   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