0
我有一个iphone应用程序,我使用波纹管代码自定义我的alertview。它在模拟器中工作正常。但是当我将它添加到我的iphone时,它显示的是同一个蓝色的。不是我定制的视图。是否有人可以帮助我?定制的UIAlertview不显示在iphone中?
UIAlertView *theAlert = [[UIAlertView alloc] initWithTitle:@"title" message:@"canceled"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
//[alert setUIColor:[UIColor brownColor]];
/*[alert show];
[alert release];*/
//UIAlertView *theAlert = [[UIAlertView alloc] initWithTitle:@"Message" message:@"canceled"
//delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[theAlert show];
UILabel *theTitle = [theAlert valueForKey:@"_titleLabel"];
[theTitle setTextColor:[UIColor whiteColor]];
UILabel *theBody = [theAlert valueForKey:@"_bodyTextLabel"];
[theBody setTextColor:[UIColor whiteColor]];
theBody.font = [UIFont boldSystemFontOfSize:16.0];
UIImage *theImage = [UIImage imageNamed:@"pop_up.png"];
theImage = [theImage stretchableImageWithLeftCapWidth:28 topCapHeight:28];
CGSize theSize = [theAlert frame].size;
UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//[[theAlert layer] setContents:[theImage CGImage]];
[[theAlert layer] setContents:(id)[theImage CGImage]];
[theAlert release];