Objective C: How to add a red color tab to a tab bar controller
I would like to create a center red tab button (like in P开发者_如何转开发interest) as seen in the screenshot below
Any advise on how this can be done?
You can add a custom button on top of the UITabBar.
See http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button/
//in ur view didload
- (void)viewDidLoad {
[super viewDidLoad];
CGRect frame = CGRectMake(0, 0, 480, 49);
UIView *viw = [[UIView alloc] initWithFrame:frame];
UIImage *image = [UIImage imageNamed:@"urRedColorImage.png"];
UIColor *color = [[UIColor alloc] initWithPatternImage:image];
viw.backgroundColor = color;
[color release];
[[self tabBar] insertSubview:viw atIndex:0];
[viw release];
}
精彩评论