Latest 1.3
Homepage https://github.com/dexianyinjiu/MenuComponent
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation, UIKit
Authors

License MIT 
CocoaPods 
CocoaPods 

多功能滑动菜单,实现各控制器的滚动展示,支持点击、左右滑动以及分级。

MenuComponent

安装 [CocoaPods]

  1. pod 'MenuComponent', '~> 1.3';
  2. pod install / pod update;
  3. #import <MenuComponent/MenuTabBarController.h>.

使用说明

本组件,包含:MenuTabBarControllerMenuTabBar,两者均可单独使用。其中MenuTabBarController通过使用addChildViewController将各子控制器加在同一父控制器中,通过点击菜单按钮或滑动,实现各子控制器的切换。部分UI可通过以下属性自行设置。

顶部菜单类型:

typedef enum {
    MenuTabBarTypeNormal = 0,   //同级:仅有文字,宽度由文字决定
    MenuTabBarTypeAverage,      //同级:仅有文字,宽度均分
    MenuTabBarTypeArrow,        //分级:可逐级点击
    MenuTabBarTypeImage         //同级:图在上文字在下,宽度均分

} MenuTabBarType;

MenuTabBarController属性:

//代理
@property (nonatomic,assign) id<MenuTabBarControllerDelegate> delegate;
//类型
@property (nonatomic,assign) MenuTabBarType tabBarType;
//子控制器是否可以滑动
@property (nonatomic,assign) BOOL scrollEnabled;
//点击切换是否有滚动动画
@property (nonatomic,assign) BOOL scrollAnimation;
//点击切换文字是否变大
@property (nonatomic,assign) BOOL enlargeEnabled;
//顶部菜单高度
@property (nonatomic,assign) CGFloat tabBarHeight;
//字体
@property (nonatomic,strong) UIFont *font;
//标签颜色
@property (nonatomic,strong) UIColor *indicatorColor;
//被选中标签的颜色
@property (nonatomic,strong) UIColor *currentIndicatorColor;
//标示线颜色
@property (nonatomic,strong) UIColor *indicatorLineColor;
//文字数组
@property (nonatomic,strong) NSArray *titleArray;
//图片名称数组
@property (nonatomic,strong) NSArray *imageNameArray;
//子控制器数组
@property (nonatomic,strong) NSArray *subViewControllers;
//MenuTabBarTypeArrow类型下的arrow图片名称
@property (nonatomic,copy) NSString *arrowImageName;
//当前选择的Index
@property (nonatomic,assign,readonly) NSInteger currentIndex;

//### 外部接口

//更新菜单
- (void)updateData;
//设置父控制器
- (void)setParentController:(UIViewController *)viewController;

具体使用如下:

MenuTabBarController *tabBarController = [[MenuTabBarController alloc] init];
tabBarController.tabBarType = MenuTabBarTypeImage;
tabBarController.delegate = self;
tabBarController.scrollEnabled = NO;
tabBarController.scrollAnimation = NO;
tabBarController.font = [UIFont systemFontOfSize:15.0];
tabBarController.indicatorColor = [UIColor blackColor];
tabBarController.currentIndicatorColor = [UIColor redColor];
tabBarController.indicatorLineColor = [UIColor redColor];
tabBarController.titleArray = @[@"新朋友",@"群聊",@"公众号"];
tabBarController.imageNameArray = @[@"item_0",@"item_1",@"item_2"];
tabBarController.subViewControllers = @[firstVC,seconVC,thirdVC];
[tabBarController setParentController:self];
#pragma mark - MenuTabBarControllerDelegate
- (void)tabBarController:(MenuTabBarController *)tabBarController didSelectAtIndex:(NSInteger)index
{
    NSLog(@"点击Index:%d",index);
}

使用要求

  • iOS 7.0 or later.
  • Xcode 7.0 or later.
  • OS X 10.10 or later.

许可证

MIT

Latest podspec

{
    "name": "MenuComponent",
    "version": "1.3",
    "summary": "A menu component used on iOS.",
    "homepage": "https://github.com/dexianyinjiu/MenuComponent",
    "license": "MIT",
    "authors": {
        "u5f97u95f2u996eu9152": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dexianyinjiu/MenuComponent.git",
        "tag": "1.3"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "MenuComponent/**/*.{h,m}",
    "frameworks": [
        "Foundation",
        "UIKit"
    ]
}

Pin It on Pinterest

Share This