Reputation: 3780
I have a navigation bar that looks like so:
It was created with the following code:
// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSShadow *textShadow = [[NSShadow alloc] init];
textShadow.shadowBlurRadius = 5.0;
textShadow.shadowColor = [UIColor colorWithWhite: 1.0 alpha: 0.75];
textShadow.shadowOffset = CGSizeMake(0.0, 1.0);
[[UIBarButtonItem appearance] setTitleTextAttributes: @{ NSShadowAttributeName: textShadow } forState: UIControlStateNormal];
return YES;
}
Questions
textShadow.shadowBlurRadius = 5.0;
. Cranking up that value doesn't seem to do anything either.This question pertains to iOS 7 only.
Upvotes: 1
Views: 1316
Reputation: 5667
Actually your shadow is getting rendered on UIBarButonItem
& you can see the white shadow in the "Edit" bar button item text. If you want to use better shadow appearance then please try to play with values in CGSizeMake
here within range of -1, 1, 0
textShadow.shadowOffset = CGSizeMake(0.0, -1.0);
A bit tricky, but to add shadow to the right bar button item, please make a UIBarButton
with title on it as +
& assign it to the rightBarButton
of navigation Item & you will get the shadow affect as you see in the left bar button item.
Hopw that helps.
Upvotes: 1