0

Possible Duplicate:
Image in UIAlertView

I am implementing a puzzle game. after player won I'm showing an alert that You won. but with that I want to add smiley on my alert view. How to do that?

Community
  • 1
  • 1
Trup
  • 635
  • 5
  • 17

1 Answers1

1

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

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

    [successAlert show];
    [successAlert release];

copied form here

Community
  • 1
  • 1
arun
  • 3,667
  • 3
  • 29
  • 54