• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 12 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Customize table view cell border and highlights

StyledTableViewCell for iOS

Customize table view cell border and highlight colors.
Only supports UITableViewStylePlain

Features

  • Custom highlight colors for table view cells
  • Highlights supports gradient of multiple colors and directions

Usage

  1. Subclass StyledTableViewCell

  2. Set UITableView separator to none to hide the default separator

    [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

  3. Use setDashWidth:dashGap:dashStroke: to configure custom cell separators

e.g. dashes for separators

[self setDashWidth:5 dashGap:3 dashStroke:1];

e.g. dotted-lines for separators

[self setDashWidth:1 dashGap:3 dashStroke:1];
  1. Set UITableView separator color to set the custom separator color

    [self.tableView setSeparatorColor:[UIColor colorWithWhite:0.7 alpha:1]];

  1. Use setStyledTableViewCellSelectionStyle: to set background colors of cell when selected, using preset colors

    [self setStyledTableViewCellSelectionStyle:StyledTableViewCellSelectionStylePurple];

  1. Use setSelectedBackgroundGradientColors: to set background colors of cell when selected, using custom gradients

e.g. gradient of 2 colors

NSMutableArray *colors = [NSMutableArray array];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:234/255.0 blue:0 alpha:1] CGColor]];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:174/255.0 blue:0 alpha:1] CGColor]];
[self setSelectedBackgroundViewGradientColors:colors];

e.g. gradient of 3 colors

NSMutableArray *colors = [NSMutableArray array];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:174/255.0 blue:0 alpha:1] CGColor]];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:234/255.0 blue:0 alpha:1] CGColor]];
[colors addObject:(id)[[UIColor colorWithRed:255/255.0 green:174/255.0 blue:0 alpha:1] CGColor]];
[self setSelectedBackgroundViewGradientColors:colors];

  1. Use setSelectionGradientDirection: to set direction of gradient when cell is selected

e.g. horizontal gradient

[self setSelectionGradientDirection:StyledTableViewCellSelectionGradientDirectionHorizontal];

e.g. diagonally from bottom left to top right

[self setSelectionGradientDirection:StyledTableViewCellSelectionGradientDirectionDiagonalBottomLeftToTopRight];

e.g. diagonally from top left to bottom right

[self setSelectionGradientDirection:StyledTableViewCellSelectionGradientDirectionDiagonalTopLeftToBottomRight];

Supports

Only supports UITableViewStylePlain.

Requirements

  • QuartzCore framework
  • This project uses ARC. If you are not using ARC in your project, add '-fobjc-arc' as a compiler flag for all the files in this project.
  • XCode 4.4 and newer (auto-synthesis required)

Contact

twitter.com/honcheng
honcheng.com

More Repositories

1

PaperFold-for-iOS

Paper folding animation for iOS
Objective-C
2,700
star
2

RTLabel

simple rich text display for iOS using html-like markups
Objective-C
1,462
star
3

iOSPlot

Chart library for iOS
Objective-C
1,371
star
4

iOS-StyledPageControl

Customizable PageControl for iOS
Objective-C
526
star
5

PaperFoldMenuController

A navigation menu on the left of the screen using on PaperFold
Objective-C
436
star
6

PaperFoldGallery

PaperFoldGallery for iOS
Objective-C
359
star
7

CATransform3D-Test

A test app to visualize view transformation when value in CATransform3D matrices change
Objective-C
349
star
8

PanelTableView

Multiple UITableViews in a UIScrollView
Objective-C
202
star
9

SliderPageControl-for-iOS

An alternative for UIPageControl
Objective-C
137
star
10

AcornCharts-for-iOS

Fun way to display charts using balls that responds to device tilting
Objective-C
113
star
11

ScrollableTabHost-for-Android

Java
90
star
12

iOS-nodechat

iOS chat client for socket.io & node.js backend
Objective-C
70
star
13

GAE-APIMonitor

Google AppEngine application that monitors server API
Python
25
star
14

GAEMobileAnalytics

Google AppEngine Analytics for Mobile Applications
Objective-C
17
star
15

CAMediaTimingFunctionVisualizer

iPad app to preview animation based on custom animation curve created
Objective-C
17
star
16

Singapore-Bus-Services

Singapore Bus Services
6
star
17

rfremote-fan-api

API to control RF fan using pilight in Raspberry Pi
Python
5
star
18

SubRip-Parser-for-iOS

Objective-C
5
star
19

homebridge-rfremote-fan

HomeBridge plugin to replace RF remote control for fans
JavaScript
3
star