开发者

Objective C: How to add a red color tab to a tab bar controller

开发者 https://www.devze.com 2023-03-26 17:33 出处:网络
I would like to create a center red tab button (like in P开发者_如何转开发interest) as seen in the screenshot below

I would like to create a center red tab button (like in P开发者_如何转开发interest) as seen in the screenshot below

Objective C: How to add a red color tab to a tab bar controller

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];

}
0

精彩评论

暂无评论...
验证码 换一张
取 消