Skip to content

Instantly share code, notes, and snippets.

@TonnyXu
Created May 10, 2012 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TonnyXu/2652987 to your computer and use it in GitHub Desktop.
Save TonnyXu/2652987 to your computer and use it in GitHub Desktop.
How to set text shadow to the text in UITabBar?
//...
[self.tabBarController.tabBar.items enumerateObjectsUsingBlock:^(UITabBarItem *aTabBarItem, NSUInteger idx, BOOL *stop) {
NSString *selectedImageName = [NSString stringWithFormat:@"tab_icon%d_27x27_selected", idx+1];
NSString *unselectedImageName = [NSString stringWithFormat:@"tab_icon%d_27x27", idx+1];
[aTabBarItem setFinishedSelectedImage:[UIImage imageNamed:selectedImageName]
withFinishedUnselectedImage:[UIImage imageNamed:unselectedImageName]];
[aTabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[[UIColor blackColor] colorWithAlphaComponent:0.5], UITextAttributeTextShadowColor,
[NSValue valueWithCGSize:CGSizeMake(0, -1)], UITextAttributeTextShadowOffset,
nil]
forState:UIControlStateNormal];
}];
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment