├── CLTreeViewDemo ├── en.lproj │ └── InfoPlist.strings ├── CLTreeViewDemoAppDelegate.h ├── ThreeViewController.h ├── DoubleViewController.h ├── CLTreeViewDemo-Prefix.pch ├── main.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── CLTreeViewDemo-Info.plist ├── CLTreeViewDemoAppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── DoubleViewController.m └── ThreeViewController.m ├── CLTreeViewDemoTests ├── en.lproj │ └── InfoPlist.strings ├── CLTreeViewDemoTests-Info.plist └── CLTreeViewDemoTests.m ├── CLTreeViewGif.gif ├── CLTreeView ├── image │ ├── head1.jpg │ ├── head2.jpg │ ├── head3.jpg │ ├── head4.jpg │ ├── head5.jpg │ ├── head6.jpg │ ├── head7.jpg │ ├── head8.jpg │ ├── the_arrow.png │ ├── contacts_major@2x.png │ └── contacts_collect@2x.png ├── CLTreeViewNode.m ├── CLTreeView_LEVEL0_Model.m ├── CLTreeView_LEVEL1_Model.m ├── CLTreeView_LEVEL2_Model.m ├── CLTreeViewController.h ├── CLTreeView_LEVEL1_Model.h ├── CLTreeView_LEVEL0_Model.h ├── CLTreeViewNode.h ├── CLTreeView_LEVEL2_Model.h ├── CLTree.h ├── CLTreeView_LEVEL2_Cell.h ├── CLTreeView_LEVEL0_Cell.h ├── CLTreeView_LEVEL1_Cell.h ├── CLTreeView_LEVEL0_Cell.m ├── CLTreeView_LEVEL1_Cell.m ├── CLTreeView_LEVEL2_Cell.m ├── Level0_Cell.xib ├── Level2_Cell.xib ├── Level1_Cell.xib └── CLTreeViewController.m ├── CLTreeViewDemo.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── zhongyou.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ └── zhongyou.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── CLTreeViewDemo.xcscheme └── project.pbxproj └── README.md /CLTreeViewDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CLTreeViewDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CLTreeViewGif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeViewGif.gif -------------------------------------------------------------------------------- /CLTreeView/image/head1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head1.jpg -------------------------------------------------------------------------------- /CLTreeView/image/head2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head2.jpg -------------------------------------------------------------------------------- /CLTreeView/image/head3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head3.jpg -------------------------------------------------------------------------------- /CLTreeView/image/head4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head4.jpg -------------------------------------------------------------------------------- /CLTreeView/image/head5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head5.jpg -------------------------------------------------------------------------------- /CLTreeView/image/head6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head6.jpg -------------------------------------------------------------------------------- /CLTreeView/image/head7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head7.jpg -------------------------------------------------------------------------------- /CLTreeView/image/head8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/head8.jpg -------------------------------------------------------------------------------- /CLTreeView/image/the_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/the_arrow.png -------------------------------------------------------------------------------- /CLTreeView/image/contacts_major@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/contacts_major@2x.png -------------------------------------------------------------------------------- /CLTreeView/image/contacts_collect@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeView/image/contacts_collect@2x.png -------------------------------------------------------------------------------- /CLTreeViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CLTreeViewDemo.xcodeproj/project.xcworkspace/xcuserdata/zhongyou.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flywarrior/CLTreeView-IOS-ContactsList/HEAD/CLTreeViewDemo.xcodeproj/project.xcworkspace/xcuserdata/zhongyou.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CLTreeView/CLTreeViewNode.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeViewNode.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeViewNode.h" 10 | 11 | @implementation CLTreeViewNode 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL0_Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL0_Model.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeView_LEVEL0_Model.h" 10 | 11 | @implementation CLTreeView_LEVEL0_Model 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL1_Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL1_Model.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeView_LEVEL1_Model.h" 10 | 11 | @implementation CLTreeView_LEVEL1_Model 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL2_Model.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL2_Model.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeView_LEVEL2_Model.h" 10 | 11 | @implementation CLTreeView_LEVEL2_Model 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CLTreeViewDemo/CLTreeViewDemoAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeViewDemoAppDelegate.h 3 | // CLTreeViewDemo 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CLTreeViewDemoAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CLTreeViewDemo/ThreeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeViewController.h 3 | // CLTreeViewDemo 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ThreeViewController : UIViewController 12 | 13 | @property (strong,nonatomic) UITableView* myTableView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeViewController.h 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-7. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface CLTreeViewController : UIViewController 13 | 14 | @property (strong,nonatomic) UITableView* myTableView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL1_Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL1_Model.h 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CLTreeView_LEVEL1_Model : NSObject 12 | 13 | @property (strong,nonatomic) NSString *name; 14 | @property (strong,nonatomic) NSString *sonCnt; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CLTreeViewDemo/DoubleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DoubleViewController.h 3 | // CLTreeViewDemo 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DoubleViewController : UIViewController 12 | 13 | @property (strong,nonatomic) UITableView* myTableView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CLTreeViewDemo/CLTreeViewDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /CLTreeViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CLTreeViewDemo 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CLTreeViewDemoAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CLTreeViewDemoAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CLTreeViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL0_Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL0_Model.h 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CLTreeView_LEVEL0_Model : NSObject 12 | 13 | @property (strong,nonatomic) NSString *name; 14 | @property (strong,nonatomic) NSString *headImgPath;//本地图片名,若不为空则优先于远程图片加载 15 | @property (strong,nonatomic) NSURL *headImgUrl;//远程图片链接 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CLTreeView-IOS-ContactsList 2 | =========================== 3 | 4 | CLTreeView是一个多级的联系人列表,它可以做出和QQ2014的二级联系人列表相似的二级列表,也可以做出美观的三级联系人列表。如果你愿意,它也可以做出二级和三级混合的联系人列表。下面是Demo的演示: 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ![image](https://github.com/flywarrior/CLTreeView-IOS-ContactsList/blob/master/CLTreeViewGif.gif) 46 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeViewNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeViewNode.h 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CLTreeViewNode : NSObject 12 | 13 | @property (nonatomic) int nodeLevel; //节点所处层次 14 | @property (nonatomic) int type; //节点类型 15 | @property (nonatomic) id nodeData;//节点数据 16 | @property (nonatomic) BOOL isExpanded;//节点是否展开 17 | @property (strong,nonatomic) NSMutableArray *sonNodes;//子节点 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL2_Model.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL2_Model.h 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CLTreeView_LEVEL2_Model : NSObject 12 | 13 | @property (strong,nonatomic) NSString *name; 14 | @property (strong,nonatomic) NSString *signture; 15 | @property (strong,nonatomic) NSString *headImgPath;//本地图片名,若不为空则优先于远程图片加载 16 | @property (strong,nonatomic) NSURL *headImgUrl;//远程图片链接 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CLTreeView/CLTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTree.h 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeView_LEVEL0_Cell.h" 10 | #import "CLTreeView_LEVEL1_Cell.h" 11 | #import "CLTreeView_LEVEL2_Cell.h" 12 | #import "CLTreeView_LEVEL0_Model.h" 13 | #import "CLTreeView_LEVEL1_Model.h" 14 | #import "CLTreeView_LEVEL2_Model.h" 15 | 16 | #define M_PI 3.14159265358979323846264338327950288 /* pi */ 17 | #define M_PI_2 1.57079632679489661923132169163975144 /* pi/2 */ 18 | 19 | -------------------------------------------------------------------------------- /CLTreeViewDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL2_Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL2_Cell.h 3 | // 这个cell一般作为叶子节点来处理 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CLTreeViewNode.h" 11 | 12 | @interface CLTreeView_LEVEL2_Cell : UITableViewCell 13 | 14 | @property (retain,strong,nonatomic) CLTreeViewNode *node;//data 15 | @property (strong,nonatomic) IBOutlet UIImageView *headImg; 16 | @property (strong,nonatomic) IBOutlet UILabel *signture;//个性签名 17 | @property (strong,nonatomic) IBOutlet UILabel *name; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL0_Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL0_Cell.h 3 | // 这个cell可以作为树形列表的根节点或者第二层节点 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CLTreeViewNode.h" 11 | 12 | @interface CLTreeView_LEVEL0_Cell : UITableViewCell 13 | 14 | @property (retain,strong,nonatomic) CLTreeViewNode *node; //data 15 | @property (strong,nonatomic) IBOutlet UIImageView *imgView; 16 | @property (strong,nonatomic) IBOutlet UIImageView *arrowView; //箭头 17 | @property (strong,nonatomic) IBOutlet UILabel *name; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL1_Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL1_Cell.h 3 | // 这个cell可以作为树形列表的根节点或者第二层节点 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CLTreeViewNode.h" 11 | 12 | @interface CLTreeView_LEVEL1_Cell : UITableViewCell 13 | 14 | @property (retain,strong,nonatomic) CLTreeViewNode *node;//data 15 | @property (strong,nonatomic) IBOutlet UIImageView *arrowView;//箭头 16 | @property (strong,nonatomic) IBOutlet UILabel *sonCount;//叶子数 17 | @property (strong,nonatomic) IBOutlet UILabel *name; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CLTreeViewDemo.xcodeproj/xcuserdata/zhongyou.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CLTreeViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 343592D319BE92A9006762FC 16 | 17 | primary 18 | 19 | 20 | 343592F419BE92A9006762FC 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CLTreeViewDemoTests/CLTreeViewDemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | zhongyou.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CLTreeViewDemoTests/CLTreeViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeViewDemoTests.m 3 | // CLTreeViewDemoTests 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CLTreeViewDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CLTreeViewDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL0_Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL0_Cell.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeView_LEVEL0_Cell.h" 10 | 11 | @implementation CLTreeView_LEVEL0_Cell 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | - (void)drawRect:(CGRect)rect 30 | { 31 | int addX = _node.nodeLevel*25; //根据节点所在的层次计算平移距离 32 | CGRect imgFrame = _imgView.frame; 33 | imgFrame.origin.x = 14 + addX; 34 | _imgView.frame = imgFrame; 35 | 36 | CGRect nameFrame = _name.frame; 37 | nameFrame.origin.x = 62 + addX; 38 | _name.frame = nameFrame; 39 | } 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL1_Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL1_Cell.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeView_LEVEL1_Cell.h" 10 | 11 | @implementation CLTreeView_LEVEL1_Cell 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | //重新描绘cell 29 | - (void)drawRect:(CGRect)rect 30 | { 31 | int addX = _node.nodeLevel*25; //根据节点所在的层次计算平移距离 32 | CGRect imgFrame = _arrowView.frame; 33 | imgFrame.origin.x = 14 + addX; 34 | _arrowView.frame = imgFrame; 35 | 36 | CGRect nameFrame = _name.frame; 37 | nameFrame.origin.x = 40 + addX; 38 | _name.frame = nameFrame; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeView_LEVEL2_Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeView_LEVEL2_Cell.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeView_LEVEL2_Cell.h" 10 | 11 | @implementation CLTreeView_LEVEL2_Cell 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | - (void)drawRect:(CGRect)rect 30 | { 31 | int addX = _node.nodeLevel-1; 32 | addX = (addX<0?1:addX)*25; //根据节点所在的层次计算平移距离 33 | CGRect imgFrame = _headImg.frame; 34 | imgFrame.origin.x = 14 + addX; 35 | _headImg.frame = imgFrame; 36 | 37 | CGRect nameFrame = _name.frame; 38 | nameFrame.origin.x = 62 + addX; 39 | _name.frame = nameFrame; 40 | 41 | CGRect signtureFrame = _signture.frame; 42 | signtureFrame.origin.x = 62 + addX; 43 | _signture.frame = signtureFrame; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CLTreeViewDemo/CLTreeViewDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | zhongyou.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CLTreeViewDemo/CLTreeViewDemoAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeViewDemoAppDelegate.m 3 | // CLTreeViewDemo 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeViewDemoAppDelegate.h" 10 | 11 | @implementation CLTreeViewDemoAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CLTreeView/Level0_Cell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /CLTreeView/Level2_Cell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /CLTreeView/Level1_Cell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CLTreeViewDemo.xcodeproj/xcuserdata/zhongyou.xcuserdatad/xcschemes/CLTreeViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CLTreeViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /CLTreeView/CLTreeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLTreeViewViewController.m 3 | // CLTreeView 4 | // 5 | // Created by 钟由 on 14-9-7. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "CLTreeViewController.h" 10 | #import "CLTree.h" 11 | 12 | @interface CLTreeViewController () 13 | 14 | @property(strong,nonatomic) NSMutableArray* dataArray; //保存全部数据的数组 15 | @property(strong,nonatomic) NSArray *displayArray; //保存要显示在界面上的数据的数组 16 | 17 | @end 18 | 19 | @implementation CLTreeViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | _myTableView = [[UITableView alloc]init]; 25 | _myTableView.dataSource = self; 26 | _myTableView.delegate = self; 27 | CGRect tableViewFrame = CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height); 28 | _myTableView.frame = tableViewFrame; 29 | [self.view addSubview:_myTableView]; 30 | [self addTestData]; 31 | [self reloadDataForDisplayArray];//初始化将要显示的数据 32 | } 33 | 34 | //添加演示数据 35 | -(void) addTestData{ 36 | CLTreeViewNode *node0 = [[CLTreeViewNode alloc]init]; 37 | node0.nodeLevel = 0; 38 | node0.type = 0; 39 | node0.sonNodes = nil; 40 | node0.isExpanded = FALSE; 41 | CLTreeView_LEVEL0_Model *tmp0 =[[CLTreeView_LEVEL0_Model alloc]init]; 42 | tmp0.name = @"收藏"; 43 | tmp0.headImgPath = @"contacts_collect.png"; 44 | tmp0.headImgUrl = nil; 45 | node0.nodeData = tmp0; 46 | 47 | CLTreeViewNode *node1 = [[CLTreeViewNode alloc]init]; 48 | node1.nodeLevel = 0; 49 | node1.type = 0; 50 | node1.sonNodes = nil; 51 | node1.isExpanded = FALSE; 52 | CLTreeView_LEVEL0_Model *tmp1 =[[CLTreeView_LEVEL0_Model alloc]init]; 53 | tmp1.name = @"软件技术"; 54 | tmp1.headImgPath = @"contacts_major.png"; 55 | tmp1.headImgUrl = nil; 56 | node1.nodeData = tmp1; 57 | 58 | CLTreeViewNode *node2 = [[CLTreeViewNode alloc]init]; 59 | node2.nodeLevel = 0; 60 | node2.type = 0; 61 | node2.sonNodes = nil; 62 | node2.isExpanded = FALSE; 63 | CLTreeView_LEVEL0_Model *tmp2 =[[CLTreeView_LEVEL0_Model alloc]init]; 64 | tmp2.name = @"信息工程"; 65 | tmp2.headImgPath = @"contacts_major.png"; 66 | tmp2.headImgUrl = nil; 67 | node2.nodeData = tmp2; 68 | 69 | CLTreeViewNode *node3 = [[CLTreeViewNode alloc]init]; 70 | node3.nodeLevel = 1; 71 | node3.type = 1; 72 | node3.sonNodes = nil; 73 | node3.isExpanded = FALSE; 74 | CLTreeView_LEVEL1_Model *tmp3 =[[CLTreeView_LEVEL1_Model alloc]init]; 75 | tmp3.name = @"软件技术1班"; 76 | tmp3.sonCnt = @"1"; 77 | node3.nodeData = tmp3; 78 | 79 | CLTreeViewNode *node4 = [[CLTreeViewNode alloc]init]; 80 | node4.nodeLevel = 1; 81 | node4.type = 1; 82 | node4.sonNodes = nil; 83 | node4.isExpanded = FALSE; 84 | CLTreeView_LEVEL1_Model *tmp4 =[[CLTreeView_LEVEL1_Model alloc]init]; 85 | tmp4.name = @"软件技术2班"; 86 | tmp4.sonCnt = @"1"; 87 | node4.nodeData = tmp4; 88 | 89 | CLTreeViewNode *node5 = [[CLTreeViewNode alloc]init]; 90 | node5.nodeLevel = 2; 91 | node5.type = 2; 92 | node5.sonNodes = nil; 93 | node5.isExpanded = FALSE; 94 | CLTreeView_LEVEL2_Model *tmp5 =[[CLTreeView_LEVEL2_Model alloc]init]; 95 | tmp5.name = @"flywarrior"; 96 | tmp5.signture = @"老是失眠怎么办啊"; 97 | tmp5.headImgPath = @"head1.jpg"; 98 | tmp5.headImgUrl = nil; 99 | node5.nodeData = tmp5; 100 | 101 | CLTreeViewNode *node6 = [[CLTreeViewNode alloc]init]; 102 | node6.nodeLevel = 2; 103 | node6.type = 2; 104 | node6.sonNodes = nil; 105 | node6.isExpanded = FALSE; 106 | CLTreeView_LEVEL2_Model *tmp6 =[[CLTreeView_LEVEL2_Model alloc]init]; 107 | tmp6.name = @"flywarrior2"; 108 | tmp6.signture = @"用头用力撞下键盘就好了。"; 109 | tmp6.headImgPath = @"head2.jpg"; 110 | tmp6.headImgUrl = nil; 111 | node6.nodeData = tmp6; 112 | 113 | node1.sonNodes = [NSMutableArray arrayWithObjects:node3,node4,nil]; 114 | node3.sonNodes = [NSMutableArray arrayWithObjects:node5,nil]; 115 | node4.sonNodes = [NSMutableArray arrayWithObjects:node6,nil]; 116 | _dataArray = [NSMutableArray arrayWithObjects:node0,node1,node2, nil]; 117 | } 118 | 119 | - (void)didReceiveMemoryWarning 120 | { 121 | [super didReceiveMemoryWarning]; 122 | // Dispose of any resources that can be recreated. 123 | } 124 | 125 | -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{ 126 | return 1; 127 | } 128 | 129 | -(NSInteger) tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{ 130 | return _displayArray.count; 131 | } 132 | 133 | -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 134 | static NSString *indentifier = @"level0cell"; 135 | static NSString *indentifier1 = @"level1cell"; 136 | static NSString *indentifier2 = @"level2cell"; 137 | CLTreeViewNode *node = [_displayArray objectAtIndex:indexPath.row]; 138 | 139 | if(node.type == 0){//类型为0的cell 140 | CLTreeView_LEVEL0_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier]; 141 | if(cell == nil){ 142 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level0_Cell" owner:self options:nil] lastObject]; 143 | } 144 | cell.node = node; 145 | [self loadDataForTreeViewCell:cell with:node];//重新给cell装载数据 146 | [cell setNeedsDisplay]; //重新描绘cell 147 | return cell; 148 | } 149 | else if(node.type == 1){//类型为1的cell 150 | CLTreeView_LEVEL1_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier1]; 151 | if(cell == nil){ 152 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level1_Cell" owner:self options:nil] lastObject]; 153 | } 154 | cell.node = node; 155 | [self loadDataForTreeViewCell:cell with:node]; 156 | [cell setNeedsDisplay]; 157 | return cell; 158 | } 159 | else{//类型为2的cell 160 | CLTreeView_LEVEL2_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier2]; 161 | if(cell == nil){ 162 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level2_Cell" owner:self options:nil] lastObject]; 163 | } 164 | cell.node = node; 165 | [self loadDataForTreeViewCell:cell with:node]; 166 | [cell setNeedsDisplay]; 167 | return cell; 168 | } 169 | } 170 | 171 | /*--------------------------------------- 172 | 为不同类型cell填充数据 173 | --------------------------------------- */ 174 | -(void) loadDataForTreeViewCell:(UITableViewCell*)cell with:(CLTreeViewNode*)node{ 175 | if(node.type == 0){ 176 | CLTreeView_LEVEL0_Model *nodeData = node.nodeData; 177 | ((CLTreeView_LEVEL0_Cell*)cell).name.text = nodeData.name; 178 | if(nodeData.headImgPath != nil){ 179 | //本地图片 180 | [((CLTreeView_LEVEL0_Cell*)cell).imageView setImage:[UIImage imageNamed:nodeData.headImgPath]]; 181 | } 182 | else if (nodeData.headImgUrl != nil){ 183 | //加载图片,这里是同步操作。建议使用SDWebImage异步加载图片 184 | [((CLTreeView_LEVEL0_Cell*)cell).imageView setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:nodeData.headImgUrl]]]; 185 | } 186 | } 187 | 188 | else if(node.type == 1){ 189 | CLTreeView_LEVEL1_Model *nodeData = node.nodeData; 190 | ((CLTreeView_LEVEL1_Cell*)cell).name.text = nodeData.name; 191 | ((CLTreeView_LEVEL1_Cell*)cell).sonCount.text = nodeData.sonCnt; 192 | } 193 | 194 | else{ 195 | CLTreeView_LEVEL2_Model *nodeData = node.nodeData; 196 | ((CLTreeView_LEVEL2_Cell*)cell).name.text = nodeData.name; 197 | ((CLTreeView_LEVEL2_Cell*)cell).signture.text = nodeData.signture; 198 | if(nodeData.headImgPath != nil){ 199 | //本地图片 200 | [((CLTreeView_LEVEL2_Cell*)cell).headImg setImage:[UIImage imageNamed:nodeData.headImgPath]]; 201 | } 202 | else if (nodeData.headImgUrl != nil){ 203 | //加载图片,这里是同步操作。建议使用SDWebImage异步加载图片 204 | [((CLTreeView_LEVEL2_Cell*)cell).headImg setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:nodeData.headImgUrl]]]; 205 | } 206 | } 207 | } 208 | 209 | /*--------------------------------------- 210 | cell高度默认为50 211 | --------------------------------------- */ 212 | -(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath 213 | { 214 | return 50; 215 | } 216 | 217 | /*--------------------------------------- 218 | 处理cell选中事件,需要自定义的部分 219 | --------------------------------------- */ 220 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 221 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 222 | CLTreeViewNode *node = [_displayArray objectAtIndex:indexPath.row]; 223 | [self reloadDataForDisplayArrayChangeAt:indexPath.row];//修改cell的状态(关闭或打开) 224 | if(node.type == 2){ 225 | //处理叶子节点选中,此处需要自定义 226 | } 227 | else{ 228 | CLTreeView_LEVEL0_Cell *cell = (CLTreeView_LEVEL0_Cell*)[tableView cellForRowAtIndexPath:indexPath]; 229 | if(cell.node.isExpanded ){ 230 | [self rotateArrow:cell with:M_PI_2]; 231 | } 232 | else{ 233 | [self rotateArrow:cell with:0]; 234 | } 235 | } 236 | } 237 | 238 | /*--------------------------------------- 239 | 旋转箭头图标 240 | --------------------------------------- */ 241 | -(void) rotateArrow:(CLTreeView_LEVEL0_Cell*) cell with:(double)degree{ 242 | [UIView animateWithDuration:0.35 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ 243 | cell.arrowView.layer.transform = CATransform3DMakeRotation(degree, 0, 0, 1); 244 | } completion:NULL]; 245 | } 246 | 247 | /*--------------------------------------- 248 | 初始化将要显示的cell的数据 249 | --------------------------------------- */ 250 | -(void) reloadDataForDisplayArray{ 251 | NSMutableArray *tmp = [[NSMutableArray alloc]init]; 252 | for (CLTreeViewNode *node in _dataArray) { 253 | [tmp addObject:node]; 254 | if(node.isExpanded){ 255 | for(CLTreeViewNode *node2 in node.sonNodes){ 256 | [tmp addObject:node2]; 257 | if(node2.isExpanded){ 258 | for(CLTreeViewNode *node3 in node2.sonNodes){ 259 | [tmp addObject:node3]; 260 | } 261 | } 262 | } 263 | } 264 | } 265 | _displayArray = [NSArray arrayWithArray:tmp]; 266 | [self.myTableView reloadData]; 267 | } 268 | 269 | /*--------------------------------------- 270 | 修改cell的状态(关闭或打开) 271 | --------------------------------------- */ 272 | -(void) reloadDataForDisplayArrayChangeAt:(NSInteger)row{ 273 | NSMutableArray *tmp = [[NSMutableArray alloc]init]; 274 | NSInteger cnt=0; 275 | for (CLTreeViewNode *node in _dataArray) { 276 | [tmp addObject:node]; 277 | if(cnt == row){ 278 | node.isExpanded = !node.isExpanded; 279 | } 280 | ++cnt; 281 | if(node.isExpanded){ 282 | for(CLTreeViewNode *node2 in node.sonNodes){ 283 | [tmp addObject:node2]; 284 | if(cnt == row){ 285 | node2.isExpanded = !node2.isExpanded; 286 | } 287 | ++cnt; 288 | if(node2.isExpanded){ 289 | for(CLTreeViewNode *node3 in node2.sonNodes){ 290 | [tmp addObject:node3]; 291 | ++cnt; 292 | } 293 | } 294 | } 295 | } 296 | } 297 | _displayArray = [NSArray arrayWithArray:tmp]; 298 | [self.myTableView reloadData]; 299 | } 300 | @end 301 | -------------------------------------------------------------------------------- /CLTreeViewDemo/DoubleViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DoubleViewController.m 3 | // CLTreeViewDemo 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "DoubleViewController.h" 10 | #import "CLTree.h" 11 | 12 | @interface DoubleViewController () 13 | 14 | @property(strong,nonatomic) NSMutableArray* dataArray; //保存全部数据的数组 15 | @property(strong,nonatomic) NSArray *displayArray; //保存要显示在界面上的数据的数组 16 | 17 | @end 18 | 19 | @implementation DoubleViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | _myTableView = [[UITableView alloc]init]; 25 | _myTableView.dataSource = self; 26 | _myTableView.delegate = self; 27 | CGRect tableViewFrame = CGRectMake(0, 25, self.view.frame.size.width, self.view.frame.size.height); 28 | _myTableView.frame = tableViewFrame; 29 | [self.view addSubview:_myTableView]; 30 | [self addTestData];//添加演示数据 31 | [self reloadDataForDisplayArray];//初始化将要显示的数据 32 | } 33 | 34 | //添加演示数据 35 | -(void) addTestData{ 36 | CLTreeViewNode *node3 = [[CLTreeViewNode alloc]init]; 37 | node3.nodeLevel = 0;//根层cell 38 | node3.type = 1;//type 1的cell 39 | node3.sonNodes = nil; 40 | node3.isExpanded = FALSE;//关闭状态 41 | CLTreeView_LEVEL1_Model *tmp3 =[[CLTreeView_LEVEL1_Model alloc]init]; 42 | tmp3.name = @"ios开发部门"; 43 | tmp3.sonCnt = @"4"; 44 | node3.nodeData = tmp3; 45 | 46 | CLTreeViewNode *node4 = [[CLTreeViewNode alloc]init]; 47 | node4.nodeLevel = 0; 48 | node4.type = 1; 49 | node4.sonNodes = nil; 50 | node4.isExpanded = FALSE; 51 | CLTreeView_LEVEL1_Model *tmp4 =[[CLTreeView_LEVEL1_Model alloc]init]; 52 | tmp4.name = @"安卓开发部门"; 53 | tmp4.sonCnt = @"2"; 54 | node4.nodeData = tmp4; 55 | 56 | CLTreeViewNode *node5 = [[CLTreeViewNode alloc]init]; 57 | node5.nodeLevel = 1;//第一层节点 58 | node5.type = 2;//type 2的cell 59 | node5.sonNodes = nil; 60 | node5.isExpanded = FALSE; 61 | CLTreeView_LEVEL2_Model *tmp5 =[[CLTreeView_LEVEL2_Model alloc]init]; 62 | tmp5.name = @"flywarrior"; 63 | tmp5.signture = @"老是失眠怎么办啊"; 64 | tmp5.headImgPath = @"head1.jpg"; 65 | tmp5.headImgUrl = nil; 66 | node5.nodeData = tmp5; 67 | 68 | CLTreeViewNode *node6 = [[CLTreeViewNode alloc]init]; 69 | node6.nodeLevel = 1; 70 | node6.type = 2; 71 | node6.sonNodes = nil; 72 | node6.isExpanded = FALSE; 73 | CLTreeView_LEVEL2_Model *tmp6 =[[CLTreeView_LEVEL2_Model alloc]init]; 74 | tmp6.name = @"张三"; 75 | tmp6.signture = @"把头用力撞向键盘就能治好了。。"; 76 | tmp6.headImgPath = @"head2.jpg"; 77 | tmp6.headImgUrl = nil; 78 | node6.nodeData = tmp6; 79 | 80 | CLTreeViewNode *node7 = [[CLTreeViewNode alloc]init]; 81 | node7.nodeLevel = 1; 82 | node7.type = 2; 83 | node7.sonNodes = nil; 84 | node7.isExpanded = FALSE; 85 | CLTreeView_LEVEL2_Model *tmp7 =[[CLTreeView_LEVEL2_Model alloc]init]; 86 | tmp7.name = @"李四"; 87 | tmp7.signture = @"说的好有道理,我竟无言以对。"; 88 | tmp7.headImgPath = @"head3.jpg"; 89 | tmp7.headImgUrl = nil; 90 | node7.nodeData = tmp7; 91 | 92 | CLTreeViewNode *node8 = [[CLTreeViewNode alloc]init]; 93 | node8.nodeLevel = 1; 94 | node8.type = 2; 95 | node8.sonNodes = nil; 96 | node8.isExpanded = FALSE; 97 | CLTreeView_LEVEL2_Model *tmp8 =[[CLTreeView_LEVEL2_Model alloc]init]; 98 | tmp8.name = @"田七"; 99 | tmp8.signture = @"肚子好饿啊。。。"; 100 | tmp8.headImgPath = @"head4.jpg"; 101 | tmp8.headImgUrl = nil; 102 | node8.nodeData = tmp8; 103 | 104 | CLTreeViewNode *node9 = [[CLTreeViewNode alloc]init]; 105 | node9.nodeLevel = 1; 106 | node9.type = 2; 107 | node9.sonNodes = nil; 108 | node9.isExpanded = FALSE; 109 | CLTreeView_LEVEL2_Model *tmp9 =[[CLTreeView_LEVEL2_Model alloc]init]; 110 | tmp9.name = @"王大锤"; 111 | tmp9.signture = @"走向人生巅峰!"; 112 | tmp9.headImgPath = @"head5.jpg"; 113 | tmp9.headImgUrl = nil; 114 | node9.nodeData = tmp9; 115 | 116 | CLTreeViewNode *node0 = [[CLTreeViewNode alloc]init]; 117 | node0.nodeLevel = 1; 118 | node0.type = 2; 119 | node0.sonNodes = nil; 120 | node0.isExpanded = FALSE; 121 | CLTreeView_LEVEL2_Model *tmp0 =[[CLTreeView_LEVEL2_Model alloc]init]; 122 | tmp0.name = @"孔连顺"; 123 | tmp0.signture = @"锤锤。。。"; 124 | tmp0.headImgPath = @"head6.jpg"; 125 | tmp0.headImgUrl = nil; 126 | node0.nodeData = tmp0; 127 | 128 | node3.sonNodes = [NSMutableArray arrayWithObjects:node5,node6,node7,node8,nil];//插入子节点 129 | node4.sonNodes = [NSMutableArray arrayWithObjects:node9,node0,nil]; 130 | _dataArray = [NSMutableArray arrayWithObjects:node3,node4, nil];//插入到元数据数组 131 | } 132 | 133 | - (void)didReceiveMemoryWarning 134 | { 135 | [super didReceiveMemoryWarning]; 136 | // Dispose of any resources that can be recreated. 137 | } 138 | 139 | -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{ 140 | return 1; 141 | } 142 | 143 | -(NSInteger) tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{ 144 | return _displayArray.count; 145 | } 146 | 147 | -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 148 | static NSString *indentifier = @"level0cell"; 149 | static NSString *indentifier1 = @"level1cell"; 150 | static NSString *indentifier2 = @"level2cell"; 151 | CLTreeViewNode *node = [_displayArray objectAtIndex:indexPath.row]; 152 | 153 | if(node.type == 0){//类型为0的cell 154 | CLTreeView_LEVEL0_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier]; 155 | if(cell == nil){ 156 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level0_Cell" owner:self options:nil] lastObject]; 157 | } 158 | cell.node = node; 159 | [self loadDataForTreeViewCell:cell with:node];//重新给cell装载数据 160 | [cell setNeedsDisplay]; //重新描绘cell 161 | return cell; 162 | } 163 | else if(node.type == 1){//类型为1的cell 164 | CLTreeView_LEVEL1_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier1]; 165 | if(cell == nil){ 166 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level1_Cell" owner:self options:nil] lastObject]; 167 | } 168 | cell.node = node; 169 | [self loadDataForTreeViewCell:cell with:node]; 170 | [cell setNeedsDisplay]; 171 | return cell; 172 | } 173 | else{//类型为2的cell 174 | CLTreeView_LEVEL2_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier2]; 175 | if(cell == nil){ 176 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level2_Cell" owner:self options:nil] lastObject]; 177 | } 178 | cell.node = node; 179 | [self loadDataForTreeViewCell:cell with:node]; 180 | [cell setNeedsDisplay]; 181 | return cell; 182 | } 183 | } 184 | 185 | /*--------------------------------------- 186 | 为不同类型cell填充数据 187 | --------------------------------------- */ 188 | -(void) loadDataForTreeViewCell:(UITableViewCell*)cell with:(CLTreeViewNode*)node{ 189 | if(node.type == 0){ 190 | CLTreeView_LEVEL0_Model *nodeData = node.nodeData; 191 | ((CLTreeView_LEVEL0_Cell*)cell).name.text = nodeData.name; 192 | if(nodeData.headImgPath != nil){ 193 | //本地图片 194 | [((CLTreeView_LEVEL0_Cell*)cell).imageView setImage:[UIImage imageNamed:nodeData.headImgPath]]; 195 | } 196 | else if (nodeData.headImgUrl != nil){ 197 | //加载图片,这里是同步操作。建议使用SDWebImage异步加载图片 198 | [((CLTreeView_LEVEL0_Cell*)cell).imageView setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:nodeData.headImgUrl]]]; 199 | } 200 | } 201 | 202 | else if(node.type == 1){ 203 | CLTreeView_LEVEL1_Model *nodeData = node.nodeData; 204 | ((CLTreeView_LEVEL1_Cell*)cell).name.text = nodeData.name; 205 | ((CLTreeView_LEVEL1_Cell*)cell).sonCount.text = nodeData.sonCnt; 206 | } 207 | 208 | else{ 209 | CLTreeView_LEVEL2_Model *nodeData = node.nodeData; 210 | ((CLTreeView_LEVEL2_Cell*)cell).name.text = nodeData.name; 211 | ((CLTreeView_LEVEL2_Cell*)cell).signture.text = nodeData.signture; 212 | if(nodeData.headImgPath != nil){ 213 | //本地图片 214 | [((CLTreeView_LEVEL2_Cell*)cell).headImg setImage:[UIImage imageNamed:nodeData.headImgPath]]; 215 | } 216 | else if (nodeData.headImgUrl != nil){ 217 | //加载图片,这里是同步操作。建议使用SDWebImage异步加载图片 218 | [((CLTreeView_LEVEL2_Cell*)cell).headImg setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:nodeData.headImgUrl]]]; 219 | } 220 | } 221 | } 222 | 223 | /*--------------------------------------- 224 | cell高度默认为50 225 | --------------------------------------- */ 226 | -(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath 227 | { 228 | return 50; 229 | } 230 | 231 | /*--------------------------------------- 232 | 处理cell选中事件,需要自定义的部分 233 | --------------------------------------- */ 234 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 235 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 236 | CLTreeViewNode *node = [_displayArray objectAtIndex:indexPath.row]; 237 | [self reloadDataForDisplayArrayChangeAt:indexPath.row];//修改cell的状态(关闭或打开) 238 | if(node.type == 2){ 239 | //处理叶子节点选中,此处需要自定义 240 | } 241 | else{ 242 | CLTreeView_LEVEL0_Cell *cell = (CLTreeView_LEVEL0_Cell*)[tableView cellForRowAtIndexPath:indexPath]; 243 | if(cell.node.isExpanded ){ 244 | [self rotateArrow:cell with:M_PI_2]; 245 | } 246 | else{ 247 | [self rotateArrow:cell with:0]; 248 | } 249 | } 250 | } 251 | 252 | /*--------------------------------------- 253 | 旋转箭头图标 254 | --------------------------------------- */ 255 | -(void) rotateArrow:(CLTreeView_LEVEL0_Cell*) cell with:(double)degree{ 256 | [UIView animateWithDuration:0.35 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ 257 | cell.arrowView.layer.transform = CATransform3DMakeRotation(degree, 0, 0, 1); 258 | } completion:NULL]; 259 | } 260 | 261 | /*--------------------------------------- 262 | 初始化将要显示的cell的数据 263 | --------------------------------------- */ 264 | -(void) reloadDataForDisplayArray{ 265 | NSMutableArray *tmp = [[NSMutableArray alloc]init]; 266 | for (CLTreeViewNode *node in _dataArray) { 267 | [tmp addObject:node]; 268 | if(node.isExpanded){ 269 | for(CLTreeViewNode *node2 in node.sonNodes){ 270 | [tmp addObject:node2]; 271 | if(node2.isExpanded){ 272 | for(CLTreeViewNode *node3 in node2.sonNodes){ 273 | [tmp addObject:node3]; 274 | } 275 | } 276 | } 277 | } 278 | } 279 | _displayArray = [NSArray arrayWithArray:tmp]; 280 | [self.myTableView reloadData]; 281 | } 282 | 283 | /*--------------------------------------- 284 | 修改cell的状态(关闭或打开) 285 | --------------------------------------- */ 286 | -(void) reloadDataForDisplayArrayChangeAt:(NSInteger)row{ 287 | NSMutableArray *tmp = [[NSMutableArray alloc]init]; 288 | NSInteger cnt=0; 289 | for (CLTreeViewNode *node in _dataArray) { 290 | [tmp addObject:node]; 291 | if(cnt == row){ 292 | node.isExpanded = !node.isExpanded; 293 | } 294 | ++cnt; 295 | if(node.isExpanded){ 296 | for(CLTreeViewNode *node2 in node.sonNodes){ 297 | [tmp addObject:node2]; 298 | if(cnt == row){ 299 | node2.isExpanded = !node2.isExpanded; 300 | } 301 | ++cnt; 302 | if(node2.isExpanded){ 303 | for(CLTreeViewNode *node3 in node2.sonNodes){ 304 | [tmp addObject:node3]; 305 | ++cnt; 306 | } 307 | } 308 | } 309 | } 310 | } 311 | _displayArray = [NSArray arrayWithArray:tmp]; 312 | [self.myTableView reloadData]; 313 | } 314 | @end 315 | 316 | -------------------------------------------------------------------------------- /CLTreeViewDemo/ThreeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeViewController.m 3 | // CLTreeViewDemo 4 | // 5 | // Created by 钟由 on 14-9-9. 6 | // Copyright (c) 2014年 flywarrior24@163.com. All rights reserved. 7 | // 8 | 9 | #import "ThreeViewController.h" 10 | #import "CLTree.h" 11 | 12 | @interface ThreeViewController () 13 | 14 | @property(strong,nonatomic) NSMutableArray* dataArray; //保存全部数据的数组 15 | @property(strong,nonatomic) NSArray *displayArray; //保存要显示在界面上的数据的数组 16 | 17 | @end 18 | 19 | @implementation ThreeViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | _myTableView = [[UITableView alloc]init]; 25 | _myTableView.dataSource = self; 26 | _myTableView.delegate = self; 27 | CGRect tableViewFrame = CGRectMake(0, 25, self.view.frame.size.width, self.view.frame.size.height); 28 | _myTableView.frame = tableViewFrame; 29 | [self.view addSubview:_myTableView]; 30 | [self addTestData];//添加演示数据 31 | [self reloadDataForDisplayArray];//初始化将要显示的数据 32 | } 33 | 34 | //添加演示数据 35 | -(void) addTestData{ 36 | CLTreeViewNode *node0 = [[CLTreeViewNode alloc]init]; 37 | node0.nodeLevel = 0; 38 | node0.type = 0; 39 | node0.sonNodes = nil; 40 | node0.isExpanded = FALSE; 41 | CLTreeView_LEVEL0_Model *tmp0 =[[CLTreeView_LEVEL0_Model alloc]init]; 42 | tmp0.name = @"收藏"; 43 | tmp0.headImgPath = @"contacts_collect.png"; 44 | tmp0.headImgUrl = nil; 45 | node0.nodeData = tmp0; 46 | 47 | CLTreeViewNode *node1 = [[CLTreeViewNode alloc]init]; 48 | node1.nodeLevel = 0; 49 | node1.type = 0; 50 | node1.sonNodes = nil; 51 | node1.isExpanded = FALSE; 52 | CLTreeView_LEVEL0_Model *tmp1 =[[CLTreeView_LEVEL0_Model alloc]init]; 53 | tmp1.name = @"软件技术"; 54 | tmp1.headImgPath = @"contacts_major.png"; 55 | tmp1.headImgUrl = nil; 56 | node1.nodeData = tmp1; 57 | 58 | CLTreeViewNode *node2 = [[CLTreeViewNode alloc]init]; 59 | node2.nodeLevel = 0; 60 | node2.type = 0; 61 | node2.sonNodes = nil; 62 | node2.isExpanded = FALSE; 63 | CLTreeView_LEVEL0_Model *tmp2 =[[CLTreeView_LEVEL0_Model alloc]init]; 64 | tmp2.name = @"信息工程"; 65 | tmp2.headImgPath = @"contacts_major.png"; 66 | tmp2.headImgUrl = nil; 67 | node2.nodeData = tmp2; 68 | 69 | CLTreeViewNode *node3 = [[CLTreeViewNode alloc]init]; 70 | node3.nodeLevel = 1; 71 | node3.type = 1; 72 | node3.sonNodes = nil; 73 | node3.isExpanded = FALSE; 74 | CLTreeView_LEVEL1_Model *tmp3 =[[CLTreeView_LEVEL1_Model alloc]init]; 75 | tmp3.name = @"软件技术1班"; 76 | tmp3.sonCnt = @"3"; 77 | node3.nodeData = tmp3; 78 | 79 | CLTreeViewNode *node4 = [[CLTreeViewNode alloc]init]; 80 | node4.nodeLevel = 1; 81 | node4.type = 1; 82 | node4.sonNodes = nil; 83 | node4.isExpanded = FALSE; 84 | CLTreeView_LEVEL1_Model *tmp4 =[[CLTreeView_LEVEL1_Model alloc]init]; 85 | tmp4.name = @"软件技术2班"; 86 | tmp4.sonCnt = @"1"; 87 | node4.nodeData = tmp4; 88 | 89 | CLTreeViewNode *node5 = [[CLTreeViewNode alloc]init]; 90 | node5.nodeLevel = 2; 91 | node5.type = 2; 92 | node5.sonNodes = nil; 93 | node5.isExpanded = FALSE; 94 | CLTreeView_LEVEL2_Model *tmp5 =[[CLTreeView_LEVEL2_Model alloc]init]; 95 | tmp5.name = @"flywarrior"; 96 | tmp5.signture = @"老是失眠怎么办啊"; 97 | tmp5.headImgPath = @"head1.jpg"; 98 | tmp5.headImgUrl = nil; 99 | node5.nodeData = tmp5; 100 | 101 | CLTreeViewNode *node6 = [[CLTreeViewNode alloc]init]; 102 | node6.nodeLevel = 2; 103 | node6.type = 2; 104 | node6.sonNodes = nil; 105 | node6.isExpanded = FALSE; 106 | CLTreeView_LEVEL2_Model *tmp6 =[[CLTreeView_LEVEL2_Model alloc]init]; 107 | tmp6.name = @"flywarrior2"; 108 | tmp6.signture = @"用头用力撞下键盘就好了。"; 109 | tmp6.headImgPath = @"head2.jpg"; 110 | tmp6.headImgUrl = nil; 111 | node6.nodeData = tmp6; 112 | 113 | CLTreeViewNode *node7 = [[CLTreeViewNode alloc]init]; 114 | node7.nodeLevel = 2; 115 | node7.type = 2; 116 | node7.sonNodes = nil; 117 | node7.isExpanded = FALSE; 118 | CLTreeView_LEVEL2_Model *tmp7 =[[CLTreeView_LEVEL2_Model alloc]init]; 119 | tmp7.name = @"李四"; 120 | tmp7.signture = @"说的好有道理,我竟无言以对。"; 121 | tmp7.headImgPath = @"head3.jpg"; 122 | tmp7.headImgUrl = nil; 123 | node7.nodeData = tmp7; 124 | 125 | CLTreeViewNode *node8 = [[CLTreeViewNode alloc]init]; 126 | node8.nodeLevel = 2; 127 | node8.type = 2; 128 | node8.sonNodes = nil; 129 | node8.isExpanded = FALSE; 130 | CLTreeView_LEVEL2_Model *tmp8 =[[CLTreeView_LEVEL2_Model alloc]init]; 131 | tmp8.name = @"田七"; 132 | tmp8.signture = @"肚子好饿啊。。。"; 133 | tmp8.headImgPath = @"head4.jpg"; 134 | tmp8.headImgUrl = nil; 135 | node8.nodeData = tmp8; 136 | 137 | CLTreeViewNode *node9 = [[CLTreeViewNode alloc]init]; 138 | node9.nodeLevel = 2; 139 | node9.type = 2; 140 | node9.sonNodes = nil; 141 | node9.isExpanded = FALSE; 142 | CLTreeView_LEVEL2_Model *tmp9 =[[CLTreeView_LEVEL2_Model alloc]init]; 143 | tmp9.name = @"王大锤"; 144 | tmp9.signture = @"走向人生巅峰!"; 145 | tmp9.headImgPath = @"head5.jpg"; 146 | tmp9.headImgUrl = nil; 147 | node9.nodeData = tmp9; 148 | 149 | CLTreeViewNode *node10 = [[CLTreeViewNode alloc]init]; 150 | node10.nodeLevel = 2; 151 | node10.type = 2; 152 | node10.sonNodes = nil; 153 | node10.isExpanded = FALSE; 154 | CLTreeView_LEVEL2_Model *tmp10 =[[CLTreeView_LEVEL2_Model alloc]init]; 155 | tmp10.name = @"孔连顺"; 156 | tmp10.signture = @"锤锤。。。"; 157 | tmp10.headImgPath = @"head6.jpg"; 158 | tmp10.headImgUrl = nil; 159 | node10.nodeData = tmp10; 160 | 161 | node0.sonNodes = [NSMutableArray arrayWithObjects:node8,node9,nil]; 162 | node1.sonNodes = [NSMutableArray arrayWithObjects:node3,node4,nil]; 163 | node3.sonNodes = [NSMutableArray arrayWithObjects:node5,node7,node10,nil]; 164 | node4.sonNodes = [NSMutableArray arrayWithObjects:node6,nil]; 165 | _dataArray = [NSMutableArray arrayWithObjects:node0,node1,node2, nil]; 166 | } 167 | 168 | - (void)didReceiveMemoryWarning 169 | { 170 | [super didReceiveMemoryWarning]; 171 | // Dispose of any resources that can be recreated. 172 | } 173 | 174 | -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{ 175 | return 1; 176 | } 177 | 178 | -(NSInteger) tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{ 179 | return _displayArray.count; 180 | } 181 | 182 | -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 183 | static NSString *indentifier = @"level0cell"; 184 | static NSString *indentifier1 = @"level1cell"; 185 | static NSString *indentifier2 = @"level2cell"; 186 | CLTreeViewNode *node = [_displayArray objectAtIndex:indexPath.row]; 187 | 188 | if(node.type == 0){//类型为0的cell 189 | CLTreeView_LEVEL0_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier]; 190 | if(cell == nil){ 191 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level0_Cell" owner:self options:nil] lastObject]; 192 | } 193 | cell.node = node; 194 | [self loadDataForTreeViewCell:cell with:node];//重新给cell装载数据 195 | [cell setNeedsDisplay]; //重新描绘cell 196 | return cell; 197 | } 198 | else if(node.type == 1){//类型为1的cell 199 | CLTreeView_LEVEL1_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier1]; 200 | if(cell == nil){ 201 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level1_Cell" owner:self options:nil] lastObject]; 202 | } 203 | cell.node = node; 204 | [self loadDataForTreeViewCell:cell with:node]; 205 | [cell setNeedsDisplay]; 206 | return cell; 207 | } 208 | else{//类型为2的cell 209 | CLTreeView_LEVEL2_Cell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier2]; 210 | if(cell == nil){ 211 | cell = [[[NSBundle mainBundle] loadNibNamed:@"Level2_Cell" owner:self options:nil] lastObject]; 212 | } 213 | cell.node = node; 214 | [self loadDataForTreeViewCell:cell with:node]; 215 | [cell setNeedsDisplay]; 216 | return cell; 217 | } 218 | } 219 | 220 | /*--------------------------------------- 221 | 为不同类型cell填充数据 222 | --------------------------------------- */ 223 | -(void) loadDataForTreeViewCell:(UITableViewCell*)cell with:(CLTreeViewNode*)node{ 224 | if(node.type == 0){ 225 | CLTreeView_LEVEL0_Model *nodeData = node.nodeData; 226 | ((CLTreeView_LEVEL0_Cell*)cell).name.text = nodeData.name; 227 | if(nodeData.headImgPath != nil){ 228 | //本地图片 229 | [((CLTreeView_LEVEL0_Cell*)cell).imageView setImage:[UIImage imageNamed:nodeData.headImgPath]]; 230 | } 231 | else if (nodeData.headImgUrl != nil){ 232 | //加载图片,这里是同步操作。建议使用SDWebImage异步加载图片 233 | [((CLTreeView_LEVEL0_Cell*)cell).imageView setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:nodeData.headImgUrl]]]; 234 | } 235 | } 236 | 237 | else if(node.type == 1){ 238 | CLTreeView_LEVEL1_Model *nodeData = node.nodeData; 239 | ((CLTreeView_LEVEL1_Cell*)cell).name.text = nodeData.name; 240 | ((CLTreeView_LEVEL1_Cell*)cell).sonCount.text = nodeData.sonCnt; 241 | } 242 | 243 | else{ 244 | CLTreeView_LEVEL2_Model *nodeData = node.nodeData; 245 | ((CLTreeView_LEVEL2_Cell*)cell).name.text = nodeData.name; 246 | ((CLTreeView_LEVEL2_Cell*)cell).signture.text = nodeData.signture; 247 | if(nodeData.headImgPath != nil){ 248 | //本地图片 249 | [((CLTreeView_LEVEL2_Cell*)cell).headImg setImage:[UIImage imageNamed:nodeData.headImgPath]]; 250 | } 251 | else if (nodeData.headImgUrl != nil){ 252 | //加载图片,这里是同步操作。建议使用SDWebImage异步加载图片 253 | [((CLTreeView_LEVEL2_Cell*)cell).headImg setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:nodeData.headImgUrl]]]; 254 | } 255 | } 256 | } 257 | 258 | /*--------------------------------------- 259 | cell高度默认为50 260 | --------------------------------------- */ 261 | -(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath 262 | { 263 | return 50; 264 | } 265 | 266 | /*--------------------------------------- 267 | 处理cell选中事件,需要自定义的部分 268 | --------------------------------------- */ 269 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 270 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 271 | CLTreeViewNode *node = [_displayArray objectAtIndex:indexPath.row]; 272 | [self reloadDataForDisplayArrayChangeAt:indexPath.row];//修改cell的状态(关闭或打开) 273 | if(node.type == 2){ 274 | //处理叶子节点选中,此处需要自定义 275 | } 276 | else{ 277 | CLTreeView_LEVEL0_Cell *cell = (CLTreeView_LEVEL0_Cell*)[tableView cellForRowAtIndexPath:indexPath]; 278 | if(cell.node.isExpanded ){ 279 | [self rotateArrow:cell with:M_PI_2]; 280 | } 281 | else{ 282 | [self rotateArrow:cell with:0]; 283 | } 284 | } 285 | } 286 | 287 | /*--------------------------------------- 288 | 旋转箭头图标 289 | --------------------------------------- */ 290 | -(void) rotateArrow:(CLTreeView_LEVEL0_Cell*) cell with:(double)degree{ 291 | [UIView animateWithDuration:0.35 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ 292 | cell.arrowView.layer.transform = CATransform3DMakeRotation(degree, 0, 0, 1); 293 | } completion:NULL]; 294 | } 295 | 296 | /*--------------------------------------- 297 | 初始化将要显示的cell的数据 298 | --------------------------------------- */ 299 | -(void) reloadDataForDisplayArray{ 300 | NSMutableArray *tmp = [[NSMutableArray alloc]init]; 301 | for (CLTreeViewNode *node in _dataArray) { 302 | [tmp addObject:node]; 303 | if(node.isExpanded){ 304 | for(CLTreeViewNode *node2 in node.sonNodes){ 305 | [tmp addObject:node2]; 306 | if(node2.isExpanded){ 307 | for(CLTreeViewNode *node3 in node2.sonNodes){ 308 | [tmp addObject:node3]; 309 | } 310 | } 311 | } 312 | } 313 | } 314 | _displayArray = [NSArray arrayWithArray:tmp]; 315 | [self.myTableView reloadData]; 316 | } 317 | 318 | /*--------------------------------------- 319 | 修改cell的状态(关闭或打开) 320 | --------------------------------------- */ 321 | -(void) reloadDataForDisplayArrayChangeAt:(NSInteger)row{ 322 | NSMutableArray *tmp = [[NSMutableArray alloc]init]; 323 | NSInteger cnt=0; 324 | for (CLTreeViewNode *node in _dataArray) { 325 | [tmp addObject:node]; 326 | if(cnt == row){ 327 | node.isExpanded = !node.isExpanded; 328 | } 329 | ++cnt; 330 | if(node.isExpanded){ 331 | for(CLTreeViewNode *node2 in node.sonNodes){ 332 | [tmp addObject:node2]; 333 | if(cnt == row){ 334 | node2.isExpanded = !node2.isExpanded; 335 | } 336 | ++cnt; 337 | if(node2.isExpanded){ 338 | for(CLTreeViewNode *node3 in node2.sonNodes){ 339 | [tmp addObject:node3]; 340 | ++cnt; 341 | } 342 | } 343 | } 344 | } 345 | } 346 | _displayArray = [NSArray arrayWithArray:tmp]; 347 | [self.myTableView reloadData]; 348 | } 349 | @end 350 | 351 | -------------------------------------------------------------------------------- /CLTreeViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 343592D819BE92A9006762FC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 343592D719BE92A9006762FC /* Foundation.framework */; }; 11 | 343592DA19BE92A9006762FC /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 343592D919BE92A9006762FC /* CoreGraphics.framework */; }; 12 | 343592DC19BE92A9006762FC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 343592DB19BE92A9006762FC /* UIKit.framework */; }; 13 | 343592E219BE92A9006762FC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 343592E019BE92A9006762FC /* InfoPlist.strings */; }; 14 | 343592E419BE92A9006762FC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 343592E319BE92A9006762FC /* main.m */; }; 15 | 343592E819BE92A9006762FC /* CLTreeViewDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 343592E719BE92A9006762FC /* CLTreeViewDemoAppDelegate.m */; }; 16 | 343592EB19BE92A9006762FC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 343592E919BE92A9006762FC /* Main.storyboard */; }; 17 | 343592EE19BE92A9006762FC /* ThreeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 343592ED19BE92A9006762FC /* ThreeViewController.m */; }; 18 | 343592F019BE92A9006762FC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 343592EF19BE92A9006762FC /* Images.xcassets */; }; 19 | 343592F719BE92A9006762FC /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 343592F619BE92A9006762FC /* XCTest.framework */; }; 20 | 343592F819BE92A9006762FC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 343592D719BE92A9006762FC /* Foundation.framework */; }; 21 | 343592F919BE92A9006762FC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 343592DB19BE92A9006762FC /* UIKit.framework */; }; 22 | 3435930119BE92A9006762FC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 343592FF19BE92A9006762FC /* InfoPlist.strings */; }; 23 | 3435930319BE92A9006762FC /* CLTreeViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435930219BE92A9006762FC /* CLTreeViewDemoTests.m */; }; 24 | 3435932B19BE9390006762FC /* CLTreeView_LEVEL0_Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435931019BE9390006762FC /* CLTreeView_LEVEL0_Cell.m */; }; 25 | 3435932C19BE9390006762FC /* CLTreeView_LEVEL0_Model.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435931219BE9390006762FC /* CLTreeView_LEVEL0_Model.m */; }; 26 | 3435932D19BE9390006762FC /* CLTreeView_LEVEL1_Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435931419BE9390006762FC /* CLTreeView_LEVEL1_Cell.m */; }; 27 | 3435932E19BE9390006762FC /* CLTreeView_LEVEL1_Model.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435931619BE9390006762FC /* CLTreeView_LEVEL1_Model.m */; }; 28 | 3435932F19BE9390006762FC /* CLTreeView_LEVEL2_Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435931819BE9390006762FC /* CLTreeView_LEVEL2_Cell.m */; }; 29 | 3435933019BE9390006762FC /* CLTreeView_LEVEL2_Model.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435931A19BE9390006762FC /* CLTreeView_LEVEL2_Model.m */; }; 30 | 3435933319BE9390006762FC /* CLTreeViewNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435932019BE9390006762FC /* CLTreeViewNode.m */; }; 31 | 3435933419BE9390006762FC /* contacts_collect@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3435932219BE9390006762FC /* contacts_collect@2x.png */; }; 32 | 3435933519BE9390006762FC /* contacts_major@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3435932319BE9390006762FC /* contacts_major@2x.png */; }; 33 | 3435933619BE9390006762FC /* head1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435932419BE9390006762FC /* head1.jpg */; }; 34 | 3435933719BE9390006762FC /* head2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435932519BE9390006762FC /* head2.jpg */; }; 35 | 3435933819BE9390006762FC /* the_arrow.png in Resources */ = {isa = PBXBuildFile; fileRef = 3435932619BE9390006762FC /* the_arrow.png */; }; 36 | 3435933919BE9390006762FC /* Level0_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3435932719BE9390006762FC /* Level0_Cell.xib */; }; 37 | 3435933A19BE9390006762FC /* Level1_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3435932819BE9390006762FC /* Level1_Cell.xib */; }; 38 | 3435933B19BE9390006762FC /* Level2_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3435932919BE9390006762FC /* Level2_Cell.xib */; }; 39 | 3435936B19BE984C006762FC /* DoubleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3435936A19BE984C006762FC /* DoubleViewController.m */; }; 40 | 3435937119BE9E89006762FC /* head4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435936C19BE9E89006762FC /* head4.jpg */; }; 41 | 3435937219BE9E89006762FC /* head5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435936D19BE9E89006762FC /* head5.jpg */; }; 42 | 3435937319BE9E89006762FC /* head6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435936E19BE9E89006762FC /* head6.jpg */; }; 43 | 3435937419BE9E89006762FC /* head7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435936F19BE9E89006762FC /* head7.jpg */; }; 44 | 3435937519BE9E89006762FC /* head8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435937019BE9E89006762FC /* head8.jpg */; }; 45 | 3435937719BE9ED5006762FC /* head3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3435937619BE9ED5006762FC /* head3.jpg */; }; 46 | /* End PBXBuildFile section */ 47 | 48 | /* Begin PBXContainerItemProxy section */ 49 | 343592FA19BE92A9006762FC /* PBXContainerItemProxy */ = { 50 | isa = PBXContainerItemProxy; 51 | containerPortal = 343592CC19BE92A9006762FC /* Project object */; 52 | proxyType = 1; 53 | remoteGlobalIDString = 343592D319BE92A9006762FC; 54 | remoteInfo = CLTreeViewDemo; 55 | }; 56 | /* End PBXContainerItemProxy section */ 57 | 58 | /* Begin PBXFileReference section */ 59 | 343592D419BE92A9006762FC /* CLTreeViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CLTreeViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 343592D719BE92A9006762FC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 61 | 343592D919BE92A9006762FC /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 62 | 343592DB19BE92A9006762FC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 63 | 343592DF19BE92A9006762FC /* CLTreeViewDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CLTreeViewDemo-Info.plist"; sourceTree = ""; }; 64 | 343592E119BE92A9006762FC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 65 | 343592E319BE92A9006762FC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 66 | 343592E519BE92A9006762FC /* CLTreeViewDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CLTreeViewDemo-Prefix.pch"; sourceTree = ""; }; 67 | 343592E619BE92A9006762FC /* CLTreeViewDemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CLTreeViewDemoAppDelegate.h; sourceTree = ""; }; 68 | 343592E719BE92A9006762FC /* CLTreeViewDemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CLTreeViewDemoAppDelegate.m; sourceTree = ""; }; 69 | 343592EA19BE92A9006762FC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 70 | 343592EC19BE92A9006762FC /* ThreeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreeViewController.h; sourceTree = ""; }; 71 | 343592ED19BE92A9006762FC /* ThreeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ThreeViewController.m; sourceTree = ""; }; 72 | 343592EF19BE92A9006762FC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 73 | 343592F519BE92A9006762FC /* CLTreeViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CLTreeViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | 343592F619BE92A9006762FC /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 75 | 343592FE19BE92A9006762FC /* CLTreeViewDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CLTreeViewDemoTests-Info.plist"; sourceTree = ""; }; 76 | 3435930019BE92A9006762FC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 77 | 3435930219BE92A9006762FC /* CLTreeViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CLTreeViewDemoTests.m; sourceTree = ""; }; 78 | 3435930F19BE9390006762FC /* CLTreeView_LEVEL0_Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTreeView_LEVEL0_Cell.h; sourceTree = ""; }; 79 | 3435931019BE9390006762FC /* CLTreeView_LEVEL0_Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLTreeView_LEVEL0_Cell.m; sourceTree = ""; }; 80 | 3435931119BE9390006762FC /* CLTreeView_LEVEL0_Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTreeView_LEVEL0_Model.h; sourceTree = ""; }; 81 | 3435931219BE9390006762FC /* CLTreeView_LEVEL0_Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLTreeView_LEVEL0_Model.m; sourceTree = ""; }; 82 | 3435931319BE9390006762FC /* CLTreeView_LEVEL1_Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTreeView_LEVEL1_Cell.h; sourceTree = ""; }; 83 | 3435931419BE9390006762FC /* CLTreeView_LEVEL1_Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLTreeView_LEVEL1_Cell.m; sourceTree = ""; }; 84 | 3435931519BE9390006762FC /* CLTreeView_LEVEL1_Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTreeView_LEVEL1_Model.h; sourceTree = ""; }; 85 | 3435931619BE9390006762FC /* CLTreeView_LEVEL1_Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLTreeView_LEVEL1_Model.m; sourceTree = ""; }; 86 | 3435931719BE9390006762FC /* CLTreeView_LEVEL2_Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTreeView_LEVEL2_Cell.h; sourceTree = ""; }; 87 | 3435931819BE9390006762FC /* CLTreeView_LEVEL2_Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLTreeView_LEVEL2_Cell.m; sourceTree = ""; }; 88 | 3435931919BE9390006762FC /* CLTreeView_LEVEL2_Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTreeView_LEVEL2_Model.h; sourceTree = ""; }; 89 | 3435931A19BE9390006762FC /* CLTreeView_LEVEL2_Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLTreeView_LEVEL2_Model.m; sourceTree = ""; }; 90 | 3435931F19BE9390006762FC /* CLTreeViewNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTreeViewNode.h; sourceTree = ""; }; 91 | 3435932019BE9390006762FC /* CLTreeViewNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CLTreeViewNode.m; sourceTree = ""; }; 92 | 3435932219BE9390006762FC /* contacts_collect@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "contacts_collect@2x.png"; sourceTree = ""; }; 93 | 3435932319BE9390006762FC /* contacts_major@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "contacts_major@2x.png"; sourceTree = ""; }; 94 | 3435932419BE9390006762FC /* head1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head1.jpg; sourceTree = ""; }; 95 | 3435932519BE9390006762FC /* head2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head2.jpg; sourceTree = ""; }; 96 | 3435932619BE9390006762FC /* the_arrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = the_arrow.png; sourceTree = ""; }; 97 | 3435932719BE9390006762FC /* Level0_Cell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Level0_Cell.xib; sourceTree = ""; }; 98 | 3435932819BE9390006762FC /* Level1_Cell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Level1_Cell.xib; sourceTree = ""; }; 99 | 3435932919BE9390006762FC /* Level2_Cell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Level2_Cell.xib; sourceTree = ""; }; 100 | 3435936619BE95C3006762FC /* CLTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CLTree.h; sourceTree = ""; }; 101 | 3435936919BE984C006762FC /* DoubleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoubleViewController.h; sourceTree = ""; }; 102 | 3435936A19BE984C006762FC /* DoubleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DoubleViewController.m; sourceTree = ""; }; 103 | 3435936C19BE9E89006762FC /* head4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head4.jpg; sourceTree = ""; }; 104 | 3435936D19BE9E89006762FC /* head5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head5.jpg; sourceTree = ""; }; 105 | 3435936E19BE9E89006762FC /* head6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head6.jpg; sourceTree = ""; }; 106 | 3435936F19BE9E89006762FC /* head7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head7.jpg; sourceTree = ""; }; 107 | 3435937019BE9E89006762FC /* head8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head8.jpg; sourceTree = ""; }; 108 | 3435937619BE9ED5006762FC /* head3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = head3.jpg; sourceTree = ""; }; 109 | /* End PBXFileReference section */ 110 | 111 | /* Begin PBXFrameworksBuildPhase section */ 112 | 343592D119BE92A9006762FC /* Frameworks */ = { 113 | isa = PBXFrameworksBuildPhase; 114 | buildActionMask = 2147483647; 115 | files = ( 116 | 343592DA19BE92A9006762FC /* CoreGraphics.framework in Frameworks */, 117 | 343592DC19BE92A9006762FC /* UIKit.framework in Frameworks */, 118 | 343592D819BE92A9006762FC /* Foundation.framework in Frameworks */, 119 | ); 120 | runOnlyForDeploymentPostprocessing = 0; 121 | }; 122 | 343592F219BE92A9006762FC /* Frameworks */ = { 123 | isa = PBXFrameworksBuildPhase; 124 | buildActionMask = 2147483647; 125 | files = ( 126 | 343592F719BE92A9006762FC /* XCTest.framework in Frameworks */, 127 | 343592F919BE92A9006762FC /* UIKit.framework in Frameworks */, 128 | 343592F819BE92A9006762FC /* Foundation.framework in Frameworks */, 129 | ); 130 | runOnlyForDeploymentPostprocessing = 0; 131 | }; 132 | /* End PBXFrameworksBuildPhase section */ 133 | 134 | /* Begin PBXGroup section */ 135 | 343592CB19BE92A9006762FC = { 136 | isa = PBXGroup; 137 | children = ( 138 | 3435930C19BE9390006762FC /* CLTreeView */, 139 | 343592DD19BE92A9006762FC /* CLTreeViewDemo */, 140 | 343592FC19BE92A9006762FC /* CLTreeViewDemoTests */, 141 | 343592D619BE92A9006762FC /* Frameworks */, 142 | 343592D519BE92A9006762FC /* Products */, 143 | ); 144 | sourceTree = ""; 145 | }; 146 | 343592D519BE92A9006762FC /* Products */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 343592D419BE92A9006762FC /* CLTreeViewDemo.app */, 150 | 343592F519BE92A9006762FC /* CLTreeViewDemoTests.xctest */, 151 | ); 152 | name = Products; 153 | sourceTree = ""; 154 | }; 155 | 343592D619BE92A9006762FC /* Frameworks */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 343592D719BE92A9006762FC /* Foundation.framework */, 159 | 343592D919BE92A9006762FC /* CoreGraphics.framework */, 160 | 343592DB19BE92A9006762FC /* UIKit.framework */, 161 | 343592F619BE92A9006762FC /* XCTest.framework */, 162 | ); 163 | name = Frameworks; 164 | sourceTree = ""; 165 | }; 166 | 343592DD19BE92A9006762FC /* CLTreeViewDemo */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 343592E619BE92A9006762FC /* CLTreeViewDemoAppDelegate.h */, 170 | 343592E719BE92A9006762FC /* CLTreeViewDemoAppDelegate.m */, 171 | 343592E919BE92A9006762FC /* Main.storyboard */, 172 | 3435936919BE984C006762FC /* DoubleViewController.h */, 173 | 3435936A19BE984C006762FC /* DoubleViewController.m */, 174 | 343592EC19BE92A9006762FC /* ThreeViewController.h */, 175 | 343592ED19BE92A9006762FC /* ThreeViewController.m */, 176 | 343592EF19BE92A9006762FC /* Images.xcassets */, 177 | 343592DE19BE92A9006762FC /* Supporting Files */, 178 | ); 179 | path = CLTreeViewDemo; 180 | sourceTree = ""; 181 | }; 182 | 343592DE19BE92A9006762FC /* Supporting Files */ = { 183 | isa = PBXGroup; 184 | children = ( 185 | 343592DF19BE92A9006762FC /* CLTreeViewDemo-Info.plist */, 186 | 343592E019BE92A9006762FC /* InfoPlist.strings */, 187 | 343592E319BE92A9006762FC /* main.m */, 188 | 343592E519BE92A9006762FC /* CLTreeViewDemo-Prefix.pch */, 189 | ); 190 | name = "Supporting Files"; 191 | sourceTree = ""; 192 | }; 193 | 343592FC19BE92A9006762FC /* CLTreeViewDemoTests */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 3435930219BE92A9006762FC /* CLTreeViewDemoTests.m */, 197 | 343592FD19BE92A9006762FC /* Supporting Files */, 198 | ); 199 | path = CLTreeViewDemoTests; 200 | sourceTree = ""; 201 | }; 202 | 343592FD19BE92A9006762FC /* Supporting Files */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 343592FE19BE92A9006762FC /* CLTreeViewDemoTests-Info.plist */, 206 | 343592FF19BE92A9006762FC /* InfoPlist.strings */, 207 | ); 208 | name = "Supporting Files"; 209 | sourceTree = ""; 210 | }; 211 | 3435930C19BE9390006762FC /* CLTreeView */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | 3435936619BE95C3006762FC /* CLTree.h */, 215 | 3435932719BE9390006762FC /* Level0_Cell.xib */, 216 | 3435930F19BE9390006762FC /* CLTreeView_LEVEL0_Cell.h */, 217 | 3435931019BE9390006762FC /* CLTreeView_LEVEL0_Cell.m */, 218 | 3435931119BE9390006762FC /* CLTreeView_LEVEL0_Model.h */, 219 | 3435931219BE9390006762FC /* CLTreeView_LEVEL0_Model.m */, 220 | 3435932819BE9390006762FC /* Level1_Cell.xib */, 221 | 3435931319BE9390006762FC /* CLTreeView_LEVEL1_Cell.h */, 222 | 3435931419BE9390006762FC /* CLTreeView_LEVEL1_Cell.m */, 223 | 3435931519BE9390006762FC /* CLTreeView_LEVEL1_Model.h */, 224 | 3435931619BE9390006762FC /* CLTreeView_LEVEL1_Model.m */, 225 | 3435932919BE9390006762FC /* Level2_Cell.xib */, 226 | 3435931719BE9390006762FC /* CLTreeView_LEVEL2_Cell.h */, 227 | 3435931819BE9390006762FC /* CLTreeView_LEVEL2_Cell.m */, 228 | 3435931919BE9390006762FC /* CLTreeView_LEVEL2_Model.h */, 229 | 3435931A19BE9390006762FC /* CLTreeView_LEVEL2_Model.m */, 230 | 3435931F19BE9390006762FC /* CLTreeViewNode.h */, 231 | 3435932019BE9390006762FC /* CLTreeViewNode.m */, 232 | 3435932119BE9390006762FC /* image */, 233 | ); 234 | path = CLTreeView; 235 | sourceTree = ""; 236 | }; 237 | 3435932119BE9390006762FC /* image */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | 3435937619BE9ED5006762FC /* head3.jpg */, 241 | 3435936C19BE9E89006762FC /* head4.jpg */, 242 | 3435936D19BE9E89006762FC /* head5.jpg */, 243 | 3435936E19BE9E89006762FC /* head6.jpg */, 244 | 3435936F19BE9E89006762FC /* head7.jpg */, 245 | 3435937019BE9E89006762FC /* head8.jpg */, 246 | 3435932219BE9390006762FC /* contacts_collect@2x.png */, 247 | 3435932319BE9390006762FC /* contacts_major@2x.png */, 248 | 3435932419BE9390006762FC /* head1.jpg */, 249 | 3435932519BE9390006762FC /* head2.jpg */, 250 | 3435932619BE9390006762FC /* the_arrow.png */, 251 | ); 252 | path = image; 253 | sourceTree = ""; 254 | }; 255 | /* End PBXGroup section */ 256 | 257 | /* Begin PBXNativeTarget section */ 258 | 343592D319BE92A9006762FC /* CLTreeViewDemo */ = { 259 | isa = PBXNativeTarget; 260 | buildConfigurationList = 3435930619BE92A9006762FC /* Build configuration list for PBXNativeTarget "CLTreeViewDemo" */; 261 | buildPhases = ( 262 | 343592D019BE92A9006762FC /* Sources */, 263 | 343592D119BE92A9006762FC /* Frameworks */, 264 | 343592D219BE92A9006762FC /* Resources */, 265 | ); 266 | buildRules = ( 267 | ); 268 | dependencies = ( 269 | ); 270 | name = CLTreeViewDemo; 271 | productName = CLTreeViewDemo; 272 | productReference = 343592D419BE92A9006762FC /* CLTreeViewDemo.app */; 273 | productType = "com.apple.product-type.application"; 274 | }; 275 | 343592F419BE92A9006762FC /* CLTreeViewDemoTests */ = { 276 | isa = PBXNativeTarget; 277 | buildConfigurationList = 3435930919BE92A9006762FC /* Build configuration list for PBXNativeTarget "CLTreeViewDemoTests" */; 278 | buildPhases = ( 279 | 343592F119BE92A9006762FC /* Sources */, 280 | 343592F219BE92A9006762FC /* Frameworks */, 281 | 343592F319BE92A9006762FC /* Resources */, 282 | ); 283 | buildRules = ( 284 | ); 285 | dependencies = ( 286 | 343592FB19BE92A9006762FC /* PBXTargetDependency */, 287 | ); 288 | name = CLTreeViewDemoTests; 289 | productName = CLTreeViewDemoTests; 290 | productReference = 343592F519BE92A9006762FC /* CLTreeViewDemoTests.xctest */; 291 | productType = "com.apple.product-type.bundle.unit-test"; 292 | }; 293 | /* End PBXNativeTarget section */ 294 | 295 | /* Begin PBXProject section */ 296 | 343592CC19BE92A9006762FC /* Project object */ = { 297 | isa = PBXProject; 298 | attributes = { 299 | CLASSPREFIX = TreeView; 300 | LastUpgradeCheck = 0500; 301 | ORGANIZATIONNAME = "flywarrior24@163.com"; 302 | TargetAttributes = { 303 | 343592F419BE92A9006762FC = { 304 | TestTargetID = 343592D319BE92A9006762FC; 305 | }; 306 | }; 307 | }; 308 | buildConfigurationList = 343592CF19BE92A9006762FC /* Build configuration list for PBXProject "CLTreeViewDemo" */; 309 | compatibilityVersion = "Xcode 3.2"; 310 | developmentRegion = English; 311 | hasScannedForEncodings = 0; 312 | knownRegions = ( 313 | en, 314 | Base, 315 | ); 316 | mainGroup = 343592CB19BE92A9006762FC; 317 | productRefGroup = 343592D519BE92A9006762FC /* Products */; 318 | projectDirPath = ""; 319 | projectRoot = ""; 320 | targets = ( 321 | 343592D319BE92A9006762FC /* CLTreeViewDemo */, 322 | 343592F419BE92A9006762FC /* CLTreeViewDemoTests */, 323 | ); 324 | }; 325 | /* End PBXProject section */ 326 | 327 | /* Begin PBXResourcesBuildPhase section */ 328 | 343592D219BE92A9006762FC /* Resources */ = { 329 | isa = PBXResourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | 343592F019BE92A9006762FC /* Images.xcassets in Resources */, 333 | 3435933B19BE9390006762FC /* Level2_Cell.xib in Resources */, 334 | 3435937519BE9E89006762FC /* head8.jpg in Resources */, 335 | 3435933919BE9390006762FC /* Level0_Cell.xib in Resources */, 336 | 3435933419BE9390006762FC /* contacts_collect@2x.png in Resources */, 337 | 3435937419BE9E89006762FC /* head7.jpg in Resources */, 338 | 3435937219BE9E89006762FC /* head5.jpg in Resources */, 339 | 3435933619BE9390006762FC /* head1.jpg in Resources */, 340 | 343592E219BE92A9006762FC /* InfoPlist.strings in Resources */, 341 | 3435933719BE9390006762FC /* head2.jpg in Resources */, 342 | 3435937319BE9E89006762FC /* head6.jpg in Resources */, 343 | 3435937719BE9ED5006762FC /* head3.jpg in Resources */, 344 | 3435933519BE9390006762FC /* contacts_major@2x.png in Resources */, 345 | 3435933A19BE9390006762FC /* Level1_Cell.xib in Resources */, 346 | 3435933819BE9390006762FC /* the_arrow.png in Resources */, 347 | 3435937119BE9E89006762FC /* head4.jpg in Resources */, 348 | 343592EB19BE92A9006762FC /* Main.storyboard in Resources */, 349 | ); 350 | runOnlyForDeploymentPostprocessing = 0; 351 | }; 352 | 343592F319BE92A9006762FC /* Resources */ = { 353 | isa = PBXResourcesBuildPhase; 354 | buildActionMask = 2147483647; 355 | files = ( 356 | 3435930119BE92A9006762FC /* InfoPlist.strings in Resources */, 357 | ); 358 | runOnlyForDeploymentPostprocessing = 0; 359 | }; 360 | /* End PBXResourcesBuildPhase section */ 361 | 362 | /* Begin PBXSourcesBuildPhase section */ 363 | 343592D019BE92A9006762FC /* Sources */ = { 364 | isa = PBXSourcesBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | 3435932D19BE9390006762FC /* CLTreeView_LEVEL1_Cell.m in Sources */, 368 | 3435932E19BE9390006762FC /* CLTreeView_LEVEL1_Model.m in Sources */, 369 | 343592E419BE92A9006762FC /* main.m in Sources */, 370 | 3435933019BE9390006762FC /* CLTreeView_LEVEL2_Model.m in Sources */, 371 | 343592EE19BE92A9006762FC /* ThreeViewController.m in Sources */, 372 | 343592E819BE92A9006762FC /* CLTreeViewDemoAppDelegate.m in Sources */, 373 | 3435933319BE9390006762FC /* CLTreeViewNode.m in Sources */, 374 | 3435932F19BE9390006762FC /* CLTreeView_LEVEL2_Cell.m in Sources */, 375 | 3435932B19BE9390006762FC /* CLTreeView_LEVEL0_Cell.m in Sources */, 376 | 3435932C19BE9390006762FC /* CLTreeView_LEVEL0_Model.m in Sources */, 377 | 3435936B19BE984C006762FC /* DoubleViewController.m in Sources */, 378 | ); 379 | runOnlyForDeploymentPostprocessing = 0; 380 | }; 381 | 343592F119BE92A9006762FC /* Sources */ = { 382 | isa = PBXSourcesBuildPhase; 383 | buildActionMask = 2147483647; 384 | files = ( 385 | 3435930319BE92A9006762FC /* CLTreeViewDemoTests.m in Sources */, 386 | ); 387 | runOnlyForDeploymentPostprocessing = 0; 388 | }; 389 | /* End PBXSourcesBuildPhase section */ 390 | 391 | /* Begin PBXTargetDependency section */ 392 | 343592FB19BE92A9006762FC /* PBXTargetDependency */ = { 393 | isa = PBXTargetDependency; 394 | target = 343592D319BE92A9006762FC /* CLTreeViewDemo */; 395 | targetProxy = 343592FA19BE92A9006762FC /* PBXContainerItemProxy */; 396 | }; 397 | /* End PBXTargetDependency section */ 398 | 399 | /* Begin PBXVariantGroup section */ 400 | 343592E019BE92A9006762FC /* InfoPlist.strings */ = { 401 | isa = PBXVariantGroup; 402 | children = ( 403 | 343592E119BE92A9006762FC /* en */, 404 | ); 405 | name = InfoPlist.strings; 406 | sourceTree = ""; 407 | }; 408 | 343592E919BE92A9006762FC /* Main.storyboard */ = { 409 | isa = PBXVariantGroup; 410 | children = ( 411 | 343592EA19BE92A9006762FC /* Base */, 412 | ); 413 | name = Main.storyboard; 414 | sourceTree = ""; 415 | }; 416 | 343592FF19BE92A9006762FC /* InfoPlist.strings */ = { 417 | isa = PBXVariantGroup; 418 | children = ( 419 | 3435930019BE92A9006762FC /* en */, 420 | ); 421 | name = InfoPlist.strings; 422 | sourceTree = ""; 423 | }; 424 | /* End PBXVariantGroup section */ 425 | 426 | /* Begin XCBuildConfiguration section */ 427 | 3435930419BE92A9006762FC /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | buildSettings = { 430 | ALWAYS_SEARCH_USER_PATHS = NO; 431 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 432 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 433 | CLANG_CXX_LIBRARY = "libc++"; 434 | CLANG_ENABLE_MODULES = YES; 435 | CLANG_ENABLE_OBJC_ARC = YES; 436 | CLANG_WARN_BOOL_CONVERSION = YES; 437 | CLANG_WARN_CONSTANT_CONVERSION = YES; 438 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 439 | CLANG_WARN_EMPTY_BODY = YES; 440 | CLANG_WARN_ENUM_CONVERSION = YES; 441 | CLANG_WARN_INT_CONVERSION = YES; 442 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 443 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 444 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 445 | COPY_PHASE_STRIP = NO; 446 | GCC_C_LANGUAGE_STANDARD = gnu99; 447 | GCC_DYNAMIC_NO_PIC = NO; 448 | GCC_OPTIMIZATION_LEVEL = 0; 449 | GCC_PREPROCESSOR_DEFINITIONS = ( 450 | "DEBUG=1", 451 | "$(inherited)", 452 | ); 453 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 454 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 455 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 456 | GCC_WARN_UNDECLARED_SELECTOR = YES; 457 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 458 | GCC_WARN_UNUSED_FUNCTION = YES; 459 | GCC_WARN_UNUSED_VARIABLE = YES; 460 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 461 | ONLY_ACTIVE_ARCH = YES; 462 | SDKROOT = iphoneos; 463 | }; 464 | name = Debug; 465 | }; 466 | 3435930519BE92A9006762FC /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | ALWAYS_SEARCH_USER_PATHS = NO; 470 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 471 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 472 | CLANG_CXX_LIBRARY = "libc++"; 473 | CLANG_ENABLE_MODULES = YES; 474 | CLANG_ENABLE_OBJC_ARC = YES; 475 | CLANG_WARN_BOOL_CONVERSION = YES; 476 | CLANG_WARN_CONSTANT_CONVERSION = YES; 477 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 478 | CLANG_WARN_EMPTY_BODY = YES; 479 | CLANG_WARN_ENUM_CONVERSION = YES; 480 | CLANG_WARN_INT_CONVERSION = YES; 481 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 482 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 483 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 484 | COPY_PHASE_STRIP = YES; 485 | ENABLE_NS_ASSERTIONS = NO; 486 | GCC_C_LANGUAGE_STANDARD = gnu99; 487 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 488 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 489 | GCC_WARN_UNDECLARED_SELECTOR = YES; 490 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 491 | GCC_WARN_UNUSED_FUNCTION = YES; 492 | GCC_WARN_UNUSED_VARIABLE = YES; 493 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 494 | SDKROOT = iphoneos; 495 | VALIDATE_PRODUCT = YES; 496 | }; 497 | name = Release; 498 | }; 499 | 3435930719BE92A9006762FC /* Debug */ = { 500 | isa = XCBuildConfiguration; 501 | buildSettings = { 502 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 503 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 504 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 505 | GCC_PREFIX_HEADER = "CLTreeViewDemo/CLTreeViewDemo-Prefix.pch"; 506 | INFOPLIST_FILE = "CLTreeViewDemo/CLTreeViewDemo-Info.plist"; 507 | PRODUCT_NAME = "$(TARGET_NAME)"; 508 | WRAPPER_EXTENSION = app; 509 | }; 510 | name = Debug; 511 | }; 512 | 3435930819BE92A9006762FC /* Release */ = { 513 | isa = XCBuildConfiguration; 514 | buildSettings = { 515 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 516 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 517 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 518 | GCC_PREFIX_HEADER = "CLTreeViewDemo/CLTreeViewDemo-Prefix.pch"; 519 | INFOPLIST_FILE = "CLTreeViewDemo/CLTreeViewDemo-Info.plist"; 520 | PRODUCT_NAME = "$(TARGET_NAME)"; 521 | WRAPPER_EXTENSION = app; 522 | }; 523 | name = Release; 524 | }; 525 | 3435930A19BE92A9006762FC /* Debug */ = { 526 | isa = XCBuildConfiguration; 527 | buildSettings = { 528 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 529 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CLTreeViewDemo.app/CLTreeViewDemo"; 530 | FRAMEWORK_SEARCH_PATHS = ( 531 | "$(SDKROOT)/Developer/Library/Frameworks", 532 | "$(inherited)", 533 | "$(DEVELOPER_FRAMEWORKS_DIR)", 534 | ); 535 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 536 | GCC_PREFIX_HEADER = "CLTreeViewDemo/CLTreeViewDemo-Prefix.pch"; 537 | GCC_PREPROCESSOR_DEFINITIONS = ( 538 | "DEBUG=1", 539 | "$(inherited)", 540 | ); 541 | INFOPLIST_FILE = "CLTreeViewDemoTests/CLTreeViewDemoTests-Info.plist"; 542 | PRODUCT_NAME = "$(TARGET_NAME)"; 543 | TEST_HOST = "$(BUNDLE_LOADER)"; 544 | WRAPPER_EXTENSION = xctest; 545 | }; 546 | name = Debug; 547 | }; 548 | 3435930B19BE92A9006762FC /* Release */ = { 549 | isa = XCBuildConfiguration; 550 | buildSettings = { 551 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 552 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CLTreeViewDemo.app/CLTreeViewDemo"; 553 | FRAMEWORK_SEARCH_PATHS = ( 554 | "$(SDKROOT)/Developer/Library/Frameworks", 555 | "$(inherited)", 556 | "$(DEVELOPER_FRAMEWORKS_DIR)", 557 | ); 558 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 559 | GCC_PREFIX_HEADER = "CLTreeViewDemo/CLTreeViewDemo-Prefix.pch"; 560 | INFOPLIST_FILE = "CLTreeViewDemoTests/CLTreeViewDemoTests-Info.plist"; 561 | PRODUCT_NAME = "$(TARGET_NAME)"; 562 | TEST_HOST = "$(BUNDLE_LOADER)"; 563 | WRAPPER_EXTENSION = xctest; 564 | }; 565 | name = Release; 566 | }; 567 | /* End XCBuildConfiguration section */ 568 | 569 | /* Begin XCConfigurationList section */ 570 | 343592CF19BE92A9006762FC /* Build configuration list for PBXProject "CLTreeViewDemo" */ = { 571 | isa = XCConfigurationList; 572 | buildConfigurations = ( 573 | 3435930419BE92A9006762FC /* Debug */, 574 | 3435930519BE92A9006762FC /* Release */, 575 | ); 576 | defaultConfigurationIsVisible = 0; 577 | defaultConfigurationName = Release; 578 | }; 579 | 3435930619BE92A9006762FC /* Build configuration list for PBXNativeTarget "CLTreeViewDemo" */ = { 580 | isa = XCConfigurationList; 581 | buildConfigurations = ( 582 | 3435930719BE92A9006762FC /* Debug */, 583 | 3435930819BE92A9006762FC /* Release */, 584 | ); 585 | defaultConfigurationIsVisible = 0; 586 | }; 587 | 3435930919BE92A9006762FC /* Build configuration list for PBXNativeTarget "CLTreeViewDemoTests" */ = { 588 | isa = XCConfigurationList; 589 | buildConfigurations = ( 590 | 3435930A19BE92A9006762FC /* Debug */, 591 | 3435930B19BE92A9006762FC /* Release */, 592 | ); 593 | defaultConfigurationIsVisible = 0; 594 | }; 595 | /* End XCConfigurationList section */ 596 | }; 597 | rootObject = 343592CC19BE92A9006762FC /* Project object */; 598 | } 599 | --------------------------------------------------------------------------------