我的环境,
iOS6
Xcode 4.5.1
我想在选择时更改 UITabBarItem 标题的颜色。
我将 CustomUITabBarItem 用于 UITabBarItem。- 自定义UITabBarItem.m
@implementation customUITabBarItem
@synthesize customHighlightedImage;
-(UIImage *) selectedImage
{
return self.customHighlightedImage;
}
- (void) dealloc
{
[customHighlightedImage release];
customHighlightedImage=nil;
[super dealloc];
}
@end
视图控制器.m
#import "FirstViewController.h"
#import "customUITabBarItem.h"
@interface FirstViewController ()
@end
@implementation FirstViewController
- (void)viewDidLoad
{
[super viewDidLoad];
CustomUITabBarItem *tabItem = [[customUITabBarItem alloc] initWithTitle:@"first" image:[UIImage imageNamed:@"first.png"] tag:0];
tabItem.customHighlightedImage = [UIImage imageNamed:@"first_selected.png"];
self.tabBarItem = tabItem;
[tabItem release];
tabItem = nil;
}
我怎样才能改变颜色?