I'm trying to change the offset of the shadow behind the text in a UIBarButtonItem
.
This is my code:
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
[attributes setValue:[UIColor colorWithWhite:0.30 alpha:1.0] forKey:UITextAttributeTextColor];
[attributes setValue:[UIColor whiteColor] forKey:UITextAttributeTextShadowColor];
[attributes setValue:[NSValue valueWithUIOffset:UIOffsetMake(0.0, 0.0)] forKey:UITextAttributeTextShadowOffset];
[[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];
Changing the text color works. Changing the shadow color works. Changing the shadow offset doesn't seem to do anything.
Is something wrong with the way I'm doing this? I've also tried setting it directly, without the appearance proxy, but that didn't work either.
I believe your code is correct though perhaps you expect something different from what it does. If I paste it into a test app and change the offset values to 10.0, 10.0 the shadow offset is visible for me. (iOS 5.0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With