# YFTableViewCell **Repository Path**: Dandre/YFTableViewCell ## Basic Information - **Project Name**: YFTableViewCell - **Description**: 支持TableViewCell滑动删除按钮 - **Primary Language**: Objective-C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 9 - **Forks**: 0 - **Created**: 2016-02-22 - **Last Updated**: 2025-07-23 ## Categories & Tags **Categories**: ios-modules **Tags**: None ## README # YFTableViewCell for Objective-C And Swift - version 1.1 [![Build Status](https://travis-ci.org/DandreYang/YFTableViewCell-OC.svg?branch=master)](https://travis-ci.org/DandreYang/YFTableViewCell-OC) [![Version](https://img.shields.io/cocoapods/v/YFTableViewCell-OC.svg?style=flat)](http://cocoapods.org/pods/YFTableViewCell-OC) [![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/DandreYang/YFTableViewCell-OC/master/LICENSE) [![Platform](https://img.shields.io/cocoapods/p/YFTableViewCell-OC.svg?style=flat)](http://cocoapods.org/pods/YFTableViewCell-OC) > 方便快捷地实现类似QQ的自定义侧滑删除效果,同时支持OC和Swift,集成简单快速,同时支持code和IB。 ## CocoaPods #### Objective-C版本 ```ruby pod 'YFTableViewCell-OC' ``` #### Swift版本 ```ruby pod 'YFTableViewCell-Swift' ``` ## 优点: - 1.按钮支持文字、图标、文字+图标 - 2.支持任一自定义按钮(UIButton或其子类) - 3.集成简单,继承于YFTableViewCell即可 - 4.同时支持code和IB创建cell - 5.同时支持OC和Swift ## 演示 ![演示动画 演示动画](./YFTableViewCell/YFTableViewCell.gif) ## 使用步骤: - 1.将你的tableViewCell继承于YFTableViewCell - 2.设置cell.delegate = self; - 3.设置cell.editButtonArray = array;(array为存有 __kindof UIButton 的数组) - 4.实现两个代理方法 - OC
```objc - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didClickedEditButtonAtButtonIndex:(NSInteger)buttonIndex atIndexPath:(NSIndexPath *)indexPath ``` - Swift ```swift func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) func tableView(_ tableView: UITableView, didClickedEditButtonAt buttonIndex: Int, At IndexPath:IndexPath) ``` ## version 1.1 更新内容 - 1.重构部分方法,使其兼容iOS11 - 2.支持Swift ## License YFTableViewCell is released under the MIT license. See [LICENSE](./LICENSE) for details.