I have adjusted a UIBarButtonItem to have custom font and color properties using
self.followButton = [[[UIBarButtonItem alloc]
initWithTitle: NSLocalizedString(@"TWITTER_FOLLOW_BUTTON_TEXT", nil)
style:UIBarButtonItemStylePlain
target:self
action:@selector(handleFollowButtonPressed:)]
autorelease];
,
[self.followButton setBackgroundImage:[UIImage new] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
,
[followButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"Helvetica" size:14.0], UITextAttributeFont,nil] forState:UIControlStateNormal];
and
NSDictionary *attributes = @{UITextAttributeTextColor : [UIColor colorWithRed:1 green:0.176 blue:0.333 alpha:1 /*#ff2d55*/ ]};
[followButton setTitleTextAttributes:attributes
forState:UIControlStateNormal];
to get the appearance of
How can I remove the buttonitem's text shadow without resorting to changing it for an image?
Set the UIBarButtonItem's UITextAttributeTextShadowOffset attribute to UIOffsetMake(0.0, 0.0).
You'll need to store the UIOffset in an NSValue object: [NSValue valueWithUIOffset: UIOffsetMake(0.0, 0.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