Coder Social home page Coder Social logo

bitmess / zftabbar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from renzifeng/zftabbar

0.0 1.0 0.0 198 KB

自定义TabBar,可以选中和非选中图片,还可以加badgeValue,双击下拉刷新列表

License: Apache License 2.0

Objective-C 100.00%

zftabbar's Introduction

ZFTabBar

自定义TabBar,可以选中和非选中图片,还可以加badgeValue

效果演示:

image

#用法示例

初始化TabBar

/**
*  初始化所有的子控制器
*/
- (void)setupAllChildViewControllers
{
    // 1.首页
    FirstViewController *home = [[FirstViewController alloc] init];
    home.tabBarItem.badgeValue = @"N";
    [self setupChildViewController:home title:@"首页" imageName:@"shouye" selectedImageName:@"shouye_s"];

    // 2.消息
    SecondViewController *message = [[SecondViewController alloc] init];
    message.tabBarItem.badgeValue = @"8";
    [self setupChildViewController:message title:@"消息" imageName:@"quanzi" selectedImageName:@"quanzi_s"];

    // 3.首页
    FirstViewController *home1 = [[FirstViewController alloc] init];
    home1.tabBarItem.badgeValue = @"19";
    [self setupChildViewController:home1 title:@"发现" imageName:@"shouye" selectedImageName:@"shouye_s"];

    // 4.消息
    SecondViewController *message1 = [[SecondViewController alloc] init];
    message1.tabBarItem.badgeValue = @"99";
    [self setupChildViewController:message1 title:@"广场" imageName:@"quanzi" selectedImageName:@"quanzi_s"];
}

双击tabbar,可刷新当前页面列表,具体看代码

/**
*  监听tabbar按钮的改变
*  @param from   原来选中的位置
*  @param to     最新选中的位置
*/
- (void)tabBar:(ZFTabBar *)tabBar didSelectedButtonFrom:(NSInteger)from to:(NSInteger)to
{
    if (self.selectedIndex == to && to == 0 ) {//双击刷新制定页面的列表
        UINavigationController *nav = self.viewControllers[0];
        FirstViewController *firstVC = nav.viewControllers[0];
        [firstVC refrshUI];
    }
    self.selectedIndex = to;
}

期待

  • 如果在使用过程中遇到BUG,或发现功能不够用,希望你能Issues我
  • 如果觉得好用请Star!
  • 谢谢!

zftabbar's People

Contributors

renzifeng avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.