Created
May 10, 2012 13:27
-
-
Save TonnyXu/2652987 to your computer and use it in GitHub Desktop.
How to set text shadow to the text in UITabBar?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
[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