Dactyloidae iOS initial commit
15
mobile/ios/ThirdParty/SWTableViewCell/AppDelegate.h
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// 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
|
||||
46
mobile/ios/ThirdParty/SWTableViewCell/AppDelegate.m
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// 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
|
||||
BIN
mobile/ios/ThirdParty/SWTableViewCell/Default-568h@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
mobile/ios/ThirdParty/SWTableViewCell/Default.png
vendored
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
mobile/ios/ThirdParty/SWTableViewCell/Default@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
mobile/ios/ThirdParty/SWTableViewCell/MI.png
vendored
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
25
mobile/ios/ThirdParty/SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.h
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// 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
|
||||
92
mobile/ios/ThirdParty/SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.m
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// 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
|
||||
43
mobile/ios/ThirdParty/SWTableViewCell/SWTableViewCell-Info.plist
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?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>
|
||||
14
mobile/ios/ThirdParty/SWTableViewCell/SWTableViewCell-Prefix.pch
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// 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
|
||||
20
mobile/ios/ThirdParty/SWTableViewCell/UMTableViewCell.h
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// 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
|
||||
13
mobile/ios/ThirdParty/SWTableViewCell/UMTableViewCell.m
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// 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
|
||||
14
mobile/ios/ThirdParty/SWTableViewCell/ViewController.h
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// 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
|
||||
292
mobile/ios/ThirdParty/SWTableViewCell/ViewController.m
vendored
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
//
|
||||
// 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
|
||||
BIN
mobile/ios/ThirdParty/SWTableViewCell/check@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
mobile/ios/ThirdParty/SWTableViewCell/clock@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
mobile/ios/ThirdParty/SWTableViewCell/cross@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
2
mobile/ios/ThirdParty/SWTableViewCell/en.lproj/InfoPlist.strings
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/* Localized versions of Info.plist keys */
|
||||
|
||||
87
mobile/ios/ThirdParty/SWTableViewCell/en.lproj/MainStoryboard.storyboard
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<?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>
|
||||
BIN
mobile/ios/ThirdParty/SWTableViewCell/list@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
18
mobile/ios/ThirdParty/SWTableViewCell/main.m
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// 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]));
|
||||
}
|
||||
}
|
||||
BIN
mobile/ios/ThirdParty/SWTableViewCell/um.png
vendored
Normal file
|
After Width: | Height: | Size: 13 KiB |