嗨,大家好我是使用下面的代码给UIAlertView.I自定义颜色使用S.D.K. 3.2.3和颜色正在变成所需的颜色。但今天我更新了我的S.D.K.现在我正在使用4.2.1,并在此S.D.K上运行此代码。它工作。但是当我再次检查AlertView的颜色没有改变,但我提供的图像的颜色,移动到alertview的后方。我不知道为什么会发生这种情况。 是否有任何问题,我不与ios 4.2一起工作。 只是让我知道如何做到这一点在iOS 4.2代码与3.2.3 sdk工作良好。 代码是UIAlertView自定义颜色
UIAlertView *ForgotPassalert= [[UIAlertView alloc]initWithTitle:@"Status" message:@"An Email has sent to your Account Containing User Name and Password " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"cancel",nil];
CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0,
-120.0);
[ForgotPassalert setTransform: moveUp];
[ForgotPassalert show];
#pragma mark (AlertView Custom Color)
UIImage *theImage = [UIImage imageNamed:@"Untitled-1.png"];
theImage = [theImage stretchableImageWithLeftCapWidth:16 topCapHeight:16];
CGSize theSize = [ForgotPassalert frame].size;
UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[[ForgotPassalert layer] setContents:(id)theImage.CGImage];
//[[Passalert layer]setBackgroundColor:[[UIColor colorWithRed:179.0f/255.0f green:21.0f/255.0f blue:17.0f/255.0f alpha:1.0f]CGColor]];
[[ForgotPassalert layer]setCornerRadius:7.3F];
[ForgotPassalert release];
好吧,是的,我也在想同样的。感谢 – Sabby 2010-12-06 04:07:07