Latest0.0.2
Homepagehttps://github.com/CoderDwang/MTMenusDemo
LicenseMIT
Platformsios 8.0
FrameworksUIKit, Foundation
Authors

CocoaPods 
CocoaPods 
License
GitHub stars
GitHub forks

iOS导航菜单

  • 支持pod, pod 'MTMenusView'

  • 使用方法与系统TableView类似

  • 动态可刷新

  • e-mail:[email protected]

  • QQ群:577506623

    QQ群

  • 预览

    预览


    使用方法

    • 声明代理 <MTMenusViewDataSource, MTMenusViewDelegate>
  • 创建视图并设置代理

    self.menus = [[MTMenusView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 140)];
    self.menus.dataSource = self;
    self.menus.delegate = self;
    self.menus.currentPageIndicatorTintColor = [UIColor redColor];
    self.menus.pageIndicatorTintColor = [UIColor blackColor];
    [self.view addSubview:self.menus];
  • 执行代理方法

    #pragma mark - DataSource
    //总共有多少数据
    - (NSInteger)mt_numberOfDisplayInMenusView:(MTMenusView *)menusView {
        return 25;
    }
    
    //分几行
    - (NSInteger)mt_numberOfRowsInMenusView:(MTMenusView *)menusView {
        return 2;
    }
    
    //每行几列
    - (MTMenusViewColumnNumber)mt_numberOfColumnsInMenusView:(MTMenusView *)menusView {
        return MTMenusViewColumnNumberFive;
    }
    
    - (UIButton *)mt_menusView:(MTMenusView *)menusView itemForIndex:(NSInteger)index {
        UIButton *item = [[UIButton alloc] init];
        [item setTitle:[NSString stringWithFormat:@"%ld", index] forState:UIControlStateNormal];
        item.backgroundColor = UIColorRandom;
        return item;
    }
    
    #pragma mark - Delegate
    //点击视图会执行此方法
    - (void)mt_menusView:(MTMenusView *)menusView didSelectIndex:(NSInteger)index {
        NSLog(@"%ld", index);
        self.lab.text = [NSString stringWithFormat:@"您当前点击为第 %ld 个", index];
    }
  • 刷新数据

    [self.menus reloadData];

Latest podspec

{
    "name": "MTMenusView",
    "version": "0.0.2",
    "summary": "u53efu81eau5b9au4e49u7684u5bfcu822au83dcu5355u680f",
    "description": "u5bfcu822au83dcu5355u680fuff0cu4f7fu7528u65b9u5f0fu7c7bu4f3cu4e8etableView",
    "homepage": "https://github.com/CoderDwang/MTMenusDemo",
    "license": "MIT",
    "authors": {
        "Dwang": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/CoderDwang/MTMenusDemo.git",
        "tag": "0.0.2"
    },
    "source_files": [
        "MTMenusView",
        "MTMenusView/**/*.{h,m}"
    ],
    "frameworks": [
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This