简体   繁体   中英

Image in alertview is not working in ios7

I used the follwing code to add image in alert view. But its not working.

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];

Thanks in advance

You can not use addSubview to a UIAlertView from iOS 7. You have to make your own alertView if you want to customize it. There are also lots of custom alertview available on net. You may try this one .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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