[代码分享] RATreeView 旨在提供简单愉快的方式在 iOS 和 tvOS 上使用树视图 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
newkengsir
V2EX    iOS

[代码分享] RATreeView 旨在提供简单愉快的方式在 iOS 和 tvOS 上使用树视图

  •  
  •   newkengsir 2016-11-30 09:57:47 +08:00 3505 次点击
    这是一个创建于 3240 天前的主题,其中的信息可能已经有所发展或是发生改变。

    RATreeView (iOS 7.0+, tvOS 9.0+)

    代码介绍地址:介绍地址

    Introduction

    iOS | tvOS :-------------------------:|:-------------------------: |

    RATreeView 是一个类,旨在提供简单愉快的方式在 iOS 和 tvOS 上使用树视图。 它作为 UITableView 的包装器,定义自己的委托和数据源方法,使得使用树数据结构变得非常容易。

    RATreeView 是高度可定制的,并有很多功能。

    Installation 安装方法

    CocoaPods

    CocoaPods is the recommended way to add RATreeView to your project.

    1. Add additional entry to your Podfile.
    pod "RATreeView", "~> 2.1.1" 
    1. Install Pod(s) running pod install command.
    2. Include RATreeView using #import <RATreeView.h>.

    ###Source files

    1. Downloaded the latest version of the library using link.
    2. Copy content of the downloaded (and unzipped) zip file into your project by dragging it into Project's navigator files structure.

    Requirements 环境需求

    • Xcode 5
    • iOS 7 or newer/tvOS 9 or newer

    Usage 使用方法

    Check out the demo for example usage of library. Make sure you read the RATreeView documentation on Cocoa Docs.

    Basics

    1. Add following import in file of your project when you want to use RATreeView:

      // In case you are using RATreeView with CocoaPods #import <RATreeView.h> 
      // In case you are using RATreeView by simply copying // source files of the RATreeView into your project #import "RATreeView.h" 
    2. Simplest way to initialize and configure RATreeView:

      RATreeView *treeView = [[RATreeView alloc] initWithFrame:self.view.bounds]; treeView.delegate = self; treeView.dataSource = self; [self.view addSubview:treeView]; [treeView reloadData]; 
    3. Implement required methods of the RATreeView's data source:

      - (NSInteger)treeView:(RATreeView *)treeView numberOfChildrenOfItem:(id)item { return item ? 3 : 0; } 
      - (UITableViewCell *)treeView:(RATreeView *)treeView cellForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo { // create and configure cell for *item* return cell } 
      - (id)treeView:(RATreeView *)treeView child:(NSInteger)index ofItem:(id)item { return @(index); } 

    ###Adding Pull to Refresh control

    Adding pull to refresh gesture is really easy using RATreeView and standard UIRefreshControl control.

    UIRefreshControl *refreshCOntrol= [UIRefreshControl new]; [refreshControl addTarget:self action:@selector(refreshControlChanged:) forControlEvents:UIControlEventValueChanged]; [treeView.scrollView addSubview:refreshControl]; 

    Documentation 参考文档

    CocoaPods.

    Author

    RATreeView was created by Rafa Augustyniak. You can find me on twitter (@RaAugustyniak).

    https://github.com/Augustyniak/RATreeView

    目前尚无回复
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3308 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 32ms UTC 11:54 PVG 19:54 LAX 04:54 JFK 07:54
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86