一个轻量级且易于使用的具有滑动效果的表格视图。
Xcode 6 或更高版本
Apple LLVM 编译器
iOS 7.0 或更高版本
ARC
在 Example 文件夹中有一个示例
如果尚未安装,请安装 CocoaPods
$ [sudo] gem install cocoapods
$ pod setup
切换到您的 Xcode 项目的目录并编辑 PodFile
pod 'CXLSlideList'
将安装到您的 Xcode 项目中
pod install
将 CXLSlideListViewController.h /.m
复制到您的项目中,并在文件中添加 #import "CXLSlideListViewController.h"
。
在您的 AppDelegate 的 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
中创建视图控制器并分配表格视图控制器。
//create three table view controller
MainTableViewController * mainTable = [[MainTableViewController alloc] init];
SecondTableViewController * secondTable = [[SecondTableViewController alloc] init];
ThirdTableViewController * thirdTable = [[ThirdTableViewController alloc] init];
//create CXLSlideList
CXLSlideListViewController * cxlSlideListController = [[CXLSlideListViewController alloc] initWithMainTableViewController:mainTable secondTableViewController:secondTable thirdTableViewController:thirdTable];
//assign CXLSlideList to window
self.window.rootViewController = cxlSlideListController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
表格的 dataSource 由您的文件实现,由 CXLSlideList 实现 delegate。
您只需要实现表格的 dataSource,但您应该在您的文件中添加观察者,当表格点击和滑动事件发送时。
//main tableView click & slide Notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CXLDidClickMainTableViewCellNotification object:nil];
//second tableivew click & slide Notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CXLDidClickMainTableViewCellNotification object:nil];
//Third tableview click Notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CXLDidClickSecondTableViewCellNotification object:nil];
这里是 CXLSlideList
提供的一些有用的类方法。
//Get Index
+(NSIndexPath *)getMainTableViewIndexPath;
+(NSIndexPath *)getSecondTableViewIndexPath;
+(NSIndexPath *)getThirdTableViewIndexPath;
//Set Gap
+(void)setMainTableToSecondTableGap:(CGFloat)gap;
+(void)setSecondTableToThirdTableGap:(CGFloat)gap;
详细的使用方法可以在 Example
中找到。
Ps
如果您有任何建议,请联系: [email protected]