こんにちは皆私は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でうまくいきました。 コードは、この背後にある唯一の可能な理由は、AppleがAlertViewまたはその実装の層構造を変更しているだろうさ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