Ios5 工具栏项不存在';无法在iOS 5中使用UITextAttributeTextShadowOffset

Ios5 工具栏项不存在';无法在iOS 5中使用UITextAttributeTextShadowOffset,ios5,ios6,uitoolbaritem,Ios5,Ios6,Uitoolbaritem,这是用于工具栏项目的 以下代码在iOS 6模拟器和iOS 6设备上运行良好 在iOS 5模拟器和iOS 5设备中忽略阴影偏移(UITextAttributeTextShadowOffset) [_doneButton setBackgroundImage:[UIImage imageNamed:@"standardButtonImage.png"] forState:UIControlStateNormal

这是用于工具栏项目的

以下代码在iOS 6模拟器和iOS 6设备上运行良好

在iOS 5模拟器和iOS 5设备中忽略阴影偏移(UITextAttributeTextShadowOffset)

 [_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];

有没有人有过同样的经历,或者有人能看出这段代码有什么问题?

试试这个:uitexttributetextshadowoffset:[NSValue-valueWithCGSize:CGSizeMake(1.0,1.0)]