开发者

Any way to show an image with an Alert

All,

I am doing an app, where after selecting 5 images a pop should ap开发者_Go百科pear saying its done, and having a OK button, after clicking OK it will come to its original view.

How can I do that, can I show an image with the alert view.

Please help me.

Many Thanks in advance for your help


You should be able to do this:

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:@"image.png"]];
    UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
    [imageView setImage:bkgImg];
    [bkgImg release];
    [path release];

    [successAlert addSubview:imageView];
    [imageView release];

    [successAlert show];
    [successAlert release];

I think that this should work. Don't know if it'll pass apple's review though.


You can refer Aurum's post to set an image inside your alertview.

To cover the whole screen you need to customize your alertview.

For this you can refer to this Post

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