3

これはツールバー項目用です。

次のコードは、iOS 6 シミュレーターと iOS 6 デバイスで正常に動作します。

シャドウ オフセット (UITextAttributeTextShadowOffset) は、iOS 5 シミュレーターおよび iOS 5 デバイスでは無視されます。

 [_doneButton setBackgroundImage:[UIImage imageNamed:@"standardButtonImage.png"]
                       forState:UIControlStateNormal
                     barMetrics:UIBarMetricsDefault];
 NSDictionary *textDic = [NSDictionary dictionaryWithObjectsAndKeys:
                         [UIFont fontWithName:@"Helvetica-Bold" size:15.0],  UITextAttributeFont,
                         [UIColor whiteColor],                               UITextAttributeTextColor,
                         [UIColor blackColor],                               UITextAttributeTextShadowColor,
                         [NSValue valueWithUIOffset:UIOffsetMake(1.0,1.0)],  UITextAttributeTextShadowOffset, //won't honor the offset in ios5
                         // it's not the font, font size, text color, background image, or order in the dictionary.  Must be an Apple bug.
                         // also doesn't work if you specify [UIBarButtonItem appearance]
                        nil];
 [_doneButton setTitleTextAttributes:textDic forState:UIControlStateNormal];

誰かが同じ経験をしたことがありますか、またはこのコードに何か問題があることがわかりますか?

4

1 に答える 1