一个轻量级且易于使用的带有滑动效果的 tableview。
Xcode 6 或更高版本
Apple LLVM 编译器
iOS 7.0 或更高版本
ARC
示例文件夹中有示例。
如果尚未安装,请安装 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
中创建视图控制器,并分配给 table view 控制器。
//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];
TableView 的数据源由您的文件实现,委托由 CXLSlideList 实现。
您只需实现 tableview 的数据源,但是您需要在您的文件中添加观察者,当 tableview 的点击和滑动事件通知发布时。
//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
中找到
提示
如果您有任何建议,请联系: [email protected]