0

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

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ramkumar
  • 106
  • 1
  • 1
  • 5
  • 1
    With iOS7, Apple removed this feature of attaching a subview to a standard UIAlertView. For custom UIAlertView see the link -- http://stackoverflow.com/questions/18729220/uialertview-addsubview-in-ios7 – Yogendra Jul 11 '14 at 09:49
  • In ios7 you need to add subview in a way desribed in http://stackoverflow.com/a/21067447/2066428 – malex Jul 11 '14 at 17:29

1 Answers1

0

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.

DareDevil
  • 902
  • 8
  • 21