码迷,mamicode.com
首页 > 其他好文 > 详细

第三方库RATreeView的使用记录

时间:2014-07-03 13:34:23      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:ios开发   treeview   

由于项目需要用到树状列表,可以增加成员变量,于是用了第三方RATreeView开元库,头一次使用,安装github上的使用说明和Demo跑了一下,挺满意,增加成员什么的都很简单,和tableview很像是,但是在处理选择的cell时我纠结了一会,用惯了tableview的index:index.row   index.section等,猛然接触到RATreeView处理时,不知道该如何办了,下面记录的我学习过程,

下面先看下,RATreeView是如何管理选择这个动作的,方法如下:

<span style="font-size:18px;">//Managing Selections
- (id)treeView:(RATreeView *)treeView willSelectRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
- (void)treeView:(RATreeView *)treeView didSelectRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
- (id)treeView:(RATreeView *)treeView willDeselectRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;
- (void)treeView:(RATreeView *)treeView didDeselectRowForItem:(id)item treeNodeInfo:(RATreeNodeInfo *)treeNodeInfo;</span>

其实我们有用的信息都存储在treeNodeInfo中,下面我们来分析一下 RATreeNodeInfo

@property (nonatomic, getter = isExpanded, readonly) BOOL expanded;  //判断是否展开
@property (nonatomic, readonly) NSInteger treeDepthLevel;   //树状展开的深度,也就是层次级别


@property (nonatomic, readonly) NSInteger siblingsNumber; 
@property (nonatomic, readonly) NSInteger positionInSiblings;    //在每个层次中,我们选择的单元处于的位置,也就是索引

@property (strong, nonatomic, readonly) RATreeNodeInfo *parent;   //我们选择的cell的上一级信息汇总
@property (strong, nonatomic, readonly) NSArray *children;   //我们选择的cell 的子类包含的成员数组

@property (strong, nonatomic, readonly) id item;  
 
有用的信息我都已经标出来了。

可能到现在你还混乱则呢,什么是树状结构,什么是层次?下面我们来张图分析一下:


bubuko.com,布布扣


第三方库RATreeView的使用记录,布布扣,bubuko.com

第三方库RATreeView的使用记录

标签:ios开发   treeview   

原文地址:http://blog.csdn.net/feixiang_song/article/details/36421939

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!