Skip to content

Commit

Permalink
Added a sample for UITableViewRowAction.
Browse files Browse the repository at this point in the history
  • Loading branch information
shu223 committed Nov 25, 2014
1 parent 9e56593 commit dc6b3dc
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ Example of UIPopoverPresentationController.
<img src="ResourcesForREADME/popover.jpg" width="200">


###Table Row Action

Example of UITableViewRowAction.


###Accordion Fold Transition

Transitions from one image to another by folding like accordion. However it doesn't work correctly...**PULL REQUESTS welcome**!!
Expand Down
22 changes: 22 additions & 0 deletions iOS8Sampler.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
8A4FB83A19D2442F00375981 /* AltimeterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A4FB83719D2442F00375981 /* AltimeterViewController.m */; };
8A4FB83B19D2442F00375981 /* AltimeterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8A4FB83819D2442F00375981 /* AltimeterViewController.xib */; };
8A4FB83C19D2442F00375981 /* AltimeterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8A4FB83819D2442F00375981 /* AltimeterViewController.xib */; };
8A60FE6C1A2495EF006D76D9 /* RowActionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A60FE6A1A2495EF006D76D9 /* RowActionViewController.m */; };
8A60FE6D1A2495EF006D76D9 /* RowActionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8A60FE6B1A2495EF006D76D9 /* RowActionViewController.xib */; };
8A60FE6F1A24972C006D76D9 /* RowActionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8A60FE6B1A2495EF006D76D9 /* RowActionViewController.xib */; };
8A60FE701A24972F006D76D9 /* RowActionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A60FE6A1A2495EF006D76D9 /* RowActionViewController.m */; };
8A8D0BF119C99A8A009E3448 /* AnamorphicStretch.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = 8A8D0BEC19C99A8A009E3448 /* AnamorphicStretch.cikernel */; };
8A8D0BF219C99A8A009E3448 /* MirrorX.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = 8A8D0BED19C99A8A009E3448 /* MirrorX.cikernel */; };
8A8D0BF319C99A8A009E3448 /* SourceOver.cikernel in Resources */ = {isa = PBXBuildFile; fileRef = 8A8D0BEE19C99A8A009E3448 /* SourceOver.cikernel */; };
Expand Down Expand Up @@ -229,6 +233,9 @@
8A4FB83619D2442F00375981 /* AltimeterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AltimeterViewController.h; sourceTree = "<group>"; };
8A4FB83719D2442F00375981 /* AltimeterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AltimeterViewController.m; sourceTree = "<group>"; };
8A4FB83819D2442F00375981 /* AltimeterViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AltimeterViewController.xib; sourceTree = "<group>"; };
8A60FE691A2495EF006D76D9 /* RowActionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RowActionViewController.h; sourceTree = "<group>"; };
8A60FE6A1A2495EF006D76D9 /* RowActionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RowActionViewController.m; sourceTree = "<group>"; };
8A60FE6B1A2495EF006D76D9 /* RowActionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RowActionViewController.xib; sourceTree = "<group>"; };
8A8D0BEC19C99A8A009E3448 /* AnamorphicStretch.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AnamorphicStretch.cikernel; sourceTree = "<group>"; };
8A8D0BED19C99A8A009E3448 /* MirrorX.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MirrorX.cikernel; sourceTree = "<group>"; };
8A8D0BEE19C99A8A009E3448 /* SourceOver.cikernel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SourceOver.cikernel; sourceTree = "<group>"; };
Expand Down Expand Up @@ -453,6 +460,16 @@
name = Altimeter;
sourceTree = "<group>";
};
8A60FE6E1A2495F5006D76D9 /* UITableViewRowAction */ = {
isa = PBXGroup;
children = (
8A60FE691A2495EF006D76D9 /* RowActionViewController.h */,
8A60FE6A1A2495EF006D76D9 /* RowActionViewController.m */,
8A60FE6B1A2495EF006D76D9 /* RowActionViewController.xib */,
);
name = UITableViewRowAction;
sourceTree = "<group>";
};
8A8D0BEB19C99A8A009E3448 /* kernels */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -841,6 +858,7 @@
8A8D0CF619C9CA49009E3448 /* SceneKit */,
8AD104C119CB99BF00C30A3D /* RubyAnnotation */,
8A4FB83D19D2443600375981 /* Altimeter */,
8A60FE6E1A2495F5006D76D9 /* UITableViewRowAction */,
);
path = Samples;
sourceTree = "<group>";
Expand Down Expand Up @@ -1080,6 +1098,7 @@
8A8D0C9819C9A034009E3448 /* UserNotificationViewController.xib in Resources */,
8A8D0D0719C9D6B8009E3448 /* BrowseCodeViewController.xib in Resources */,
8A8D0C9A19C9A034009E3448 /* entitlements.plist in Resources */,
8A60FE6F1A24972C006D76D9 /* RowActionViewController.xib in Resources */,
8A8D0D0019C9CF7D009E3448 /* SamplerIcon.png in Resources */,
8A8D0C9C19C9A034009E3448 /* AudioEngineViewController.xib in Resources */,
8A8D0C9D19C9A034009E3448 /* WebKitViewController.xib in Resources */,
Expand Down Expand Up @@ -1131,6 +1150,7 @@
8A308E2519BDADB9007C7315 /* UserNotificationViewController.xib in Resources */,
8A8D0D0619C9D6B8009E3448 /* BrowseCodeViewController.xib in Resources */,
8A8D244619BCD85F0005B633 /* entitlements.plist in Resources */,
8A60FE6D1A2495EF006D76D9 /* RowActionViewController.xib in Resources */,
8A8D0CFF19C9CF7D009E3448 /* SamplerIcon.png in Resources */,
8AB1C2D419AAD0A300B847D0 /* AudioEngineViewController.xib in Resources */,
8AAC232E19A2181800218191 /* WebKitViewController.xib in Resources */,
Expand Down Expand Up @@ -1163,6 +1183,7 @@
8A8D0C5519C9A034009E3448 /* WebKitViewController.m in Sources */,
8A8D0C5619C9A034009E3448 /* HealthKitViewController.m in Sources */,
8A8D0C5719C9A034009E3448 /* CustomFiltersViewController.m in Sources */,
8A60FE701A24972F006D76D9 /* RowActionViewController.m in Sources */,
8A8D0C5819C9A034009E3448 /* UIView+TTMGeometry.m in Sources */,
8A8D0C5919C9A034009E3448 /* TTMHealthKitHelper.m in Sources */,
8A8D0C5A19C9A034009E3448 /* SVProgressHUD.m in Sources */,
Expand Down Expand Up @@ -1222,6 +1243,7 @@
8A8D244419BCD3020005B633 /* TTMHealthKitHelper.m in Sources */,
8A8D0CD119C9B163009E3448 /* MetalUniformStreamRenderer.mm in Sources */,
8AE7B7B619A1981E00E0C6EB /* SVProgressHUD.m in Sources */,
8A60FE6C1A2495EF006D76D9 /* RowActionViewController.m in Sources */,
8ABBB65C19CBA48800F44D89 /* RubyAnnotationLabel.m in Sources */,
8A8D0D0419C9D6B8009E3448 /* BrowseCodeViewController.m in Sources */,
8A8D0CE119C9B1CF009E3448 /* AAPLCube.mm in Sources */,
Expand Down
6 changes: 6 additions & 0 deletions iOS8Sampler/MasterViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ - (void)viewDidLoad {
kItemKeyClassPrefix: @"Popover",
},

