Reputation: 9
I wanted to use UIAlertView
to show photo. I´m using code as below for showing the alert, however it doesn't work. It shows the title, some space and button OK nothing more. I have no idea if I´m doing something wrong, because I´m new in iOS.
-(IBAction)ButtonPressed:(id)sender
{
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"titel"
message:nil
delegate:nil //or self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(180, 10, 85, 50)];
[imageView setImage:@"dog.png"];
[av setValue:imageView forKey:@"accessoryView"];
[av show];
}
Upvotes: 0
Views: 103
Reputation: 38249
@Popeye is correct what he said : UIAlertView
is meant to be used as-is and you shouldn't be messing with the view hierarchy this will get your app rejected from the Apple App review process. Please read Apple documentation regarding UIAlertViews. So you should NOT be using setValue: forKey:@"accessoryView"
and/or addSubview:
. Specific section below
Subclassing Notes
The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.
1) Use 3 party such as CNPPopupController and many other available check this link
OR
2) create of your own.
Upvotes: 1