You are on page 1of 2

/*UIView *alertMessage=[[[UIView alloc]

initWithFrame:CGRectMake(10, 80, 300,250)] autorelease];

[self.view addSubview:alertMessage];*/

alert = [[[UIAlertView alloc] initWithTitle:@"Exit?" message:@"Do you


really want to Quit this game?" delegate:self cancelButtonTitle:nil otherButtonTitles:nil] autorelease];
//alert.frame=CGRectMake(10, 80, 300, 200);
//alert.backgroundColor=[UIColor whiteColor];
//alert.superview.backgroundColor=[UIColor whiteColor];
//[alert setAlpha:1];
/*UIImage *theImage = [UIImage imageNamed:@"screen2.png"];
//theImage = [theImage stretchableImageWithLeftCapWidth:16
topCapHeight:16];
CGSize theSize = [alert frame].size;

UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

[[alert layer] setContents:[theImage CGImage]];*/

UIButton *btnYes=[[UIButton buttonWithType:UIButtonTypeCustom]


retain];
btnYes.tag=0;
btnYes.frame = CGRectMake(0.0, 110.0, 78.0, 37.0);
btnYes.backgroundColor = [UIColor clearColor];

UIImage *yesImage= [UIImage imageNamed:@"yes1.png"];


UIImage *btnYesImage = [yesImage
stretchableImageWithLeftCapWidth:78 topCapHeight:37];
[btnYes setBackgroundImage:btnYesImage
forState:UIControlStateNormal];

UIImage *yesImage2 = [UIImage imageNamed:@"yes2.png"];


UIImage *yesImage2Pressed = [yesImage2
stretchableImageWithLeftCapWidth:78 topCapHeight:37];

[btnYes setBackgroundImage:yesImage2Pressed
forState:UIControlStateHighlighted];
[btnYes addTarget:self action:@selector(pressAlert:)
forControlEvents:UIControlEventTouchUpInside];

[alert addSubview:btnYes];

UIButton *btnNo=[[UIButton buttonWithType:UIButtonTypeCustom]


retain];
btnNo.tag=1;
btnNo.frame = CGRectMake(200.0, 110.0, 78.0, 37.0);
btnNo.backgroundColor = [UIColor clearColor];

UIImage *noImage= [UIImage imageNamed:@"no1.png"];


UIImage *btnNoImage = [noImage
stretchableImageWithLeftCapWidth:78 topCapHeight:37];
[btnNo setBackgroundImage:btnNoImage
forState:UIControlStateNormal];

UIImage *noImage2 = [UIImage imageNamed:@"no2.png"];


UIImage *noImage2Pressed = [noImage2
stretchableImageWithLeftCapWidth:78 topCapHeight:37];

[btnNo setBackgroundImage:noImage2Pressed
forState:UIControlStateHighlighted];
[btnNo addTarget:self action:@selector(pressAlert:)
forControlEvents:UIControlEventTouchUpInside];

[alert addSubview:btnNo];
//alert.backgroundColor=[UIColor clearColor];

[alert show];

[btnNo release];
[btnYes release];

You might also like