Monday, November 12, 2012

修改UIAlert样式的代码


修改UIAlert样式的代码 

UIImage *theImage = [UIImage imageNamed:@"alert_big.png"];    
theImage = [theImage stretchableImageWithLeftCapWidth:0. topCapHeight:0.];
CGSize theSize = [alertShow frame].size;
UIGraphicsBeginImageContext(theSize);    
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];    
theImage = UIGraphicsGetImageFromCurrentImageContext();    
UIGraphicsEndImageContext();
alertShow.layer.contents = (id)[theImage CGImage];

No comments: