UITabbarController

1. 去掉tabbar顶部横线

self.tabBar.barTintColor = [UIColor whiteColor];

self.tabBar.barStyle = UIBarStyleBlack;


2.点击第二个item不跳转

#pragma mark - UITabBarDelegate

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item

{

    NSInteger index = [tabBar.items indexOfObject:item];

    if (index == 1) {

        NSLog(@"做事咯");

    }

}

#pragma mark - UITabbarControllerDelegate

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

{

    NSInteger index = [tabBarController.viewControllers indexOfObject:viewController];

    if (index == 1) {

        return NO;

    }

    return YES;

}


3.改变UITabbarItem的图片的位置

meNav.tabBarItem.imageInsets = UIEdgeInsetsMake(5.0, 0, -5.0, 0);




你可能感兴趣的:(ios)