Is it possible to add image in the AlertView?like showing image from plist file.
Need help. Thanks
Is it possible to add image in the AlertView?like showing image from plist file.
Need help. Thanks
You'll need to subclass UIAlertView and rearrange its subviews a bit. There are several tutorials for this kind of stuff:
You can do it like:
UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 10, 40, 40)];
NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"smile.png"]];
UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
[imageView setImage:bkgImg];
[bkgImg release];
[path release];
[successAlert addSubview:imageView];
[imageView release];
[successAlert show];
[successAlert release];
This will add a image in the right corner of your alertview you can change the frame image to move around.
Hope this helps.
Thanks,
Madhup