LYSideslipCell 1.1.1

LYSideslipCell 1.1.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2017年2月

Joe-Liuyi 维护。



  • 作者:
  • louisly

模仿微信侧滑效果,兼容代码和 xib 创建,屏幕翻转。

首页消息 Cell

image

联系人 Cell

image

收藏 Cell

image

Podfile

支持 CocoaPods。只需在 Podfile 文件中加入一行代码

pod 'LYSideslipCell'

然后在终端中输入 pod install 即可

如何使用

1. 继承该类

@interface LYHomeCell : LYSideslipCell
@end

2. 在 tableView:cellForRowAtIndexPath: 方法中设置代理

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    LYHomeCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(LYSideslipCell.class)];
    if (!cell) {
        cell = [[LYHomeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass(LYSideslipCell.class)];
        cell.delegate = self;
    }
    return cell;
}

3. 实现 LYSideslipCellDelegate 协议的 sideslipCell:editActionsForRowAtIndexPath: 方法,返回侧滑按钮事件数组。

#pragma mark - LYSideslipCellDelegate
- (NSArray<LYSideslipCellAction *> *)sideslipCell:(LYSideslipCell *)sideslipCell editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
    LYSideslipCellAction *action = [LYSideslipCellAction rowActionWithStyle:LYSideslipCellActionStyleNormal title:@"备注" handler:^(LYSideslipCellAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        [sideslipCell hiddenAllSideslip];
    }];
    return @[action];
}

4. 更多细节请参考 demo