Repository: CEWendel/SWTableViewCell
Branch: master
Commit: a8a20f833c73
Files: 34
Total size: 118.4 KB
Directory structure:
gitextract_ipcmtiyk/
├── .gitignore
├── .slather.yml
├── .travis.yml
├── LICENCE
├── Podfile
├── README.md
├── SWTableViewCell/
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── PodFiles/
│ │ ├── NSMutableArray+SWUtilityButtons.h
│ │ ├── NSMutableArray+SWUtilityButtons.m
│ │ ├── SWCellScrollView.h
│ │ ├── SWCellScrollView.m
│ │ ├── SWLongPressGestureRecognizer.h
│ │ ├── SWLongPressGestureRecognizer.m
│ │ ├── SWTableViewCell.h
│ │ ├── SWTableViewCell.m
│ │ ├── SWUtilityButtonTapGestureRecognizer.h
│ │ ├── SWUtilityButtonTapGestureRecognizer.m
│ │ ├── SWUtilityButtonView.h
│ │ └── SWUtilityButtonView.m
│ ├── SWTableViewCell-Info.plist
│ ├── SWTableViewCell-Prefix.pch
│ ├── UMTableViewCell.h
│ ├── UMTableViewCell.m
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── en.lproj/
│ │ ├── InfoPlist.strings
│ │ └── MainStoryboard.storyboard
│ └── main.m
├── SWTableViewCell.podspec
├── SWTableViewCell.xcodeproj/
│ ├── project.pbxproj
│ └── xcshareddata/
│ └── xcschemes/
│ └── SWTableViewCell.xcscheme
└── SWTableViewCellTests/
├── Info.plist
└── SWTableViewCellTests.m
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.DS_Store
build/*
*.pbxuser
*.xcworkspace
xcuserdata
profile
*.moved-aside
xcuserdata/
project.xcworkspace/
Podfile.lock
Pods
================================================
FILE: .slather.yml
================================================
ci_service: travis_ci
coverage_service: coveralls
xcodeproj: SWTableViewCell.xcodeproj
source_directory: SWTableViewCell/PodFiles
================================================
FILE: .travis.yml
================================================
language: objective-c
cache: cocoapods
xcode_workspace: SWTableViewCell.xcworkspace
xcode_scheme: SWTableViewCell
xcode_sdk: iphonesimulator
before_install:
- gem install cocoapods slather -N
after_success: slather
================================================
FILE: LICENCE
================================================
Copyright (c) 2013 Christopher Wendel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: Podfile
================================================
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
target 'SWTableViewCell' do
end
target 'SWTableViewCellTests' do
pod 'FBSnapshotTestCase'
pod 'Expecta+Snapshots'
pod 'Specta'
pod 'Expecta'
pod 'OCMock'
end
================================================
FILE: README.md
================================================
SWTableViewCell
===============
[](https://travis-ci.org/addoshi/SWTableViewCell)
[](https://coveralls.io/r/addoshi/SWTableViewCell)
<p align="center"><img src="http://i.imgur.com/njKCjK8.gif"/></p>
An easy-to-use UITableViewCell subclass that implements a swipeable content view which exposes utility buttons (similar to iOS 7 Mail Application)
##Usage
In your Podfile:
<pre>pod 'SWTableViewCell', '~> 0.3.7'</pre>
Or just clone this repo and manually add source to project
##Functionality
###Right Utility Buttons
Utility buttons that become visible on the right side of the Table View Cell when the user swipes left. This behavior is similar to that seen in the iOS apps Mail and Reminders.
<p align="center"><img src="http://i.imgur.com/gDZFRpr.gif"/></p>
###Left Utility Buttons
Utility buttons that become visible on the left side of the Table View Cell when the user swipes right.
<p align="center"><img src="http://i.imgur.com/qt6aISz.gif"/></p>
###Features
* Dynamic utility button scalling. As you add more buttons to a cell, the other buttons on that side get smaller to make room
* Smart selection: The cell will pick up touch events and either scroll the cell back to center or fire the delegate method `- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath`
<p align="center"><img src="http://i.imgur.com/TYGx9h8.gif"/></p>
So the cell will not be considered selected when the user touches the cell while utility buttons are visible, instead the cell will slide back into place (same as iOS 7 Mail App functionality)
* Create utilty buttons with either a title or an icon along with a RGB color
* Tested on iOS 6.1 and above, including iOS 7
##Usage
###Standard Table View Cells
In your `tableView:cellForRowAtIndexPath:` method you set up the SWTableView cell and add an arbitrary amount of utility buttons to it using the included `NSMutableArray+SWUtilityButtons` category.
```objc
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"Cell";
SWTableViewCell *cell = (SWTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
cell.leftUtilityButtons = [self leftButtons];
cell.rightUtilityButtons = [self rightButtons];
cell.delegate = self;
}
NSDate *dateObject = _testArray[indexPath.row];
cell.textLabel.text = [dateObject description];
cell.detailTextLabel.text = @"Some detail text";
return cell;
}
- (NSArray *)rightButtons
{
NSMutableArray *rightUtilityButtons = [NSMutableArray new];
[rightUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.78f green:0.78f blue:0.8f alpha:1.0]
title:@"More"];
[rightUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188 alpha:1.0f]
title:@"Delete"];
return rightUtilityButtons;
}
- (NSArray *)leftButtons
{
NSMutableArray *leftUtilityButtons = [NSMutableArray new];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.07 green:0.75f blue:0.16f alpha:1.0]
icon:[UIImage imageNamed:@"check.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:1.0f blue:0.35f alpha:1.0]
icon:[UIImage imageNamed:@"clock.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188f alpha:1.0]
icon:[UIImage imageNamed:@"cross.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.55f green:0.27f blue:0.07f alpha:1.0]
icon:[UIImage imageNamed:@"list.png"]];
return leftUtilityButtons;
}
```
###Custom Table View Cells
Thanks to [Matt Bowman](https://github.com/MattCBowman) you can now create custom table view cells using Interface Builder that have the capabilities of an SWTableViewCell
The first step is to design your cell either in a standalone nib or inside of a
table view using prototype cells. Make sure to set the custom class on the
cell in interface builder to the subclass you made for it:
<p align="center"><img src="http://i.imgur.com/mfrT1Ex.png"/></p>
Then set the cell reuse identifier:
<p align="center"><img src="http://i.imgur.com/dlmArZ1.png"/></p>
When writing your custom table view cell's code, make sure your cell is a
subclass of SWTableViewCell:
```objc
#import <SWTableViewCell.h>
@interface MyCustomTableViewCell : SWTableViewCell
@property (weak, nonatomic) UILabel *customLabel;
@property (weak, nonatomic) UIImageView *customImageView;
@end
```
If you are using a separate nib and not a prototype cell, you'll need to be sure to register the nib in your table view:
```objc
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:@"MyCustomTableViewCellNibFileName" bundle:nil] forCellReuseIdentifier:@"MyCustomCell"];
}
```
Then, in the `tableView:cellForRowAtIndexPath:` method of your `UITableViewDataSource` (usually your view controller), initialize your custom cell:
```objc
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
static NSString *cellIdentifier = @"MyCustomCell";
MyCustomTableViewCell *cell = (MyCustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier
forIndexPath:indexPath];
cell.leftUtilityButtons = [self leftButtons];
cell.rightUtilityButtons = [self rightButtons];
cell.delegate = self;
cell.customLabel.text = @"Some Text";
cell.customImageView.image = [UIImage imageNamed:@"MyAwesomeTableCellImage"];
[cell setCellHeight:cell.frame.size.height];
return cell;
}
```
###Delegate
The delegate `SWTableViewCellDelegate` is used by the developer to find out which button was pressed. There are five methods:
```objc
// click event on left utility button
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index;
// click event on right utility button
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index;
// utility button open/close event
- (void)swipeableTableViewCell:(SWTableViewCell *)cell scrollingToState:(SWCellState)state;
// prevent multiple cells from showing utilty buttons simultaneously
- (BOOL)swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:(SWTableViewCell *)cell;
// prevent cell(s) from displaying left/right utility buttons
- (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state;
```
The index signifies which utility button the user pressed, for each side the button indices are ordered from right to left 0...n
####Example
```objc
#pragma mark - SWTableViewDelegate
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index {
switch (index) {
case 0:
NSLog(@"check button was pressed");
break;
case 1:
NSLog(@"clock button was pressed");
break;
case 2:
NSLog(@"cross button was pressed");
break;
case 3:
NSLog(@"list button was pressed");
default:
break;
}
}
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index {
switch (index) {
case 0:
NSLog(@"More button was pressed");
break;
case 1:
{
// Delete button was pressed
NSIndexPath *cellIndexPath = [self.tableView indexPathForCell:cell];
[_testArray removeObjectAtIndex:cellIndexPath.row];
[self.tableView deleteRowsAtIndexPaths:@[cellIndexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
break;
}
default:
break;
}
}
```
(This is all code from the included example project)
###Gotchas
#### Seperator Insets
* If you have left utility button on iOS 7, I recommend changing your Table View's seperatorInset so the seperator stretches the length of the screen
<pre> tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); </pre>
##Contributing
Use [Github issues](https://github.com/cewendel/SWTableViewCell/issues) to track bugs and feature requests.
##Contact
Chris Wendel
- http://twitter.com/CEWendel
## Licence
MIT
================================================
FILE: SWTableViewCell/AppDelegate.h
================================================
//
// AppDelegate.h
// SWTableViewCell
//
// Created by Chris Wendel on 9/10/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
================================================
FILE: SWTableViewCell/AppDelegate.m
================================================
//
// AppDelegate.m
// SWTableViewCell
//
// Created by Chris Wendel on 9/10/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
================================================
FILE: SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.h
================================================
//
// NSMutableArray+SWUtilityButtons.h
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSMutableArray (SWUtilityButtons)
- (void)sw_addUtilityButtonWithColor:(UIColor *)color title:(NSString *)title;
- (void)sw_addUtilityButtonWithColor:(UIColor *)color attributedTitle:(NSAttributedString *)title;
- (void)sw_addUtilityButtonWithColor:(UIColor *)color icon:(UIImage *)icon;
- (void)sw_addUtilityButtonWithColor:(UIColor *)color normalIcon:(UIImage *)normalIcon selectedIcon:(UIImage *)selectedIcon;
@end
@interface NSArray (SWUtilityButtons)
- (BOOL)sw_isEqualToButtons:(NSArray *)buttons;
@end
================================================
FILE: SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.m
================================================
//
// NSMutableArray+SWUtilityButtons.m
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "NSMutableArray+SWUtilityButtons.h"
@implementation NSMutableArray (SWUtilityButtons)
- (void)sw_addUtilityButtonWithColor:(UIColor *)color title:(NSString *)title
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.backgroundColor = color;
[button setTitle:title forState:UIControlStateNormal];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[button.titleLabel setAdjustsFontSizeToFitWidth:YES];
[self addObject:button];
}
- (void)sw_addUtilityButtonWithColor:(UIColor *)color attributedTitle:(NSAttributedString *)title
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.backgroundColor = color;
[button setAttributedTitle:title forState:UIControlStateNormal];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self addObject:button];
}
- (void)sw_addUtilityButtonWithColor:(UIColor *)color icon:(UIImage *)icon
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.backgroundColor = color;
[button setImage:icon forState:UIControlStateNormal];
[self addObject:button];
}
- (void)sw_addUtilityButtonWithColor:(UIColor *)color normalIcon:(UIImage *)normalIcon selectedIcon:(UIImage *)selectedIcon {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.backgroundColor = color;
[button setImage:normalIcon forState:UIControlStateNormal];
[button setImage:selectedIcon forState:UIControlStateHighlighted];
[button setImage:selectedIcon forState:UIControlStateSelected];
[self addObject:button];
}
@end
@implementation NSArray (SWUtilityButtons)
- (BOOL)sw_isEqualToButtons:(NSArray *)buttons
{
buttons = [buttons copy];
if (!buttons || self.count != buttons.count) return NO;
for (NSUInteger idx = 0; idx < self.count; idx++) {
id buttonA = self[idx];
id buttonB = buttons[idx];
if (![buttonA isKindOfClass:[UIButton class]] || ![buttonB isKindOfClass:[UIButton class]]) return NO;
if (![[self class] sw_button:buttonA isEqualToButton:buttonB]) return NO;
}
return YES;
}
+ (BOOL)sw_button:(UIButton *)buttonA isEqualToButton:(UIButton *)buttonB
{
if (!buttonA || !buttonB) return NO;
UIColor *backgroundColorA = buttonA.backgroundColor;
UIColor *backgroundColorB = buttonB.backgroundColor;
BOOL haveEqualBackgroundColors = (!backgroundColorA && !backgroundColorB) || [backgroundColorA isEqual:backgroundColorB];
NSString *titleA = [buttonA titleForState:UIControlStateNormal];
NSString *titleB = [buttonB titleForState:UIControlStateNormal];
BOOL haveEqualTitles = (!titleA && !titleB) || [titleA isEqualToString:titleB];
UIImage *normalIconA = [buttonA imageForState:UIControlStateNormal];
UIImage *normalIconB = [buttonB imageForState:UIControlStateNormal];
BOOL haveEqualNormalIcons = (!normalIconA && !normalIconB) || [normalIconA isEqual:normalIconB];
UIImage *selectedIconA = [buttonA imageForState:UIControlStateSelected];
UIImage *selectedIconB = [buttonB imageForState:UIControlStateSelected];
BOOL haveEqualSelectedIcons = (!selectedIconA && !selectedIconB) || [selectedIconA isEqual:selectedIconB];
return haveEqualBackgroundColors && haveEqualTitles && haveEqualNormalIcons && haveEqualSelectedIcons;
}
@end
================================================
FILE: SWTableViewCell/PodFiles/SWCellScrollView.h
================================================
//
// SWCellScrollView.h
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SWCellScrollView : UIScrollView <UIGestureRecognizerDelegate>
@end
================================================
FILE: SWTableViewCell/PodFiles/SWCellScrollView.m
================================================
//
// SWCellScrollView.m
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "SWCellScrollView.h"
@implementation SWCellScrollView
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer == self.panGestureRecognizer) {
CGPoint translation = [(UIPanGestureRecognizer*)gestureRecognizer translationInView:gestureRecognizer.view];
return fabs(translation.y) <= fabs(translation.x);
} else {
return YES;
}
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
// Find out if the user is actively scrolling the tableView of which this is a member.
// If they are, return NO, and don't let the gesture recognizers work simultaneously.
//
// This works very well in maintaining user expectations while still allowing for the user to
// scroll the cell sideways when that is their true intent.
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
// Find the current scrolling velocity in that view, in the Y direction.
CGFloat yVelocity = [(UIPanGestureRecognizer*)gestureRecognizer velocityInView:gestureRecognizer.view].y;
// Return YES iff the user is not actively scrolling up.
return fabs(yVelocity) <= 0.25;
}
return YES;
}
@end
================================================
FILE: SWTableViewCell/PodFiles/SWLongPressGestureRecognizer.h
================================================
//
// SWLongPressGestureRecognizer.h
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <UIKit/UIGestureRecognizerSubclass.h>
@interface SWLongPressGestureRecognizer : UILongPressGestureRecognizer
@end
================================================
FILE: SWTableViewCell/PodFiles/SWLongPressGestureRecognizer.m
================================================
//
// SWLongPressGestureRecognizer.m
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "SWLongPressGestureRecognizer.h"
@implementation SWLongPressGestureRecognizer
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
self.state = UIGestureRecognizerStateFailed;
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
self.state = UIGestureRecognizerStateFailed;
}
@end
================================================
FILE: SWTableViewCell/PodFiles/SWTableViewCell.h
================================================
//
// SWTableViewCell.h
// SWTableViewCell
//
// Created by Chris Wendel on 9/10/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <UIKit/UIGestureRecognizerSubclass.h>
#import "SWCellScrollView.h"
#import "SWLongPressGestureRecognizer.h"
#import "SWUtilityButtonTapGestureRecognizer.h"
#import "NSMutableArray+SWUtilityButtons.h"
@class SWTableViewCell;
typedef NS_ENUM(NSInteger, SWCellState)
{
kCellStateCenter,
kCellStateLeft,
kCellStateRight,
};
@protocol SWTableViewCellDelegate <NSObject>
@optional
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index;
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index;
- (void)swipeableTableViewCell:(SWTableViewCell *)cell scrollingToState:(SWCellState)state;
- (BOOL)swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:(SWTableViewCell *)cell;
- (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state;
- (void)swipeableTableViewCellDidEndScrolling:(SWTableViewCell *)cell;
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didScroll:(UIScrollView *)scrollView;
@end
@interface SWTableViewCell : UITableViewCell
@property (nonatomic, copy) NSArray *leftUtilityButtons;
@property (nonatomic, copy) NSArray *rightUtilityButtons;
@property (nonatomic, weak) id <SWTableViewCellDelegate> delegate;
- (void)setRightUtilityButtons:(NSArray *)rightUtilityButtons WithButtonWidth:(CGFloat) width;
- (void)setLeftUtilityButtons:(NSArray *)leftUtilityButtons WithButtonWidth:(CGFloat) width;
- (void)hideUtilityButtonsAnimated:(BOOL)animated;
- (void)showLeftUtilityButtonsAnimated:(BOOL)animated;
- (void)showRightUtilityButtonsAnimated:(BOOL)animated;
- (BOOL)isUtilityButtonsHidden;
@end
================================================
FILE: SWTableViewCell/PodFiles/SWTableViewCell.m
================================================
//
// SWTableViewCell.m
// SWTableViewCell
//
// Created by Chris Wendel on 9/10/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "SWTableViewCell.h"
#import "SWUtilityButtonView.h"
static NSString * const kTableViewCellContentView = @"UITableViewCellContentView";
#define kSectionIndexWidth 15
#define kAccessoryTrailingSpace 15
#define kLongPressMinimumDuration 0.16f
@interface SWTableViewCell () <UIScrollViewDelegate, UIGestureRecognizerDelegate>
@property (nonatomic, weak) UITableView *containingTableView;
@property (nonatomic, strong) UIPanGestureRecognizer *tableViewPanGestureRecognizer;
@property (nonatomic, assign) SWCellState cellState; // The state of the cell within the scroll view, can be left, right or middle
@property (nonatomic, assign) CGFloat additionalRightPadding;
@property (nonatomic, strong) UIScrollView *cellScrollView;
@property (nonatomic, strong) SWUtilityButtonView *leftUtilityButtonsView, *rightUtilityButtonsView;
@property (nonatomic, strong) UIView *leftUtilityClipView, *rightUtilityClipView;
@property (nonatomic, strong) NSLayoutConstraint *leftUtilityClipConstraint, *rightUtilityClipConstraint;
@property (nonatomic, strong) UILongPressGestureRecognizer *longPressGestureRecognizer;
@property (nonatomic, strong) UITapGestureRecognizer *tapGestureRecognizer;
- (CGFloat)leftUtilityButtonsWidth;
- (CGFloat)rightUtilityButtonsWidth;
- (CGFloat)utilityButtonsPadding;
- (CGPoint)contentOffsetForCellState:(SWCellState)state;
- (void)updateCellState;
- (BOOL)shouldHighlight;
@end
@implementation SWTableViewCell {
UIView *_contentCellView;
BOOL layoutUpdating;
}
#pragma mark Initializers
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
[self initializer];
}
return self;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self)
{
[self initializer];
}
return self;
}
- (void)initializer
{
layoutUpdating = NO;
// Set up scroll view that will host our cell content
self.cellScrollView = [[SWCellScrollView alloc] init];
self.cellScrollView.translatesAutoresizingMaskIntoConstraints = NO;
self.cellScrollView.delegate = self;
self.cellScrollView.showsHorizontalScrollIndicator = NO;
self.cellScrollView.scrollsToTop = NO;
self.cellScrollView.scrollEnabled = YES;
_contentCellView = [[UIView alloc] init];
[self.cellScrollView addSubview:_contentCellView];
// Add the cell scroll view to the cell
UIView *contentViewParent = self;
UIView *clipViewParent = self.cellScrollView;
if (![NSStringFromClass([[self.subviews objectAtIndex:0] class]) isEqualToString:kTableViewCellContentView])
{
// iOS 7
contentViewParent = [self.subviews objectAtIndex:0];
clipViewParent = self;
}
NSArray *cellSubviews = [contentViewParent subviews];
[self insertSubview:self.cellScrollView atIndex:0];
for (UIView *subview in cellSubviews)
{
[_contentCellView addSubview:subview];
}
// Set scroll view to perpetually have same frame as self. Specifying relative to superview doesn't work, since the latter UITableViewCellScrollView has different behaviour.
[self addConstraints:@[
[NSLayoutConstraint constraintWithItem:self.cellScrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:self.cellScrollView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:self.cellScrollView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:self.cellScrollView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0],
]];
self.tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewTapped:)];
self.tapGestureRecognizer.cancelsTouchesInView = NO;
self.tapGestureRecognizer.delegate = self;
[self.cellScrollView addGestureRecognizer:self.tapGestureRecognizer];
self.longPressGestureRecognizer = [[SWLongPressGestureRecognizer alloc] initWithTarget:self action:@selector(scrollViewPressed:)];
self.longPressGestureRecognizer.cancelsTouchesInView = NO;
self.longPressGestureRecognizer.minimumPressDuration = kLongPressMinimumDuration;
self.longPressGestureRecognizer.delegate = self;
[self.cellScrollView addGestureRecognizer:self.longPressGestureRecognizer];
// Create the left and right utility button views, as well as vanilla UIViews in which to embed them. We can manipulate the latter in order to effect clipping according to scroll position.
// Such an approach is necessary in order for the utility views to sit on top to get taps, as well as allow the backgroundColor (and private UITableViewCellBackgroundView) to work properly.
self.leftUtilityClipView = [[UIView alloc] init];
self.leftUtilityClipConstraint = [NSLayoutConstraint constraintWithItem:self.leftUtilityClipView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0];
self.leftUtilityButtonsView = [[SWUtilityButtonView alloc] initWithUtilityButtons:nil
parentCell:self
utilityButtonSelector:@selector(leftUtilityButtonHandler:)];
self.rightUtilityClipView = [[UIView alloc] initWithFrame:self.bounds];
self.rightUtilityClipConstraint = [NSLayoutConstraint constraintWithItem:self.rightUtilityClipView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0];
self.rightUtilityButtonsView = [[SWUtilityButtonView alloc] initWithUtilityButtons:nil
parentCell:self
utilityButtonSelector:@selector(rightUtilityButtonHandler:)];
UIView *clipViews[] = { self.rightUtilityClipView, self.leftUtilityClipView };
NSLayoutConstraint *clipConstraints[] = { self.rightUtilityClipConstraint, self.leftUtilityClipConstraint };
UIView *buttonViews[] = { self.rightUtilityButtonsView, self.leftUtilityButtonsView };
NSLayoutAttribute alignmentAttributes[] = { NSLayoutAttributeRight, NSLayoutAttributeLeft };
for (NSUInteger i = 0; i < 2; ++i)
{
UIView *clipView = clipViews[i];
NSLayoutConstraint *clipConstraint = clipConstraints[i];
UIView *buttonView = buttonViews[i];
NSLayoutAttribute alignmentAttribute = alignmentAttributes[i];
clipConstraint.priority = UILayoutPriorityDefaultHigh;
clipView.translatesAutoresizingMaskIntoConstraints = NO;
clipView.clipsToBounds = YES;
[clipViewParent addSubview:clipView];
[self addConstraints:@[
// Pin the clipping view to the appropriate outer edges of the cell.
[NSLayoutConstraint constraintWithItem:clipView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:clipView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:clipView attribute:alignmentAttribute relatedBy:NSLayoutRelationEqual toItem:self attribute:alignmentAttribute multiplier:1.0 constant:0.0],
clipConstraint,
]];
[clipView addSubview:buttonView];
[self addConstraints:@[
// Pin the button view to the appropriate outer edges of its clipping view.
[NSLayoutConstraint constraintWithItem:buttonView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:clipView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:buttonView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:clipView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:buttonView attribute:alignmentAttribute relatedBy:NSLayoutRelationEqual toItem:clipView attribute:alignmentAttribute multiplier:1.0 constant:0.0],
// Constrain the maximum button width so that at least a button's worth of contentView is left visible. (The button view will shrink accordingly.)
[NSLayoutConstraint constraintWithItem:buttonView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationLessThanOrEqual toItem:self.contentView attribute:NSLayoutAttributeWidth multiplier:1.0 constant:-kUtilityButtonWidthDefault],
]];
}
}
static NSString * const kTableViewPanState = @"state";
- (void)removeOldTableViewPanObserver
{
[_tableViewPanGestureRecognizer removeObserver:self forKeyPath:kTableViewPanState];
}
- (void)dealloc
{
_cellScrollView.delegate = nil;
[self removeOldTableViewPanObserver];
}
- (void)setContainingTableView:(UITableView *)containingTableView
{
[self removeOldTableViewPanObserver];
_tableViewPanGestureRecognizer = containingTableView.panGestureRecognizer;
_containingTableView = containingTableView;
if (containingTableView)
{
// Check if the UITableView will display Indices on the right. If that's the case, add a padding
if ([_containingTableView.dataSource respondsToSelector:@selector(sectionIndexTitlesForTableView:)])
{
NSArray *indices = [_containingTableView.dataSource sectionIndexTitlesForTableView:_containingTableView];
self.additionalRightPadding = indices == nil ? 0 : kSectionIndexWidth;
}
_containingTableView.directionalLockEnabled = YES;
[self.tapGestureRecognizer requireGestureRecognizerToFail:_containingTableView.panGestureRecognizer];
[_tableViewPanGestureRecognizer addObserver:self forKeyPath:kTableViewPanState options:0 context:nil];
}
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if([keyPath isEqualToString:kTableViewPanState] && object == _tableViewPanGestureRecognizer)
{
if(_tableViewPanGestureRecognizer.state == UIGestureRecognizerStateBegan)
{
CGPoint locationInTableView = [_tableViewPanGestureRecognizer locationInView:_containingTableView];
BOOL inCurrentCell = CGRectContainsPoint(self.frame, locationInTableView);
if(!inCurrentCell && _cellState != kCellStateCenter)
{
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:)])
{
if([self.delegate swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:self])
{
[self hideUtilityButtonsAnimated:YES];
}
}
}
}
}
}
- (void)setLeftUtilityButtons:(NSArray *)leftUtilityButtons
{
if (![_leftUtilityButtons sw_isEqualToButtons:leftUtilityButtons]) {
_leftUtilityButtons = leftUtilityButtons;
self.leftUtilityButtonsView.utilityButtons = leftUtilityButtons;
[self.leftUtilityButtonsView layoutIfNeeded];
[self layoutIfNeeded];
}
}
- (void)setLeftUtilityButtons:(NSArray *)leftUtilityButtons WithButtonWidth:(CGFloat) width
{
_leftUtilityButtons = leftUtilityButtons;
[self.leftUtilityButtonsView setUtilityButtons:leftUtilityButtons WithButtonWidth:width];
[self.leftUtilityButtonsView layoutIfNeeded];
[self layoutIfNeeded];
}
- (void)setRightUtilityButtons:(NSArray *)rightUtilityButtons
{
if (![_rightUtilityButtons sw_isEqualToButtons:rightUtilityButtons]) {
_rightUtilityButtons = rightUtilityButtons;
self.rightUtilityButtonsView.utilityButtons = rightUtilityButtons;
[self.rightUtilityButtonsView layoutIfNeeded];
[self layoutIfNeeded];
}
}
- (void)setRightUtilityButtons:(NSArray *)rightUtilityButtons WithButtonWidth:(CGFloat) width
{
_rightUtilityButtons = rightUtilityButtons;
[self.rightUtilityButtonsView setUtilityButtons:rightUtilityButtons WithButtonWidth:width];
[self.rightUtilityButtonsView layoutIfNeeded];
[self layoutIfNeeded];
}
#pragma mark - UITableViewCell overrides
- (void)didMoveToSuperview
{
self.containingTableView = nil;
UIView *view = self.superview;
do {
if ([view isKindOfClass:[UITableView class]])
{
self.containingTableView = (UITableView *)view;
break;
}
} while ((view = view.superview));
}
- (void)layoutSubviews
{
[super layoutSubviews];
// Offset the contentView origin so that it appears correctly w/rt the enclosing scroll view (to which we moved it).
CGRect frame = self.contentView.frame;
frame.origin.x = [self leftUtilityButtonsWidth];
_contentCellView.frame = frame;
self.cellScrollView.contentSize = CGSizeMake(CGRectGetWidth(self.frame) + [self utilityButtonsPadding], CGRectGetHeight(self.frame));
if (!self.cellScrollView.isTracking && !self.cellScrollView.isDecelerating)
{
self.cellScrollView.contentOffset = [self contentOffsetForCellState:_cellState];
}
[self updateCellState];
}
- (void)setFrame:(CGRect)frame
{
layoutUpdating = YES;
// Fix for new screen sizes
// Initially, the cell is still 320 points wide
// We need to layout our subviews again when this changes so our constraints clip to the right width
BOOL widthChanged = (self.frame.size.width != frame.size.width);
[super setFrame:frame];
if (widthChanged)
{
[self layoutIfNeeded];
}
layoutUpdating = NO;
}
- (void)prepareForReuse
{
[super prepareForReuse];
[self hideUtilityButtonsAnimated:NO];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
// Work around stupid background-destroying override magic that UITableView seems to perform on contained buttons.
[self.leftUtilityButtonsView pushBackgroundColors];
[self.rightUtilityButtonsView pushBackgroundColors];
[super setSelected:selected animated:animated];
[self.leftUtilityButtonsView popBackgroundColors];
[self.rightUtilityButtonsView popBackgroundColors];
}
- (void)didTransitionToState:(UITableViewCellStateMask)state {
[super didTransitionToState:state];
if (state == UITableViewCellStateDefaultMask) {
[self layoutSubviews];
}
}
#pragma mark - Selection handling
- (BOOL)shouldHighlight
{
BOOL shouldHighlight = YES;
if ([self.containingTableView.delegate respondsToSelector:@selector(tableView:shouldHighlightRowAtIndexPath:)])
{
NSIndexPath *cellIndexPath = [self.containingTableView indexPathForCell:self];
shouldHighlight = [self.containingTableView.delegate tableView:self.containingTableView shouldHighlightRowAtIndexPath:cellIndexPath];
}
return shouldHighlight;
}
- (void)scrollViewPressed:(UIGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateBegan && !self.isHighlighted && self.shouldHighlight)
{
[self setHighlighted:YES animated:NO];
}
else if (gestureRecognizer.state == UIGestureRecognizerStateEnded)
{
// Cell is already highlighted; clearing it temporarily seems to address visual anomaly.
[self setHighlighted:NO animated:NO];
[self scrollViewTapped:gestureRecognizer];
}
else if (gestureRecognizer.state == UIGestureRecognizerStateCancelled)
{
[self setHighlighted:NO animated:NO];
}
}
- (void)scrollViewTapped:(UIGestureRecognizer *)gestureRecognizer
{
if (_cellState == kCellStateCenter)
{
if (self.isSelected)
{
[self deselectCell];
}
else if (self.shouldHighlight) // UITableView refuses selection if highlight is also refused.
{
[self selectCell];
}
}
else
{
// Scroll back to center
[self hideUtilityButtonsAnimated:YES];
}
}
- (void)selectCell
{
if (_cellState == kCellStateCenter)
{
NSIndexPath *cellIndexPath = [self.containingTableView indexPathForCell:self];
if ([self.containingTableView.delegate respondsToSelector:@selector(tableView:willSelectRowAtIndexPath:)])
{
cellIndexPath = [self.containingTableView.delegate tableView:self.containingTableView willSelectRowAtIndexPath:cellIndexPath];
}
if (cellIndexPath)
{
[self.containingTableView selectRowAtIndexPath:cellIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
if ([self.containingTableView.delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)])
{
[self.containingTableView.delegate tableView:self.containingTableView didSelectRowAtIndexPath:cellIndexPath];
}
}
}
}
- (void)deselectCell
{
if (_cellState == kCellStateCenter)
{
NSIndexPath *cellIndexPath = [self.containingTableView indexPathForCell:self];
if ([self.containingTableView.delegate respondsToSelector:@selector(tableView:willDeselectRowAtIndexPath:)])
{
cellIndexPath = [self.containingTableView.delegate tableView:self.containingTableView willDeselectRowAtIndexPath:cellIndexPath];
}
if (cellIndexPath)
{
[self.containingTableView deselectRowAtIndexPath:cellIndexPath animated:NO];
if ([self.containingTableView.delegate respondsToSelector:@selector(tableView:didDeselectRowAtIndexPath:)])
{
[self.containingTableView.delegate tableView:self.containingTableView didDeselectRowAtIndexPath:cellIndexPath];
}
}
}
}
#pragma mark - Utility buttons handling
- (void)rightUtilityButtonHandler:(id)sender
{
SWUtilityButtonTapGestureRecognizer *utilityButtonTapGestureRecognizer = (SWUtilityButtonTapGestureRecognizer *)sender;
NSUInteger utilityButtonIndex = utilityButtonTapGestureRecognizer.buttonIndex;
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCell:didTriggerRightUtilityButtonWithIndex:)])
{
[self.delegate swipeableTableViewCell:self didTriggerRightUtilityButtonWithIndex:utilityButtonIndex];
}
}
- (void)leftUtilityButtonHandler:(id)sender
{
SWUtilityButtonTapGestureRecognizer *utilityButtonTapGestureRecognizer = (SWUtilityButtonTapGestureRecognizer *)sender;
NSUInteger utilityButtonIndex = utilityButtonTapGestureRecognizer.buttonIndex;
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCell:didTriggerLeftUtilityButtonWithIndex:)])
{
[self.delegate swipeableTableViewCell:self didTriggerLeftUtilityButtonWithIndex:utilityButtonIndex];
}
}
- (void)hideUtilityButtonsAnimated:(BOOL)animated
{
if (_cellState != kCellStateCenter)
{
[self.cellScrollView setContentOffset:[self contentOffsetForCellState:kCellStateCenter] animated:animated];
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCell:scrollingToState:)])
{
[self.delegate swipeableTableViewCell:self scrollingToState:kCellStateCenter];
}
}
}
- (void)showLeftUtilityButtonsAnimated:(BOOL)animated {
if (_cellState != kCellStateLeft)
{
[self.cellScrollView setContentOffset:[self contentOffsetForCellState:kCellStateLeft] animated:animated];
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCell:scrollingToState:)])
{
[self.delegate swipeableTableViewCell:self scrollingToState:kCellStateLeft];
}
}
}
- (void)showRightUtilityButtonsAnimated:(BOOL)animated {
if (_cellState != kCellStateRight)
{
[self.cellScrollView setContentOffset:[self contentOffsetForCellState:kCellStateRight] animated:animated];
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCell:scrollingToState:)])
{
[self.delegate swipeableTableViewCell:self scrollingToState:kCellStateRight];
}
}
}
- (BOOL)isUtilityButtonsHidden {
return _cellState == kCellStateCenter;
}
#pragma mark - Geometry helpers
- (CGFloat)leftUtilityButtonsWidth
{
#if CGFLOAT_IS_DOUBLE
return round(CGRectGetWidth(self.leftUtilityButtonsView.frame));
#else
return roundf(CGRectGetWidth(self.leftUtilityButtonsView.frame));
#endif
}
- (CGFloat)rightUtilityButtonsWidth
{
#if CGFLOAT_IS_DOUBLE
return round(CGRectGetWidth(self.rightUtilityButtonsView.frame) + self.additionalRightPadding);
#else
return roundf(CGRectGetWidth(self.rightUtilityButtonsView.frame) + self.additionalRightPadding);
#endif
}
- (CGFloat)utilityButtonsPadding
{
#if CGFLOAT_IS_DOUBLE
return round([self leftUtilityButtonsWidth] + [self rightUtilityButtonsWidth]);
#else
return roundf([self leftUtilityButtonsWidth] + [self rightUtilityButtonsWidth]);
#endif
}
- (CGPoint)contentOffsetForCellState:(SWCellState)state
{
CGPoint scrollPt = CGPointZero;
switch (state)
{
case kCellStateCenter:
scrollPt.x = [self leftUtilityButtonsWidth];
break;
case kCellStateRight:
scrollPt.x = [self utilityButtonsPadding];
break;
case kCellStateLeft:
scrollPt.x = 0;
break;
}
return scrollPt;
}
- (void)updateCellState
{
if(layoutUpdating == NO)
{
// Update the cell state according to the current scroll view contentOffset.
for (NSNumber *numState in @[
@(kCellStateCenter),
@(kCellStateLeft),
@(kCellStateRight),
])
{
SWCellState cellState = numState.integerValue;
if (CGPointEqualToPoint(self.cellScrollView.contentOffset, [self contentOffsetForCellState:cellState]))
{
_cellState = cellState;
break;
}
}
// Update the clipping on the utility button views according to the current position.
CGRect frame = [self.contentView.superview convertRect:self.contentView.frame toView:self];
frame.size.width = CGRectGetWidth(self.frame);
self.leftUtilityClipConstraint.constant = MAX(0, CGRectGetMinX(frame) - CGRectGetMinX(self.frame));
self.rightUtilityClipConstraint.constant = MIN(0, CGRectGetMaxX(frame) - CGRectGetMaxX(self.frame));
if (self.isEditing) {
self.leftUtilityClipConstraint.constant = 0;
self.cellScrollView.contentOffset = CGPointMake([self leftUtilityButtonsWidth], 0);
_cellState = kCellStateCenter;
}
self.leftUtilityClipView.hidden = (self.leftUtilityClipConstraint.constant == 0);
self.rightUtilityClipView.hidden = (self.rightUtilityClipConstraint.constant == 0);
if (self.accessoryType != UITableViewCellAccessoryNone && !self.editing) {
UIView *accessory = [self.cellScrollView.superview.subviews lastObject];
CGRect accessoryFrame = accessory.frame;
accessoryFrame.origin.x = CGRectGetWidth(frame) - CGRectGetWidth(accessoryFrame) - kAccessoryTrailingSpace + CGRectGetMinX(frame);
accessory.frame = accessoryFrame;
}
// Enable or disable the gesture recognizers according to the current mode.
if (!self.cellScrollView.isDragging && !self.cellScrollView.isDecelerating)
{
self.tapGestureRecognizer.enabled = YES;
self.longPressGestureRecognizer.enabled = (_cellState == kCellStateCenter);
}
else
{
self.tapGestureRecognizer.enabled = NO;
self.longPressGestureRecognizer.enabled = NO;
}
self.cellScrollView.scrollEnabled = !self.isEditing;
}
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
if (velocity.x >= 0.5f)
{
if (_cellState == kCellStateLeft || !self.rightUtilityButtons || self.rightUtilityButtonsWidth == 0.0)
{
_cellState = kCellStateCenter;
}
else
{
_cellState = kCellStateRight;
}
}
else if (velocity.x <= -0.5f)
{
if (_cellState == kCellStateRight || !self.leftUtilityButtons || self.leftUtilityButtonsWidth == 0.0)
{
_cellState = kCellStateCenter;
}
else
{
_cellState = kCellStateLeft;
}
}
else
{
CGFloat leftThreshold = [self contentOffsetForCellState:kCellStateLeft].x + (self.leftUtilityButtonsWidth / 2);
CGFloat rightThreshold = [self contentOffsetForCellState:kCellStateRight].x - (self.rightUtilityButtonsWidth / 2);
if (targetContentOffset->x > rightThreshold)
{
_cellState = kCellStateRight;
}
else if (targetContentOffset->x < leftThreshold)
{
_cellState = kCellStateLeft;
}
else
{
_cellState = kCellStateCenter;
}
}
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCell:scrollingToState:)])
{
[self.delegate swipeableTableViewCell:self scrollingToState:_cellState];
}
if (_cellState != kCellStateCenter)
{
if ([self.delegate respondsToSelector:@selector(swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:)])
{
for (SWTableViewCell *cell in [self.containingTableView visibleCells]) {
if (cell != self && [cell isKindOfClass:[SWTableViewCell class]] && [self.delegate swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:cell]) {
[cell hideUtilityButtonsAnimated:YES];
}
}
}
}
*targetContentOffset = [self contentOffsetForCellState:_cellState];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.x > [self leftUtilityButtonsWidth])
{
if ([self rightUtilityButtonsWidth] > 0)
{
if (self.delegate && [self.delegate respondsToSelector:@selector(swipeableTableViewCell:canSwipeToState:)])
{
BOOL shouldScroll = [self.delegate swipeableTableViewCell:self canSwipeToState:kCellStateRight];
if (!shouldScroll)
{
scrollView.contentOffset = CGPointMake([self leftUtilityButtonsWidth], 0);
}
}
}
else
{
[scrollView setContentOffset:CGPointMake([self leftUtilityButtonsWidth], 0)];
self.tapGestureRecognizer.enabled = YES;
}
}
else
{
// Expose the left button view
if ([self leftUtilityButtonsWidth] > 0)
{
if (self.delegate && [self.delegate respondsToSelector:@selector(swipeableTableViewCell:canSwipeToState:)])
{
BOOL shouldScroll = [self.delegate swipeableTableViewCell:self canSwipeToState:kCellStateLeft];
if (!shouldScroll)
{
scrollView.contentOffset = CGPointMake([self leftUtilityButtonsWidth], 0);
}
}
}
else
{
[scrollView setContentOffset:CGPointMake(0, 0)];
self.tapGestureRecognizer.enabled = YES;
}
}
[self updateCellState];
if (self.delegate && [self.delegate respondsToSelector:@selector(swipeableTableViewCell:didScroll:)]) {
[self.delegate swipeableTableViewCell:self didScroll:scrollView];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
[self updateCellState];
if (self.delegate && [self.delegate respondsToSelector:@selector(swipeableTableViewCellDidEndScrolling:)]) {
[self.delegate swipeableTableViewCellDidEndScrolling:self];
}
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
[self updateCellState];
if (self.delegate && [self.delegate respondsToSelector:@selector(swipeableTableViewCellDidEndScrolling:)]) {
[self.delegate swipeableTableViewCellDidEndScrolling:self];
}
}
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
if (!decelerate)
{
self.tapGestureRecognizer.enabled = YES;
}
}
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
if ((gestureRecognizer == self.containingTableView.panGestureRecognizer && otherGestureRecognizer == self.longPressGestureRecognizer)
|| (gestureRecognizer == self.longPressGestureRecognizer && otherGestureRecognizer == self.containingTableView.panGestureRecognizer))
{
// Return YES so the pan gesture of the containing table view is not cancelled by the long press recognizer
return YES;
}
else
{
return NO;
}
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
return ![touch.view isKindOfClass:[UIControl class]];
}
@end
================================================
FILE: SWTableViewCell/PodFiles/SWUtilityButtonTapGestureRecognizer.h
================================================
//
// SWUtilityButtonTapGestureRecognizer.h
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <UIKit/UIGestureRecognizerSubclass.h>
@interface SWUtilityButtonTapGestureRecognizer : UITapGestureRecognizer
@property (nonatomic) NSUInteger buttonIndex;
@end
================================================
FILE: SWTableViewCell/PodFiles/SWUtilityButtonTapGestureRecognizer.m
================================================
//
// SWUtilityButtonTapGestureRecognizer.m
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "SWUtilityButtonTapGestureRecognizer.h"
@implementation SWUtilityButtonTapGestureRecognizer
@end
================================================
FILE: SWTableViewCell/PodFiles/SWUtilityButtonView.h
================================================
//
// SWUtilityButtonView.h
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
@class SWTableViewCell;
#define kUtilityButtonWidthDefault 90
@interface SWUtilityButtonView : UIView
- (id)initWithUtilityButtons:(NSArray *)utilityButtons parentCell:(SWTableViewCell *)parentCell utilityButtonSelector:(SEL)utilityButtonSelector;
- (id)initWithFrame:(CGRect)frame utilityButtons:(NSArray *)utilityButtons parentCell:(SWTableViewCell *)parentCell utilityButtonSelector:(SEL)utilityButtonSelector;
@property (nonatomic, weak, readonly) SWTableViewCell *parentCell;
@property (nonatomic, copy) NSArray *utilityButtons;
@property (nonatomic, assign) SEL utilityButtonSelector;
- (void)setUtilityButtons:(NSArray *)utilityButtons WithButtonWidth:(CGFloat)width;
- (void)pushBackgroundColors;
- (void)popBackgroundColors;
@end
================================================
FILE: SWTableViewCell/PodFiles/SWUtilityButtonView.m
================================================
//
// SWUtilityButtonView.m
// SWTableViewCell
//
// Created by Matt Bowman on 11/27/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "SWUtilityButtonView.h"
#import "SWUtilityButtonTapGestureRecognizer.h"
@interface SWUtilityButtonView()
@property (nonatomic, strong) NSLayoutConstraint *widthConstraint;
@property (nonatomic, strong) NSMutableArray *buttonBackgroundColors;
@end
@implementation SWUtilityButtonView
#pragma mark - SWUtilityButonView initializers
- (id)initWithUtilityButtons:(NSArray *)utilityButtons parentCell:(SWTableViewCell *)parentCell utilityButtonSelector:(SEL)utilityButtonSelector
{
self = [self initWithFrame:CGRectZero utilityButtons:utilityButtons parentCell:parentCell utilityButtonSelector:utilityButtonSelector];
return self;
}
- (id)initWithFrame:(CGRect)frame utilityButtons:(NSArray *)utilityButtons parentCell:(SWTableViewCell *)parentCell utilityButtonSelector:(SEL)utilityButtonSelector
{
self = [super initWithFrame:frame];
if (self) {
self.translatesAutoresizingMaskIntoConstraints = NO;
self.widthConstraint = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:0.0]; // constant will be adjusted dynamically in -setUtilityButtons:.
self.widthConstraint.priority = UILayoutPriorityDefaultHigh;
[self addConstraint:self.widthConstraint];
_parentCell = parentCell;
self.utilityButtonSelector = utilityButtonSelector;
self.utilityButtons = utilityButtons;
}
return self;
}
#pragma mark Populating utility buttons
- (void)setUtilityButtons:(NSArray *)utilityButtons
{
// if no width specified, use the default width
[self setUtilityButtons:utilityButtons WithButtonWidth:kUtilityButtonWidthDefault];
}
- (void)setUtilityButtons:(NSArray *)utilityButtons WithButtonWidth:(CGFloat)width
{
for (UIButton *button in _utilityButtons)
{
[button removeFromSuperview];
}
_utilityButtons = [utilityButtons copy];
if (utilityButtons.count)
{
NSUInteger utilityButtonsCounter = 0;
UIView *precedingView = nil;
for (UIButton *button in _utilityButtons)
{
[self addSubview:button];
button.translatesAutoresizingMaskIntoConstraints = NO;
if (!precedingView)
{
// First button; pin it to the left edge.
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[button]"
options:0L
metrics:nil
views:NSDictionaryOfVariableBindings(button)]];
}
else
{
// Subsequent button; pin it to the right edge of the preceding one, with equal width.
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[precedingView][button(==precedingView)]"
options:0L
metrics:nil
views:NSDictionaryOfVariableBindings(precedingView, button)]];
}
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[button]|"
options:0L
metrics:nil
views:NSDictionaryOfVariableBindings(button)]];
SWUtilityButtonTapGestureRecognizer *utilityButtonTapGestureRecognizer = [[SWUtilityButtonTapGestureRecognizer alloc] initWithTarget:_parentCell action:_utilityButtonSelector];
utilityButtonTapGestureRecognizer.buttonIndex = utilityButtonsCounter;
[button addGestureRecognizer:utilityButtonTapGestureRecognizer];
utilityButtonsCounter++;
precedingView = button;
}
// Pin the last button to the right edge.
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"[precedingView]|"
options:0L
metrics:nil
views:NSDictionaryOfVariableBindings(precedingView)]];
}
self.widthConstraint.constant = (width * utilityButtons.count);
[self setNeedsLayout];
return;
}
#pragma mark -
- (void)pushBackgroundColors
{
self.buttonBackgroundColors = [[NSMutableArray alloc] init];
for (UIButton *button in self.utilityButtons)
{
[self.buttonBackgroundColors addObject:button.backgroundColor];
}
}
- (void)popBackgroundColors
{
NSEnumerator *e = self.utilityButtons.objectEnumerator;
for (UIColor *color in self.buttonBackgroundColors)
{
UIButton *button = [e nextObject];
button.backgroundColor = color;
}
self.buttonBackgroundColors = nil;
}
@end
================================================
FILE: SWTableViewCell/SWTableViewCell-Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.ChrisWendel.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>MainStoryboard</string>
<key>UIMainStoryboardFile</key>
<string>MainStoryboard</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>
================================================
FILE: SWTableViewCell/SWTableViewCell-Prefix.pch
================================================
//
// Prefix header for all source files of the 'SWTableViewCell' target in the 'SWTableViewCell' project
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
================================================
FILE: SWTableViewCell/UMTableViewCell.h
================================================
//
// UMTableViewCell.h
// SWTableViewCell
//
// Created by Matt Bowman on 12/2/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SWTableViewCell.h"
/*
* Example of a custom cell built in Storyboard
*/
@interface UMTableViewCell : SWTableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UILabel *label;
@end
================================================
FILE: SWTableViewCell/UMTableViewCell.m
================================================
//
// UMTableViewCell.m
// SWTableViewCell
//
// Created by Matt Bowman on 12/2/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "UMTableViewCell.h"
@implementation UMTableViewCell
@end
================================================
FILE: SWTableViewCell/ViewController.h
================================================
//
// ViewController.h
// SWTableViewCell
//
// Created by Chris Wendel on 9/10/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SWTableViewCell.h"
@interface ViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource, SWTableViewCellDelegate>
@end
================================================
FILE: SWTableViewCell/ViewController.m
================================================
//
// ViewController.m
// SWTableViewCell
//
// Created by Chris Wendel on 9/10/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import "ViewController.h"
#import "SWTableViewCell.h"
#import "UMTableViewCell.h"
@interface ViewController () {
NSArray *_sections;
NSMutableArray *_testArray;
}
@property (nonatomic, weak) IBOutlet UITableView *tableView;
@property (nonatomic) BOOL useCustomCells;
@property (nonatomic, weak) UIRefreshControl *refreshControl;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.leftBarButtonItem = self.editButtonItem;
self.tableView.rowHeight = 90;
self.navigationItem.title = @"Pull to Toggle Cell Type";
// Setup refresh control for example app
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(toggleCells:) forControlEvents:UIControlEventValueChanged];
refreshControl.tintColor = [UIColor blueColor];
self.refreshControl = refreshControl;
// If you set the seperator inset on iOS 6 you get a NSInvalidArgumentException...weird
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
self.tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); // Makes the horizontal row seperator stretch the entire length of the table view
}
_sections = [[UILocalizedIndexedCollation currentCollation] sectionIndexTitles];
_testArray = [[NSMutableArray alloc] init];
self.useCustomCells = NO;
for (int i = 0; i < _sections.count; ++i) {
[_testArray addObject:[NSMutableArray array]];
}
for (int i = 0; i < 100; ++i) {
NSString *string = [NSString stringWithFormat:@"%d", i];
[_testArray[i % _sections.count] addObject:string];
}
}
#pragma mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return _testArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [_testArray[section] count];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"cell selected at index path %ld:%ld", (long)indexPath.section, (long)indexPath.row);
NSLog(@"selected cell index path is %@", [self.tableView indexPathForSelectedRow]);
if (!tableView.isEditing) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return _sections[section];
}
// Show index titles
//- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
// return [[UILocalizedIndexedCollation currentCollation] sectionIndexTitles];
//}
//
//- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
// return [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index];
//}
#pragma mark - UIRefreshControl Selector
- (void)toggleCells:(UIRefreshControl*)refreshControl
{
[refreshControl beginRefreshing];
self.useCustomCells = !self.useCustomCells;
if (self.useCustomCells)
{
self.refreshControl.tintColor = [UIColor yellowColor];
}
else
{
self.refreshControl.tintColor = [UIColor blueColor];
}
[self.tableView reloadData];
[refreshControl endRefreshing];
}
#pragma mark - UIScrollViewDelegate
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.useCustomCells)
{
UMTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"UMCell" forIndexPath:indexPath];
// optionally specify a width that each set of utility buttons will share
[cell setLeftUtilityButtons:[self leftButtons] WithButtonWidth:32.0f];
[cell setRightUtilityButtons:[self rightButtons] WithButtonWidth:58.0f];
cell.delegate = self;
cell.label.text = [NSString stringWithFormat:@"Section: %ld, Seat: %ld", (long)indexPath.section, (long)indexPath.row];
return cell;
}
else
{
static NSString *cellIdentifier = @"Cell";
SWTableViewCell *cell = (SWTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
cell.leftUtilityButtons = [self leftButtons];
cell.rightUtilityButtons = [self rightButtons];
cell.delegate = self;
}
NSDate *dateObject = _testArray[indexPath.section][indexPath.row];
cell.textLabel.text = [dateObject description];
cell.textLabel.backgroundColor = [UIColor whiteColor];
cell.detailTextLabel.backgroundColor = [UIColor whiteColor];
cell.detailTextLabel.text = @"Some detail text";
return cell;
}
}
- (NSArray *)rightButtons
{
NSMutableArray *rightUtilityButtons = [NSMutableArray new];
[rightUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.78f green:0.78f blue:0.8f alpha:1.0]
title:@"More"];
[rightUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188 alpha:1.0f]
title:@"Delete"];
return rightUtilityButtons;
}
- (NSArray *)leftButtons
{
NSMutableArray *leftUtilityButtons = [NSMutableArray new];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.07 green:0.75f blue:0.16f alpha:1.0]
icon:[UIImage imageNamed:@"check.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:1.0f blue:0.35f alpha:1.0]
icon:[UIImage imageNamed:@"clock.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188f alpha:1.0]
icon:[UIImage imageNamed:@"cross.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.55f green:0.27f blue:0.07f alpha:1.0]
icon:[UIImage imageNamed:@"list.png"]];
return leftUtilityButtons;
}
// Set row height on an individual basis
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
// return [self rowHeightForIndexPath:indexPath];
//}
//
//- (CGFloat)rowHeightForIndexPath:(NSIndexPath *)indexPath {
// return ([indexPath row] * 10) + 60;
//}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// Set background color of cell here if you don't want default white
}
#pragma mark - SWTableViewDelegate
- (void)swipeableTableViewCell:(SWTableViewCell *)cell scrollingToState:(SWCellState)state
{
switch (state) {
case 0:
NSLog(@"utility buttons closed");
break;
case 1:
NSLog(@"left utility buttons open");
break;
case 2:
NSLog(@"right utility buttons open");
break;
default:
break;
}
}
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerLeftUtilityButtonWithIndex:(NSInteger)index
{
switch (index) {
case 0:
NSLog(@"left button 0 was pressed");
break;
case 1:
NSLog(@"left button 1 was pressed");
break;
case 2:
NSLog(@"left button 2 was pressed");
break;
case 3:
NSLog(@"left btton 3 was pressed");
default:
break;
}
}
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index
{
switch (index) {
case 0:
{
NSLog(@"More button was pressed");
UIAlertView *alertTest = [[UIAlertView alloc] initWithTitle:@"Hello" message:@"More more more" delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles: nil];
[alertTest show];
[cell hideUtilityButtonsAnimated:YES];
break;
}
case 1:
{
// Delete button was pressed
NSIndexPath *cellIndexPath = [self.tableView indexPathForCell:cell];
[_testArray[cellIndexPath.section] removeObjectAtIndex:cellIndexPath.row];
[self.tableView deleteRowsAtIndexPaths:@[cellIndexPath] withRowAnimation:UITableViewRowAnimationLeft];
break;
}
default:
break;
}
}
- (BOOL)swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:(SWTableViewCell *)cell
{
// allow just one cell's utility button to be open at once
return YES;
}
- (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state
{
switch (state) {
case 1:
// set to NO to disable all left utility buttons appearing
return YES;
break;
case 2:
// set to NO to disable all right utility buttons appearing
return YES;
break;
default:
break;
}
return YES;
}
@end
================================================
FILE: SWTableViewCell/en.lproj/InfoPlist.strings
================================================
/* Localized versions of Info.plist keys */
================================================
FILE: SWTableViewCell/en.lproj/MainStoryboard.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="14A329f" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="HAv-OM-WVV">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<scenes>
<!--Root View Controller-->
<scene sceneID="8UO-he-yD1">
<objects>
<tableViewController id="gqK-s8-DTV" customClass="ViewController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelectionDuringEditing="YES" allowsMultipleSelectionDuringEditing="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="P0u-Oy-Prt">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="UMCell" rowHeight="96" id="vTX-oE-r0p" customClass="UMTableViewCell">
<rect key="frame" x="0.0" y="86" width="320" height="96"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vTX-oE-r0p" id="hRJ-5q-aRK">
<rect key="frame" x="0.0" y="0.0" width="287" height="95"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="um.png" translatesAutoresizingMaskIntoConstraints="NO" id="mys-5a-TES">
<rect key="frame" x="192" y="10" width="75" height="75"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AHM-FM-2Pc">
<rect key="frame" x="20" y="10" width="165" height="75"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="AHM-FM-2Pc" secondAttribute="trailing" constant="102" id="FSI-tL-rJM"/>
<constraint firstAttribute="trailing" secondItem="mys-5a-TES" secondAttribute="trailing" constant="20" id="bhU-gy-FBr"/>
<constraint firstAttribute="bottom" secondItem="mys-5a-TES" secondAttribute="bottom" constant="10" id="cIR-aO-qjd"/>
<constraint firstAttribute="bottom" secondItem="AHM-FM-2Pc" secondAttribute="bottom" constant="10" id="dbt-uU-pc3"/>
<constraint firstItem="AHM-FM-2Pc" firstAttribute="top" secondItem="hRJ-5q-aRK" secondAttribute="top" constant="10" id="nF3-ah-xbU"/>
<constraint firstItem="mys-5a-TES" firstAttribute="top" secondItem="hRJ-5q-aRK" secondAttribute="top" constant="10" id="nfd-VM-MmP"/>
<constraint firstAttribute="centerY" secondItem="mys-5a-TES" secondAttribute="centerY" id="uh4-Ga-bBK"/>
<constraint firstAttribute="centerY" secondItem="AHM-FM-2Pc" secondAttribute="centerY" id="ujO-0Y-p5K"/>
<constraint firstItem="AHM-FM-2Pc" firstAttribute="leading" secondItem="hRJ-5q-aRK" secondAttribute="leading" constant="20" id="z8h-L6-zTw"/>
<constraint firstItem="mys-5a-TES" firstAttribute="leading" secondItem="AHM-FM-2Pc" secondAttribute="trailing" constant="7" id="zxb-iE-tmw"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="image" destination="mys-5a-TES" id="AmB-7M-sXN"/>
<outlet property="label" destination="AHM-FM-2Pc" id="ly6-l7-4Zj"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="gqK-s8-DTV" id="zqf-UK-Gca"/>
<outlet property="delegate" destination="gqK-s8-DTV" id="tmk-fm-wIS"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="qig-gh-4oH"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ajm-ML-rgU" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="303" y="826"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="ACX-F2-QQ9">
<objects>
<navigationController definesPresentationContext="YES" id="HAv-OM-WVV" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="SCp-PU-Ohw">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="gqK-s8-DTV" kind="relationship" relationship="rootViewController" id="IEh-Ml-61v"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="rfa-Tq-tk4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-231" y="826"/>
</scene>
</scenes>
<resources>
<image name="um.png" width="150" height="150"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
================================================
FILE: SWTableViewCell/main.m
================================================
//
// main.m
// SWTableViewCell
//
// Created by Chris Wendel on 9/10/13.
// Copyright (c) 2013 Chris Wendel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
================================================
FILE: SWTableViewCell.podspec
================================================
Pod::Spec.new do |s|
s.name = 'SWTableViewCell'
s.version = '0.3.7'
s.author = { 'Chris Wendel' => 'chriwend@umich.edu' }
s.homepage = 'https://github.com/CEWendel/SWTableViewCell'
s.summary = 'UITableViewCell subclass that implements a swipeable content view which exposes utility buttons.'
s.license = 'MIT'
s.source = { :git => 'https://github.com/CEWendel/SWTableViewCell.git', :tag => s.version.to_s }
s.source_files = 'SWTableViewCell/PodFiles/*.{h,m}'
s.platform = :ios
s.ios.deployment_target = '6.0'
s.requires_arc = true
end
================================================
FILE: SWTableViewCell.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
523AF8131189D5910D9959B7 /* libPods-SWTableViewCellTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 92B6FCB0D9F5F5976482C755 /* libPods-SWTableViewCellTests.a */; };
76D732681AE2F50200909802 /* SWTableViewCellTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D732671AE2F50200909802 /* SWTableViewCellTests.m */; };
810308911846579B00C378F0 /* NSMutableArray+SWUtilityButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 810308861846579B00C378F0 /* NSMutableArray+SWUtilityButtons.m */; };
810308921846579B00C378F0 /* SWCellScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 810308881846579B00C378F0 /* SWCellScrollView.m */; };
810308931846579B00C378F0 /* SWLongPressGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8103088A1846579B00C378F0 /* SWLongPressGestureRecognizer.m */; };
810308941846579B00C378F0 /* SWTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8103088C1846579B00C378F0 /* SWTableViewCell.m */; };
810308951846579B00C378F0 /* SWUtilityButtonTapGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8103088E1846579B00C378F0 /* SWUtilityButtonTapGestureRecognizer.m */; };
810308961846579B00C378F0 /* SWUtilityButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 810308901846579B00C378F0 /* SWUtilityButtonView.m */; };
810308A2184D682700C378F0 /* um.png in Resources */ = {isa = PBXBuildFile; fileRef = 810308A1184D682700C378F0 /* um.png */; };
810308A5184D688D00C378F0 /* UMTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 810308A4184D688D00C378F0 /* UMTableViewCell.m */; };
AF28B0F117F77DA300A77ABB /* clock@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF28B0F017F77DA300A77ABB /* clock@2x.png */; };
AF28B0F317F77DA600A77ABB /* cross@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF28B0F217F77DA600A77ABB /* cross@2x.png */; };
AF28B0F517F77DB000A77ABB /* check@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF28B0F417F77DB000A77ABB /* check@2x.png */; };
AF28B0F717F77F1100A77ABB /* list@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF28B0F617F77F1100A77ABB /* list@2x.png */; };
AF34B76917DEE2B200BD9082 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF34B76817DEE2B200BD9082 /* UIKit.framework */; };
AF34B76B17DEE2B200BD9082 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF34B76A17DEE2B200BD9082 /* Foundation.framework */; };
AF34B76D17DEE2B200BD9082 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF34B76C17DEE2B200BD9082 /* CoreGraphics.framework */; };
AF34B77317DEE2B400BD9082 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF34B77117DEE2B400BD9082 /* InfoPlist.strings */; };
AF34B77517DEE2B400BD9082 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AF34B77417DEE2B400BD9082 /* main.m */; };
AF34B77917DEE2B400BD9082 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AF34B77817DEE2B400BD9082 /* AppDelegate.m */; };
AF34B77B17DEE2B600BD9082 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = AF34B77A17DEE2B600BD9082 /* Default.png */; };
AF34B77D17DEE2B600BD9082 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF34B77C17DEE2B600BD9082 /* Default@2x.png */; };
AF34B77F17DEE2B600BD9082 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AF34B77E17DEE2B600BD9082 /* Default-568h@2x.png */; };
AF34B78217DEE2B800BD9082 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF34B78017DEE2B700BD9082 /* MainStoryboard.storyboard */; };
AF34B78517DEE2B800BD9082 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF34B78417DEE2B800BD9082 /* ViewController.m */; };
AFF15D1717F35E46007F5746 /* MI.png in Resources */ = {isa = PBXBuildFile; fileRef = AFF15D1617F35E46007F5746 /* MI.png */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
76D732691AE2F50200909802 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AF34B75D17DEE2AE00BD9082 /* Project object */;
proxyType = 1;
remoteGlobalIDString = AF34B76417DEE2B100BD9082;
remoteInfo = SWTableViewCell;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
561A417CAF3000B9397EB62B /* Pods-SWTableViewCellTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SWTableViewCellTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SWTableViewCellTests/Pods-SWTableViewCellTests.debug.xcconfig"; sourceTree = "<group>"; };
76D732631AE2F50100909802 /* SWTableViewCellTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SWTableViewCellTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
76D732661AE2F50200909802 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
76D732671AE2F50200909802 /* SWTableViewCellTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWTableViewCellTests.m; sourceTree = "<group>"; };
810308851846579B00C378F0 /* NSMutableArray+SWUtilityButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+SWUtilityButtons.h"; sourceTree = "<group>"; };
810308861846579B00C378F0 /* NSMutableArray+SWUtilityButtons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+SWUtilityButtons.m"; sourceTree = "<group>"; };
810308871846579B00C378F0 /* SWCellScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWCellScrollView.h; sourceTree = "<group>"; };
810308881846579B00C378F0 /* SWCellScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWCellScrollView.m; sourceTree = "<group>"; };
810308891846579B00C378F0 /* SWLongPressGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWLongPressGestureRecognizer.h; sourceTree = "<group>"; };
8103088A1846579B00C378F0 /* SWLongPressGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWLongPressGestureRecognizer.m; sourceTree = "<group>"; };
8103088B1846579B00C378F0 /* SWTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWTableViewCell.h; sourceTree = "<group>"; };
8103088C1846579B00C378F0 /* SWTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWTableViewCell.m; sourceTree = "<group>"; };
8103088D1846579B00C378F0 /* SWUtilityButtonTapGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWUtilityButtonTapGestureRecognizer.h; sourceTree = "<group>"; };
8103088E1846579B00C378F0 /* SWUtilityButtonTapGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWUtilityButtonTapGestureRecognizer.m; sourceTree = "<group>"; };
8103088F1846579B00C378F0 /* SWUtilityButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWUtilityButtonView.h; sourceTree = "<group>"; };
810308901846579B00C378F0 /* SWUtilityButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWUtilityButtonView.m; sourceTree = "<group>"; };
810308A1184D682700C378F0 /* um.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = um.png; sourceTree = "<group>"; };
810308A3184D688D00C378F0 /* UMTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UMTableViewCell.h; sourceTree = "<group>"; };
810308A4184D688D00C378F0 /* UMTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UMTableViewCell.m; sourceTree = "<group>"; };
92B6FCB0D9F5F5976482C755 /* libPods-SWTableViewCellTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SWTableViewCellTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
AF28B0F017F77DA300A77ABB /* clock@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock@2x.png"; sourceTree = "<group>"; };
AF28B0F217F77DA600A77ABB /* cross@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cross@2x.png"; sourceTree = "<group>"; };
AF28B0F417F77DB000A77ABB /* check@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "check@2x.png"; sourceTree = "<group>"; };
AF28B0F617F77F1100A77ABB /* list@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "list@2x.png"; sourceTree = "<group>"; };
AF2B0DA7183F029000334859 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
AF34B76517DEE2B200BD9082 /* SWTableViewCell.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SWTableViewCell.app; sourceTree = BUILT_PRODUCTS_DIR; };
AF34B76817DEE2B200BD9082 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
AF34B76A17DEE2B200BD9082 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
AF34B76C17DEE2B200BD9082 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
AF34B77017DEE2B300BD9082 /* SWTableViewCell-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SWTableViewCell-Info.plist"; sourceTree = "<group>"; };
AF34B77217DEE2B400BD9082 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
AF34B77417DEE2B400BD9082 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
AF34B77617DEE2B400BD9082 /* SWTableViewCell-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SWTableViewCell-Prefix.pch"; sourceTree = "<group>"; };
AF34B77717DEE2B400BD9082 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
AF34B77817DEE2B400BD9082 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
AF34B77A17DEE2B600BD9082 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
AF34B77C17DEE2B600BD9082 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
AF34B77E17DEE2B600BD9082 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
AF34B78117DEE2B700BD9082 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = "<group>"; };
AF34B78317DEE2B800BD9082 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
AF34B78417DEE2B800BD9082 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
AFF15D1617F35E46007F5746 /* MI.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MI.png; sourceTree = "<group>"; };
E9AD27C1AFAEBD8EA1DEF5A5 /* Pods-SWTableViewCellTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SWTableViewCellTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SWTableViewCellTests/Pods-SWTableViewCellTests.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
76D732601AE2F50100909802 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
523AF8131189D5910D9959B7 /* libPods-SWTableViewCellTests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AF34B76217DEE2B100BD9082 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AF34B76917DEE2B200BD9082 /* UIKit.framework in Frameworks */,
AF34B76B17DEE2B200BD9082 /* Foundation.framework in Frameworks */,
AF34B76D17DEE2B200BD9082 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
55277640D2AABB814E20D3F5 /* Pods */ = {
isa = PBXGroup;
children = (
561A417CAF3000B9397EB62B /* Pods-SWTableViewCellTests.debug.xcconfig */,
E9AD27C1AFAEBD8EA1DEF5A5 /* Pods-SWTableViewCellTests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
76D732641AE2F50100909802 /* SWTableViewCellTests */ = {
isa = PBXGroup;
children = (
76D732671AE2F50200909802 /* SWTableViewCellTests.m */,
76D732651AE2F50200909802 /* Supporting Files */,
);
path = SWTableViewCellTests;
sourceTree = "<group>";
};
76D732651AE2F50200909802 /* Supporting Files */ = {
isa = PBXGroup;
children = (
76D732661AE2F50200909802 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
810308841846579B00C378F0 /* PodFiles */ = {
isa = PBXGroup;
children = (
810308851846579B00C378F0 /* NSMutableArray+SWUtilityButtons.h */,
810308861846579B00C378F0 /* NSMutableArray+SWUtilityButtons.m */,
810308871846579B00C378F0 /* SWCellScrollView.h */,
810308881846579B00C378F0 /* SWCellScrollView.m */,
810308891846579B00C378F0 /* SWLongPressGestureRecognizer.h */,
8103088A1846579B00C378F0 /* SWLongPressGestureRecognizer.m */,
8103088B1846579B00C378F0 /* SWTableViewCell.h */,
8103088C1846579B00C378F0 /* SWTableViewCell.m */,
8103088D1846579B00C378F0 /* SWUtilityButtonTapGestureRecognizer.h */,
8103088E1846579B00C378F0 /* SWUtilityButtonTapGestureRecognizer.m */,
8103088F1846579B00C378F0 /* SWUtilityButtonView.h */,
810308901846579B00C378F0 /* SWUtilityButtonView.m */,
);
path = PodFiles;
sourceTree = "<group>";
};
AF34B75C17DEE2AD00BD9082 = {
isa = PBXGroup;
children = (
AF34B76E17DEE2B200BD9082 /* SWTableViewCell */,
76D732641AE2F50100909802 /* SWTableViewCellTests */,
AF34B76717DEE2B200BD9082 /* Frameworks */,
AF34B76617DEE2B200BD9082 /* Products */,
55277640D2AABB814E20D3F5 /* Pods */,
);
sourceTree = "<group>";
};
AF34B76617DEE2B200BD9082 /* Products */ = {
isa = PBXGroup;
children = (
AF34B76517DEE2B200BD9082 /* SWTableViewCell.app */,
76D732631AE2F50100909802 /* SWTableViewCellTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
AF34B76717DEE2B200BD9082 /* Frameworks */ = {
isa = PBXGroup;
children = (
AF2B0DA7183F029000334859 /* QuartzCore.framework */,
AF34B76817DEE2B200BD9082 /* UIKit.framework */,
AF34B76A17DEE2B200BD9082 /* Foundation.framework */,
AF34B76C17DEE2B200BD9082 /* CoreGraphics.framework */,
92B6FCB0D9F5F5976482C755 /* libPods-SWTableViewCellTests.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
AF34B76E17DEE2B200BD9082 /* SWTableViewCell */ = {
isa = PBXGroup;
children = (
810308A1184D682700C378F0 /* um.png */,
810308841846579B00C378F0 /* PodFiles */,
AF34B77717DEE2B400BD9082 /* AppDelegate.h */,
AF34B77817DEE2B400BD9082 /* AppDelegate.m */,
AF34B78017DEE2B700BD9082 /* MainStoryboard.storyboard */,
AF34B78317DEE2B800BD9082 /* ViewController.h */,
AF34B78417DEE2B800BD9082 /* ViewController.m */,
AF34B76F17DEE2B300BD9082 /* Supporting Files */,
810308A3184D688D00C378F0 /* UMTableViewCell.h */,
810308A4184D688D00C378F0 /* UMTableViewCell.m */,
);
path = SWTableViewCell;
sourceTree = "<group>";
};
AF34B76F17DEE2B300BD9082 /* Supporting Files */ = {
isa = PBXGroup;
children = (
AF28B0F617F77F1100A77ABB /* list@2x.png */,
AF28B0F417F77DB000A77ABB /* check@2x.png */,
AF28B0F217F77DA600A77ABB /* cross@2x.png */,
AF28B0F017F77DA300A77ABB /* clock@2x.png */,
AFF15D1617F35E46007F5746 /* MI.png */,
AF34B77017DEE2B300BD9082 /* SWTableViewCell-Info.plist */,
AF34B77117DEE2B400BD9082 /* InfoPlist.strings */,
AF34B77417DEE2B400BD9082 /* main.m */,
AF34B77617DEE2B400BD9082 /* SWTableViewCell-Prefix.pch */,
AF34B77A17DEE2B600BD9082 /* Default.png */,
AF34B77C17DEE2B600BD9082 /* Default@2x.png */,
AF34B77E17DEE2B600BD9082 /* Default-568h@2x.png */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
76D732621AE2F50100909802 /* SWTableViewCellTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 76D7326B1AE2F50200909802 /* Build configuration list for PBXNativeTarget "SWTableViewCellTests" */;
buildPhases = (
C67FB53E1CB021D85E035F1B /* Check Pods Manifest.lock */,
76D7325F1AE2F50100909802 /* Sources */,
76D732601AE2F50100909802 /* Frameworks */,
76D732611AE2F50100909802 /* Resources */,
BE30338A7FDC2C4BE8F57ADB /* Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
76D7326A1AE2F50200909802 /* PBXTargetDependency */,
);
name = SWTableViewCellTests;
productName = SWTableViewCellTests;
productReference = 76D732631AE2F50100909802 /* SWTableViewCellTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
AF34B76417DEE2B100BD9082 /* SWTableViewCell */ = {
isa = PBXNativeTarget;
buildConfigurationList = AF34B78817DEE2B900BD9082 /* Build configuration list for PBXNativeTarget "SWTableViewCell" */;
buildPhases = (
AF34B76117DEE2B100BD9082 /* Sources */,
AF34B76217DEE2B100BD9082 /* Frameworks */,
AF34B76317DEE2B100BD9082 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = SWTableViewCell;
productName = SWTableViewCell;
productReference = AF34B76517DEE2B200BD9082 /* SWTableViewCell.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
AF34B75D17DEE2AE00BD9082 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = "Chris Wendel";
TargetAttributes = {
76D732621AE2F50100909802 = {
CreatedOnToolsVersion = 6.3;
TestTargetID = AF34B76417DEE2B100BD9082;
};
AF34B76417DEE2B100BD9082 = {
DevelopmentTeam = CRQMUWXT26;
};
};
};
buildConfigurationList = AF34B76017DEE2AE00BD9082 /* Build configuration list for PBXProject "SWTableViewCell" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = AF34B75C17DEE2AD00BD9082;
productRefGroup = AF34B76617DEE2B200BD9082 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
AF34B76417DEE2B100BD9082 /* SWTableViewCell */,
76D732621AE2F50100909802 /* SWTableViewCellTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
76D732611AE2F50100909802 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
AF34B76317DEE2B100BD9082 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AF34B77317DEE2B400BD9082 /* InfoPlist.strings in Resources */,
AF34B77B17DEE2B600BD9082 /* Default.png in Resources */,
AF28B0F517F77DB000A77ABB /* check@2x.png in Resources */,
AF34B77D17DEE2B600BD9082 /* Default@2x.png in Resources */,
AF28B0F317F77DA600A77ABB /* cross@2x.png in Resources */,
810308A2184D682700C378F0 /* um.png in Resources */,
AF34B77F17DEE2B600BD9082 /* Default-568h@2x.png in Resources */,
AF28B0F717F77F1100A77ABB /* list@2x.png in Resources */,
AF28B0F117F77DA300A77ABB /* clock@2x.png in Resources */,
AF34B78217DEE2B800BD9082 /* MainStoryboard.storyboard in Resources */,
AFF15D1717F35E46007F5746 /* MI.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
BE30338A7FDC2C4BE8F57ADB /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SWTableViewCellTests/Pods-SWTableViewCellTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
C67FB53E1CB021D85E035F1B /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
76D7325F1AE2F50100909802 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
76D732681AE2F50200909802 /* SWTableViewCellTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AF34B76117DEE2B100BD9082 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AF34B77517DEE2B400BD9082 /* main.m in Sources */,
AF34B77917DEE2B400BD9082 /* AppDelegate.m in Sources */,
810308921846579B00C378F0 /* SWCellScrollView.m in Sources */,
810308911846579B00C378F0 /* NSMutableArray+SWUtilityButtons.m in Sources */,
810308961846579B00C378F0 /* SWUtilityButtonView.m in Sources */,
810308A5184D688D00C378F0 /* UMTableViewCell.m in Sources */,
810308941846579B00C378F0 /* SWTableViewCell.m in Sources */,
AF34B78517DEE2B800BD9082 /* ViewController.m in Sources */,
810308951846579B00C378F0 /* SWUtilityButtonTapGestureRecognizer.m in Sources */,
810308931846579B00C378F0 /* SWLongPressGestureRecognizer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
76D7326A1AE2F50200909802 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = AF34B76417DEE2B100BD9082 /* SWTableViewCell */;
targetProxy = 76D732691AE2F50200909802 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
AF34B77117DEE2B400BD9082 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
AF34B77217DEE2B400BD9082 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
AF34B78017DEE2B700BD9082 /* MainStoryboard.storyboard */ = {
isa = PBXVariantGroup;
children = (
AF34B78117DEE2B700BD9082 /* en */,
);
name = MainStoryboard.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
76D7326C1AE2F50200909802 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 561A417CAF3000B9397EB62B /* Pods-SWTableViewCellTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
INFOPLIST_FILE = SWTableViewCellTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SWTableViewCell.app/SWTableViewCell";
};
name = Debug;
};
76D7326D1AE2F50200909802 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = E9AD27C1AFAEBD8EA1DEF5A5 /* Pods-SWTableViewCellTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
INFOPLIST_FILE = SWTableViewCellTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SWTableViewCell.app/SWTableViewCell";
};
name = Release;
};
AF34B78617DEE2B800BD9082 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
AF34B78717DEE2B900BD9082 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
AF34B78917DEE2B900BD9082 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SWTableViewCell/SWTableViewCell-Prefix.pch";
INFOPLIST_FILE = "SWTableViewCell/SWTableViewCell-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
AF34B78A17DEE2B900BD9082 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SWTableViewCell/SWTableViewCell-Prefix.pch";
INFOPLIST_FILE = "SWTableViewCell/SWTableViewCell-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
76D7326B1AE2F50200909802 /* Build configuration list for PBXNativeTarget "SWTableViewCellTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
76D7326C1AE2F50200909802 /* Debug */,
76D7326D1AE2F50200909802 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AF34B76017DEE2AE00BD9082 /* Build configuration list for PBXProject "SWTableViewCell" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AF34B78617DEE2B800BD9082 /* Debug */,
AF34B78717DEE2B900BD9082 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AF34B78817DEE2B900BD9082 /* Build configuration list for PBXNativeTarget "SWTableViewCell" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AF34B78917DEE2B900BD9082 /* Debug */,
AF34B78A17DEE2B900BD9082 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = AF34B75D17DEE2AE00BD9082 /* Project object */;
}
================================================
FILE: SWTableViewCell.xcodeproj/xcshareddata/xcschemes/SWTableViewCell.xcscheme
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AF34B76417DEE2B100BD9082"
BuildableName = "SWTableViewCell.app"
BlueprintName = "SWTableViewCell"
ReferencedContainer = "container:SWTableViewCell.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "76D732621AE2F50100909802"
BuildableName = "SWTableViewCellTests.xctest"
BlueprintName = "SWTableViewCellTests"
ReferencedContainer = "container:SWTableViewCell.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "76D732621AE2F50100909802"
BuildableName = "SWTableViewCellTests.xctest"
BlueprintName = "SWTableViewCellTests"
ReferencedContainer = "container:SWTableViewCell.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AF34B76417DEE2B100BD9082"
BuildableName = "SWTableViewCell.app"
BlueprintName = "SWTableViewCell"
ReferencedContainer = "container:SWTableViewCell.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AF34B76417DEE2B100BD9082"
BuildableName = "SWTableViewCell.app"
BlueprintName = "SWTableViewCell"
ReferencedContainer = "container:SWTableViewCell.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AF34B76417DEE2B100BD9082"
BuildableName = "SWTableViewCell.app"
BlueprintName = "SWTableViewCell"
ReferencedContainer = "container:SWTableViewCell.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
================================================
FILE: SWTableViewCellTests/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.ChrisWendel.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
================================================
FILE: SWTableViewCellTests/SWTableViewCellTests.m
================================================
#import <Specta/Specta.h>
#import <Expecta/Expecta.h>
#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import <Expecta+Snapshots/EXPMatchers+FBSnapshotTest.h>
#import <OCMock/OCMock.h>
#import "SWTableViewCell.h"
SpecBegin(SWTableViewCell)
__block NSArray *rightButtons;
__block NSArray *leftButtons;
before(^{
NSMutableArray *rightUtilityButtons = [NSMutableArray new];
[rightUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.78f green:0.78f blue:0.8f alpha:1.0]
title:@"More"];
[rightUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188 alpha:1.0f]
title:@"Delete"];
rightButtons = rightUtilityButtons;
NSMutableArray *leftUtilityButtons = [NSMutableArray new];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.07 green:0.75f blue:0.16f alpha:1.0]
icon:[UIImage imageNamed:@"check.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:1.0f blue:0.35f alpha:1.0]
icon:[UIImage imageNamed:@"clock.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:1.0f green:0.231f blue:0.188f alpha:1.0]
icon:[UIImage imageNamed:@"cross.png"]];
[leftUtilityButtons sw_addUtilityButtonWithColor:
[UIColor colorWithRed:0.55f green:0.27f blue:0.07f alpha:1.0]
icon:[UIImage imageNamed:@"list.png"]];
leftButtons = leftUtilityButtons;
});
describe(@"init", ^{
it(@"should init with cell style UITableViewStyleDefault", ^{
SWTableViewCell *cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
expect(cell).toNot.beNil;
});
it(@"should init with cell style UITableViewStyleSubtitle", ^{
SWTableViewCell *cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil];
expect(cell).toNot.beNil;
});
});
describe(@"buttons", ^{
__block SWTableViewCell *cell;
before(^{
cell = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
[cell setRightUtilityButtons:rightButtons WithButtonWidth:44.0f];
[cell setLeftUtilityButtons:leftButtons WithButtonWidth:44.0f];
});
it(@"should have two right buttons", ^{
expect(cell.rightUtilityButtons.count).to.equal(2);
});
it(@"should have four left buttons", ^{
expect(cell.leftUtilityButtons.count).to.equal(4);
});
});
SpecEnd
gitextract_ipcmtiyk/
├── .gitignore
├── .slather.yml
├── .travis.yml
├── LICENCE
├── Podfile
├── README.md
├── SWTableViewCell/
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── PodFiles/
│ │ ├── NSMutableArray+SWUtilityButtons.h
│ │ ├── NSMutableArray+SWUtilityButtons.m
│ │ ├── SWCellScrollView.h
│ │ ├── SWCellScrollView.m
│ │ ├── SWLongPressGestureRecognizer.h
│ │ ├── SWLongPressGestureRecognizer.m
│ │ ├── SWTableViewCell.h
│ │ ├── SWTableViewCell.m
│ │ ├── SWUtilityButtonTapGestureRecognizer.h
│ │ ├── SWUtilityButtonTapGestureRecognizer.m
│ │ ├── SWUtilityButtonView.h
│ │ └── SWUtilityButtonView.m
│ ├── SWTableViewCell-Info.plist
│ ├── SWTableViewCell-Prefix.pch
│ ├── UMTableViewCell.h
│ ├── UMTableViewCell.m
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── en.lproj/
│ │ ├── InfoPlist.strings
│ │ └── MainStoryboard.storyboard
│ └── main.m
├── SWTableViewCell.podspec
├── SWTableViewCell.xcodeproj/
│ ├── project.pbxproj
│ └── xcshareddata/
│ └── xcschemes/
│ └── SWTableViewCell.xcscheme
└── SWTableViewCellTests/
├── Info.plist
└── SWTableViewCellTests.m
SYMBOL INDEX (1 symbols across 1 files) FILE: SWTableViewCell/PodFiles/SWTableViewCell.h type kCellStateCenter (line 18) | typedef NS_ENUM(NSInteger, SWCellState)
Condensed preview — 34 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (129K chars).
[
{
"path": ".gitignore",
"chars": 126,
"preview": ".DS_Store\nbuild/*\n*.pbxuser\n*.xcworkspace\nxcuserdata\nprofile\n*.moved-aside\nxcuserdata/\nproject.xcworkspace/\nPodfile.lock"
},
{
"path": ".slather.yml",
"chars": 130,
"preview": "ci_service: travis_ci\ncoverage_service: coveralls\nxcodeproj: SWTableViewCell.xcodeproj\nsource_directory: SWTableViewCell"
},
{
"path": ".travis.yml",
"chars": 219,
"preview": "language: objective-c\ncache: cocoapods\nxcode_workspace: SWTableViewCell.xcworkspace\nxcode_scheme: SWTableViewCell\nxcode_"
},
{
"path": "LICENCE",
"chars": 1061,
"preview": "Copyright (c) 2013 Christopher Wendel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof t"
},
{
"path": "Podfile",
"chars": 262,
"preview": "# Uncomment this line to define a global platform for your project\n# platform :ios, '6.0'\n\ntarget 'SWTableViewCell' do\n\n"
},
{
"path": "README.md",
"chars": 9189,
"preview": "SWTableViewCell\n===============\n\n[](http"
},
{
"path": "SWTableViewCell/AppDelegate.h",
"chars": 287,
"preview": "//\n// AppDelegate.h\n// SWTableViewCell\n//\n// Created by Chris Wendel on 9/10/13.\n// Copyright (c) 2013 Chris Wendel."
},
{
"path": "SWTableViewCell/AppDelegate.m",
"chars": 2017,
"preview": "//\n// AppDelegate.m\n// SWTableViewCell\n//\n// Created by Chris Wendel on 9/10/13.\n// Copyright (c) 2013 Chris Wendel."
},
{
"path": "SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.h",
"chars": 727,
"preview": "//\n// NSMutableArray+SWUtilityButtons.h\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c"
},
{
"path": "SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.m",
"chars": 3570,
"preview": "//\n// NSMutableArray+SWUtilityButtons.m\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c"
},
{
"path": "SWTableViewCell/PodFiles/SWCellScrollView.h",
"chars": 255,
"preview": "//\n// SWCellScrollView.h\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c) 2013 Chris We"
},
{
"path": "SWTableViewCell/PodFiles/SWCellScrollView.m",
"chars": 1521,
"preview": "//\n// SWCellScrollView.m\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c) 2013 Chris We"
},
{
"path": "SWTableViewCell/PodFiles/SWLongPressGestureRecognizer.h",
"chars": 312,
"preview": "//\n// SWLongPressGestureRecognizer.h\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c) 2"
},
{
"path": "SWTableViewCell/PodFiles/SWLongPressGestureRecognizer.m",
"chars": 722,
"preview": "//\n// SWLongPressGestureRecognizer.m\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c) 2"
},
{
"path": "SWTableViewCell/PodFiles/SWTableViewCell.h",
"chars": 1854,
"preview": "//\n// SWTableViewCell.h\n// SWTableViewCell\n//\n// Created by Chris Wendel on 9/10/13.\n// Copyright (c) 2013 Chris Wen"
},
{
"path": "SWTableViewCell/PodFiles/SWTableViewCell.m",
"chars": 31070,
"preview": "//\n// SWTableViewCell.m\n// SWTableViewCell\n//\n// Created by Chris Wendel on 9/10/13.\n// Copyright (c) 2013 Chris Wen"
},
{
"path": "SWTableViewCell/PodFiles/SWUtilityButtonTapGestureRecognizer.h",
"chars": 367,
"preview": "//\n// SWUtilityButtonTapGestureRecognizer.h\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyrigh"
},
{
"path": "SWTableViewCell/PodFiles/SWUtilityButtonTapGestureRecognizer.m",
"chars": 278,
"preview": "//\n// SWUtilityButtonTapGestureRecognizer.m\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyrigh"
},
{
"path": "SWTableViewCell/PodFiles/SWUtilityButtonView.h",
"chars": 923,
"preview": "//\n// SWUtilityButtonView.h\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c) 2013 Chris"
},
{
"path": "SWTableViewCell/PodFiles/SWUtilityButtonView.m",
"chars": 5959,
"preview": "//\n// SWUtilityButtonView.m\n// SWTableViewCell\n//\n// Created by Matt Bowman on 11/27/13.\n// Copyright (c) 2013 Chris"
},
{
"path": "SWTableViewCell/SWTableViewCell-Info.plist",
"chars": 1366,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "SWTableViewCell/SWTableViewCell-Prefix.pch",
"chars": 333,
"preview": "//\n// Prefix header for all source files of the 'SWTableViewCell' target in the 'SWTableViewCell' project\n//\n\n#import <A"
},
{
"path": "SWTableViewCell/UMTableViewCell.h",
"chars": 420,
"preview": "//\n// UMTableViewCell.h\n// SWTableViewCell\n//\n// Created by Matt Bowman on 12/2/13.\n// Copyright (c) 2013 Chris Wend"
},
{
"path": "SWTableViewCell/UMTableViewCell.m",
"chars": 216,
"preview": "//\n// UMTableViewCell.m\n// SWTableViewCell\n//\n// Created by Matt Bowman on 12/2/13.\n// Copyright (c) 2013 Chris Wend"
},
{
"path": "SWTableViewCell/ViewController.h",
"chars": 328,
"preview": "//\n// ViewController.h\n// SWTableViewCell\n//\n// Created by Chris Wendel on 9/10/13.\n// Copyright (c) 2013 Chris Wend"
},
{
"path": "SWTableViewCell/ViewController.m",
"chars": 9655,
"preview": "//\n// ViewController.m\n// SWTableViewCell\n//\n// Created by Chris Wendel on 9/10/13.\n// Copyright (c) 2013 Chris Wend"
},
{
"path": "SWTableViewCell/en.lproj/InfoPlist.strings",
"chars": 45,
"preview": "/* Localized versions of Info.plist keys */\n\n"
},
{
"path": "SWTableViewCell/en.lproj/MainStoryboard.storyboard",
"chars": 7664,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
},
{
"path": "SWTableViewCell/main.m",
"chars": 346,
"preview": "//\n// main.m\n// SWTableViewCell\n//\n// Created by Chris Wendel on 9/10/13.\n// Copyright (c) 2013 Chris Wendel. All ri"
},
{
"path": "SWTableViewCell.podspec",
"chars": 568,
"preview": "Pod::Spec.new do |s|\n s.name = 'SWTableViewCell'\n s.version = '0.3.7'\n s.author = { 'Chris Wendel' => 'chriwen"
},
{
"path": "SWTableViewCell.xcodeproj/project.pbxproj",
"chars": 31448,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "SWTableViewCell.xcodeproj/xcshareddata/xcschemes/SWTableViewCell.xcscheme",
"chars": 4368,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n LastUpgradeVersion = \"0630\"\n version = \"1.3\">\n <BuildAction\n "
},
{
"path": "SWTableViewCellTests/Info.plist",
"chars": 754,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "SWTableViewCellTests/SWTableViewCellTests.m",
"chars": 2832,
"preview": "#import <Specta/Specta.h>\n#import <Expecta/Expecta.h>\n#import <FBSnapshotTestCase/FBSnapshotTestCase.h>\n#import <Expecta"
}
]
About this extraction
This page contains the full source code of the CEWendel/SWTableViewCell GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 34 files (118.4 KB), approximately 31.7k tokens, and a symbol index with 1 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.