Custom tab bar background image - in iOS 4.x

后端 未结 3 1560
借酒劲吻你
借酒劲吻你 2020-12-19 08:06

I have made a tab bar iOS project, when I received the request to change the tab bar\'s background image to a custom image. The project is developed for iOS 4.x, so the iOS5

相关标签:
3条回答
  • 2020-12-19 08:17

    I have answered similar kind of question here. Hope it will help.

    0 讨论(0)
  • 2020-12-19 08:27

    A possible solution would be to put an UIView with your background image exactly behind the UITabBar. Then lower the opacity of your tabbar to 0.5 so you can see the background-image coming through.

    UIView *bckgrndView = [[UIView alloc] initWithFrame:CGRectMake(tabbar.frame.coords.x, tabbar.frame.coords.y, tabbar.frame.size.width, tabbar.frame.size.height)];
    [bckgrndView setBackgroundImage:[UIImage imageNamed:@"custom.jpg"]];
    [tabbar.superView insertSubView:bckgrndView belowSubview:tabbar];
    tabbar.alpha = 0.5;
    [bckgrndView release];
    

    Sorry if my code contains some errors. I tried doing this by heart... But you'll catch the drift.

    0 讨论(0)
  • 2020-12-19 08:40

    Check out NGTabBarController, an open source tab bar replacement with customizable background image.

    0 讨论(0)
提交回复
热议问题