?

Log in

Previous Entry | Next Entry

Custom UIAllert

UIAllert with custom buttons and background.

At firtst we create UIImage with image file of background, then set's size of allert frame, and then sets it.

UIImage *theImage = [[UIImage imageNamed:@"allert_background.png"]autorelease];
CGSize theSize = [alert frame].size;
UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[[alert layer] setContents:[theImage CGImage]];

Custom "OK" and "Custom" buttons



UIImageView *img = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bt_ok_update_base.png"]]autorelease];
UIImageView *img1 = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bt_ok.png"]]autorelease];

[[alert.subviews objectAtIndex:1] addSubview:img1];
[[alert.subviews objectAtIndex:2] addSubview:img];

Comments

Profile

ios_dev_notes
IOS developer notes

Latest Month

February 2012
S M T W T F S
   1234
567891011
12131415161718
19202122232425
26272829   
Powered by LiveJournal.com
Designed by Tiffany Chow