// UITableViewRowAction
@{kItemKeyTitle: @"Table Row Action",
kItemKeyDescription: @"Example of UITableViewRowAction.",
kItemKeyClassPrefix: @"RowAction",
},

// Accordion Fold Transition
@{kItemKeyTitle: @"Accordion Fold Transition",
kItemKeyDescription: @"Transitions from one image to another by folding like accordion. However it doesn't work correctly...PULL REQUESTS welcome!!",
Expand Down
13 changes: 13 additions & 0 deletions iOS8Sampler/Samples/RowActionViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// RowActionViewController.h
// iOS8Sampler
//
// Created by Shuichi Tsutsumi on 2014/11/25.
// Copyright (c) 2014年 Shuichi Tsutsumi. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface RowActionViewController : UIViewController

@end
110 changes: 110 additions & 0 deletions iOS8Sampler/Samples/RowActionViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
//
// RowActionViewController.m
// iOS8Sampler
//
// Created by Shuichi Tsutsumi on 2014/11/25.
// Copyright (c) 2014年 Shuichi Tsutsumi. All rights reserved.
//

#import "RowActionViewController.h"
#import "SVProgressHUD.h"


@interface RowActionViewController ()
<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, weak) IBOutlet UITableView *tableView;
@property (nonatomic, strong) NSArray *items;
@end


@implementation RowActionViewController

- (void)viewDidLoad {

[super viewDidLoad];

self.items = @[
@"Swipe this cell",
];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/



// =============================================================================
#pragma mark - TableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return [self.items count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}

cell.textLabel.text = self.items[indexPath.row];

return cell;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

}

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewRowAction *destructiveAction;
UITableViewRowAction *normalAction;

destructiveAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive
title:@"destructive"
handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
[SVProgressHUD showSuccessWithStatus:@"Destructive action has been executed!"];
}];

normalAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal
title:@"normal"
handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
[SVProgressHUD showSuccessWithStatus:@"Normal action has been executed!"];
}];

return @[destructiveAction, normalAction];
}


// =============================================================================
#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

}

@end
36 changes: 36 additions & 0 deletions iOS8Sampler/Samples/RowActionViewController.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6246"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RowActionViewController">
<connections>
<outlet property="tableView" destination="Csj-wf-3lP" id="yJU-er-VMQ"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="Csj-wf-3lP">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="-1" id="ZBy-CZ-lBm"/>
<outlet property="delegate" destination="-1" id="MIi-04-Clk"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Csj-wf-3lP" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="14s-bA-eMd"/>
<constraint firstItem="Csj-wf-3lP" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="9rw-AM-of3"/>
<constraint firstAttribute="bottom" secondItem="Csj-wf-3lP" secondAttribute="bottom" id="Dny-Lh-OM5"/>
<constraint firstAttribute="trailing" secondItem="Csj-wf-3lP" secondAttribute="trailing" id="iM0-nH-4AC"/>
</constraints>
</view>
</objects>
</document>

0 comments on commit dc6b3dc

Please sign in to comment.