改变UIAlertView背景

来源:互联网 发布:优化组织管理模式 编辑:程序博客网 时间:2024/06/05 19:07
UIAlertView *theAlert = [[[UIAlertViewalloc] initWithTitle:@"提示"                                                       message: @"错误"                                                      delegate:nil                                               cancelButtonTitle:@"Cancel"                                               otherButtonTitles:@"Okay",nil] autorelease];     [theAlert show];     UIImage *theImage = [UIImageimageNamed:@"alertBg"];        theImage = [theImage stretchableImageWithLeftCapWidth:0topCapHeight:0];     CGSize theSize = [theAlert frame].size;      UIGraphicsBeginImageContext(theSize);         [theImage drawInRect:CGRectMake(5, 5, theSize.width-10, theSize.height-20)];   theImage = UIGraphicsGetImageFromCurrentImageContext();         UIGraphicsEndImageContext();     theAlert.layer.contents = (id)[theImage CGImage];

0 0