Latest 1.0.2
Homepage https://github.com/JpacheGitHub/PBTabBarController
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit, Foundation
Authors

自定义 tabBar。
包含三种样式:

  • 常规 tabBar 样式。
  • 带有圆形自定义按钮样式(类似闲鱼tabBar)。
  • 带有方形自定义按钮样式(类似新浪微博 tabBar)。

初始化方法

- (instancetype)initWithType:(PBTabBarControllerType)type;

UITabBarControllerType 分为三种:

  • PBTabBarControllerDefaultType(常规类型)
  • PBTabBarControllerCircleType(圆形按钮)
  • PBTabBarControllerSquareType(方形按钮)

特殊按钮设置

特殊按钮的点击事件需遵循代理

tabBar.pb_delegate = self;
// 设置特殊按钮未选中图片样式
tabBar.specialItemImage = [UIImage imageNamed:@"jiahao"];
// 设置特殊按钮选中图片样式
tabBar.specialItemSelectedImage = [UIImage imageNamed:@"jiahao"];

若自定义按钮需要关联 VC,可直接在 tabBatItem 初始化时进行设置


PBOneViewController *one = [[PBOneViewController alloc] init];
UINavigationController *oneNav = [[UINavigationController alloc] initWithRootViewController:one];

// 调用 pb_tabBarItem 和 pb_tabBarController 属性时需注意层级关系, 在有 navigationController 时 在 nav 中调用;

oneNav.pb_tabBarItem = [[PBTabBarItem alloc] initWithTitle:nil image:[UIImage imageNamed:@"tabbar_mainframe"] selectedImage:[UIImage imageNamed:@"tabbar_mainframeHL"] type:PBTabBarItemCircleType];

注:
若 tabBarItem 中无特殊按钮样式,则自动在居中的位置补全一个相应类型的item。

Latest podspec

{
    "name": "PBTabBarController",
    "version": "1.0.2",
    "summary": "Supports TabBarController to add custom button",
    "description": "Supports TabBarController to add custom button. Written by Objective-C.",
    "homepage": "https://github.com/JpacheGitHub/PBTabBarController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Jpache": "[email protected]"
    },
    "social_media_url": "http://www.jpache.com",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/JpacheGitHub/PBTabBarController.git",
        "tag": "1.0.2"
    },
    "source_files": [
        "PBTabBarController",
        "PBTabBarController/PBTabBarController/*"
    ],
    "exclude_files": "PBTabBarController/PBTabBarController/Exclude",
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This