GithubHelp home page GithubHelp logo

ljslidetabview's Introduction

LJSlideTabView

实现顶部 Tab 功能, 支持 tab 特别数量多的情况

demo1 demo1

  • 导入头文件

#import "LJSlideTabView.h"

  • 初始化 SlideTabView
    _slideTabView = [[LJSlideTabView alloc] initWithFrame:CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, 
    [UIScreen mainScreen].bounds.size.height - 64) andTabCount:4]; 
     _slideTabView.dataSource = self;
    [self.view addSubview:_slideTabView];

  • 实现 DataSource (Display View)
#pragma mark - SlideTabView DataSource
-(UIView *)slideTabView:(LJSlideTabView *)slideTabView viewAtTabIndex:(NSInteger)tabIndex{
    if (tabIndex == 0) {
        UIScrollView *scrollView = [UIScrollView new];
        //不需要设置 frame 
        return scrollView;
        
    } else {
        UIView *view = [UIView new];
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 200, 20)];
        label.text = [NSString stringWithFormat:@"page index is :%li",(long)tabIndex];
        [view addSubview:label];
        return view;
    }
}
  • 可以修改的属性
/* 顶部的 TabView 的高度 */
@property(nonatomic, assign)CGFloat tabViewHeight;

/* 顶部的 TabView 里每个 Item 的属性 */
@property(nonatomic, strong)UIColor *tabItemColorDefault;
@property(nonatomic, strong)UIColor *tabItemColorHightlight;
@property(nonatomic, strong)UIFont *tabItemFont;
@property(nonatomic, strong)NSArray *tabItemTitles;

/* tabView 中被选中的的 Item 下放的那个指示器的属性 */
@property(nonatomic, assign)float slideViewScale;
@property(nonatomic, assign)CGFloat slideViewHeight;
@property(nonatomic, strong)UIColor *slideViewColor;
  • 可以实现的 Delegate
@protocol LJSlideTabViewDelegate <NSObject>
@optional
/**
 在第一页向右滑动,常用与响应 pop 事件
 */
-(void)slideTabViewDidRightSlipAtFirstPage;

/**
 在最后一页向左滑动,怎么使用就任由您想象了
 */
-(void)slideTabViewDidLeftSlipAtLastPage;


-(void)slideTabView:(LJSlideTabView *)slideTabView willShowDisplayView:(NSInteger) tabIndex;
-(void)slideTabView:(LJSlideTabView *)slideTabView didShowingDisplayView:(UIView *) displayView;

@end

ljslidetabview's People

Contributors

lij911 avatar

Watchers

 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.