Latest 1.0.1
Homepage https://github.com/gin17/CGCellContentViewManager
License MIT
Platforms ios 8.0, requires ARC
Authors

Doc

English Doc · 中文文档 · 相关博客


Overview

Overview.gif

Introduction

An elegant way to solve the problem while we’re clicking a UITableViewCell, the subview’s backgroundColor in the cell’s contentView’s changed unexpected.

A Common Solution

Disable the native cell’s selection style:


cell.selectionStyle = UITableViewCellSelectionStyleNone;

And then add a button to cover the cell’s contentView, to imitate the native selection style.

But it seems to be a little complex.

Try CGCellContentViewManager! It can keep you away from these unnecessary troubles

Usage

Just add the files in CGCellContentViewManager to your project, and needn’t for any setups,CGCellContentViewManager will work automatically.

All the subviews in the cell’s contentView will never change backgroundColor while we’re clicking the cell.

To disable the CGCellContentViewManager’s auto-work for a cell:


cell.cg_cellContentViewManagerDisabled = YES;

To disable the CGCellContentViewManager’s auto-work for a subview in cell’s contentView:


customSubview.cg_cellContentViewManagerDisabled = YES;

Compatibility

Both supports Objective – C and Swift

In a Swift project, the Objective – C Bridging Header may not be required.

CocoaPods

Use with CocoaPods


pod 'CGCellContentViewManager', '~> 1.0'

License

MIT

Latest podspec

{
    "name": "CGCellContentViewManager",
    "version": "1.0.1",
    "summary": "Manage cells' chaning backgroundColor behavior when being clicked.",
    "description": "An elegant way to solve the problem while we're clicking a UITableViewCell, the subviews in the cell's contentView's backgroundColor changed unexpected.",
    "homepage": "https://github.com/gin17/CGCellContentViewManager",
    "license": "MIT",
    "authors": {
        "Gin": "https://github.com/gin17"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/gin17/CGCellContentViewManager.git",
        "tag": "1.0.1"
    },
    "source_files": "CGCellContentViewManager/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This