All Projects → Tinkoff → tcscustomrowactionfactory

Tinkoff / tcscustomrowactionfactory

Licence: Apache-2.0 License
TCSTableViewRowActionFactory allows you to setup the swipe actions for cells in a table view using UIView and some other convenient methods

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to tcscustomrowactionfactory

Wrcellview
自定义View,类似tableView的系统cell,使用方便 Custom View, similar to the tableView system cell, easy to use
Stars: ✭ 64 (+166.67%)
Mutual labels:  uitableviewcell, tableview, cell
Oycountdownmanager
在cell中使用倒计时的处理方法, 全局使用一个NSTimer对象, 支持单列表.多列表.多页面.分页列表使用
Stars: ✭ 317 (+1220.83%)
Mutual labels:  tableview, cell
Ynexpandablecell
✨ Awesome expandable, collapsible tableview cell for iOS written in Swift 4
Stars: ✭ 445 (+1754.17%)
Mutual labels:  tableview, cell
React Native Cell Components
Awesome react-native cell components! From a Cell to more complex & awesome components.
Stars: ✭ 177 (+637.5%)
Mutual labels:  tableview, cell
Aiforms.settingsview
SettingsView for Xamarin.Forms
Stars: ✭ 274 (+1041.67%)
Mutual labels:  tableview, cell
Uitableviewdynamiclayoutcacheheight
🖖高性能的自动计算采用 Autolayout 布局的 UITableViewCell 和 UITableViewHeaderFooterView 的高度,内部自动管理高度缓存。
Stars: ✭ 360 (+1400%)
Mutual labels:  uitableviewcell, cell
Jhform
JhForm - 自定义表单工具,更加简单,快捷的创建表单、设置页面
Stars: ✭ 108 (+350%)
Mutual labels:  tableview, cell
Multiple-collectionView-in-Multiple-tableView-cells
UICollectionView is embed in UITableViewCell. The collection views are horizontal scrollable. The UITableView can have a section title for each UICollectionView and the number of UICollectionView is equal to the number of sections.
Stars: ✭ 23 (-4.17%)
Mutual labels:  uitableviewcell, cell
Tdbadgedcell
TDBadgedCell is a table view cell class that adds a badge, similar to the badges in Apple's own apps
Stars: ✭ 1,444 (+5916.67%)
Mutual labels:  uitableviewcell, tableview
Swipecellkit
A swipeable UITableViewCell or UICollectionViewCell with support for:
Stars: ✭ 5,745 (+23837.5%)
Mutual labels:  uitableviewcell, tableview
Expandabletable
AZExpandable is a lightweight proxy for UITableView to expand cells.
Stars: ✭ 218 (+808.33%)
Mutual labels:  uitableviewcell, cell
UnityTableView
Plugin for Unity 5.6 that implements a Table with an API inspired by Apple's UITableView
Stars: ✭ 27 (+12.5%)
Mutual labels:  uitableviewcell, tableview
Python-MongoDB-Example
A Live working Example Application of Python, Qt, PySide2, MongoDB, PyMongo, QTreeView, QAbstractTableModel
Stars: ✭ 41 (+70.83%)
Mutual labels:  tableview
TableViewKit
Empowering UITableView with painless multi-type cell support and built-in automatic state transition animations
Stars: ✭ 105 (+337.5%)
Mutual labels:  uitableviewcell
StaticPage
静态页面大杀器 ------三行代码搞定常用静态页面
Stars: ✭ 40 (+66.67%)
Mutual labels:  tableview
YYBottomSheet
Simple and Clear BottomSheet
Stars: ✭ 45 (+87.5%)
Mutual labels:  tableview
android-tableview-kotlin
Android's missing TableView component.
Stars: ✭ 40 (+66.67%)
Mutual labels:  tableview
bem-sdk
BEM SDK packages
Stars: ✭ 83 (+245.83%)
Mutual labels:  cell
qcell
Statically-checked alternatives to RefCell and RwLock
Stars: ✭ 265 (+1004.17%)
Mutual labels:  cell
MapTable-Swift
Mimic Find My Friends first screen behavior
Stars: ✭ 69 (+187.5%)
Mutual labels:  tableview

TCSCustomRowActionFactory

Version License Platform

TCSCustomRowActionFactory allows you to setup the swipe actions for cells in a table view in any way using UIView and other convenient methods (see the article explaining this on Habrahabr)

picture

Usage and examples

TCSCustomRowActionFactory is primarily designed to simplify the standard UITableViewRowAction configuration (due to the many restrictions it imposes), also supporting the new ContextualAction (iOS 11 and above). All you need to do to implement TCSCustomRowActionFactory, create a TCSCustomRowActionFactory instance in the table delegate method, configure it with our custom view and return the required object (.rowAction () or .contextualAction(for: indexPath) depending on the table delegate method)

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
    guard let cell = tableView.cellForRow(at: indexPath) else { return nil }
    
    var rowActions: [UITableViewRowAction] = []
    
    let rowActionFactory = TCSCustomRowActionFactory { indexPath in
        tableView.setEditing(false, animated: true)
    }
    let rowActionView = <...> // create row action view
    rowActionView.backgroundColor = .green
    rowActionFactory.setupForCell(with: rowActionView)
    
    if let rowAction = rowActionFactory.rowAction() {
        rowActions.append(rowAction)
    }
    
    return rowActions
}

Methods

There are some methods to setup TCSCustomRowActionFactory:

func setupForCell(with view: UIView)
func setupForCell(withImage image: UIImage, size: CGSize, backgroundColor: UIColor = .white) 
func setupForCell(withImage image: UIImage, size: CGSize, backgroundColor: UIColor = .white, contentInsets: UIEdgeInsets = .zero)
func setupForCell(withImage image: UIImage, size: CGSize, backgroundColor: UIColor = .white, contentInsets: UIEdgeInsets = .zero, isScaleProportionally: Bool = true)
func setupForCell(withTitle title: String, image: UIImage, size: CGSize, backgroundColor: UIColor, titleAttributes: [NSAttributedStringKey : Any]? = nil, contentInsets: UIEdgeInsets? = nil)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

TCSCustomRowActionFactory is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TCSCustomRowActionFactory'

Contribution

Sure :) please send a pull-request or raise an issue. It is always good to know how to make things better, yay!

Author

Alexander Trushin, [email protected]

License

TCSCustomRowActionFactory is available under the Apache License, Version 2.0. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].