Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Confirmed that table row height can be animated

  • Loading branch information...
commit a970628d3483fb961760a295c2d339b3f8cca91b 1 parent fab552d
James Tang authored
9 .gitignore
View
@@ -0,0 +1,9 @@
+.DS_Store
+.svn
+build
+*.xcodeproj/*.mode1v3
+*.xcodeproj/*.pbxuser
+*.xcodeproj/project.xcworkspace/*
+*.xcodeproj/xcuserdata/*
+lib_output
+DerivedData
12 JTGestureBasedTableViewDemo.xcodeproj/project.pbxproj
View
@@ -38,21 +38,21 @@
52D6217C14DF7F1E00400117 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
52D6217E14DF7F1E00400117 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
52D6218014DF7F1E00400117 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
- 52D6218414DF7F1E00400117 /* JTGestureBasedTableViewDemo-Info.plist */ = {isa = PBXFileReference; path = "JTGestureBasedTableViewDemo-Info.plist"; sourceTree = "<group>"; };
+ 52D6218414DF7F1E00400117 /* JTGestureBasedTableViewDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JTGestureBasedTableViewDemo-Info.plist"; sourceTree = "<group>"; };
52D6218614DF7F1E00400117 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
52D6218814DF7F1E00400117 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 52D6218A14DF7F1E00400117 /* JTGestureBasedTableViewDemo-Prefix.pch */ = {isa = PBXFileReference; path = "JTGestureBasedTableViewDemo-Prefix.pch"; sourceTree = "<group>"; };
- 52D6218B14DF7F1E00400117 /* AppDelegate.h */ = {isa = PBXFileReference; path = AppDelegate.h; sourceTree = "<group>"; };
+ 52D6218A14DF7F1E00400117 /* JTGestureBasedTableViewDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JTGestureBasedTableViewDemo-Prefix.pch"; sourceTree = "<group>"; };
+ 52D6218B14DF7F1E00400117 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
52D6218C14DF7F1E00400117 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
- 52D6218E14DF7F1E00400117 /* ViewController.h */ = {isa = PBXFileReference; path = ViewController.h; sourceTree = "<group>"; };
+ 52D6218E14DF7F1E00400117 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
52D6218F14DF7F1E00400117 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
52D6219214DF7F1E00400117 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = "<group>"; };
52D6219514DF7F1E00400117 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; };
52D6219C14DF7F1E00400117 /* JTGestureBasedTableViewDemoTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JTGestureBasedTableViewDemoTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
52D6219D14DF7F1E00400117 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
- 52D621A514DF7F1E00400117 /* JTGestureBasedTableViewDemoTests-Info.plist */ = {isa = PBXFileReference; path = "JTGestureBasedTableViewDemoTests-Info.plist"; sourceTree = "<group>"; };
+ 52D621A514DF7F1E00400117 /* JTGestureBasedTableViewDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JTGestureBasedTableViewDemoTests-Info.plist"; sourceTree = "<group>"; };
52D621A714DF7F1E00400117 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- 52D621A914DF7F1E00400117 /* JTGestureBasedTableViewDemoTests.h */ = {isa = PBXFileReference; path = JTGestureBasedTableViewDemoTests.h; sourceTree = "<group>"; };
+ 52D621A914DF7F1E00400117 /* JTGestureBasedTableViewDemoTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JTGestureBasedTableViewDemoTests.h; sourceTree = "<group>"; };
52D621AA14DF7F1E00400117 /* JTGestureBasedTableViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JTGestureBasedTableViewDemoTests.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
9 JTGestureBasedTableViewDemo/AppDelegate.m
View
@@ -19,11 +19,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
- if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
- self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
- } else {
- self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
- }
+
+ // Will auto load the corresponding viewController.xib
+ self.viewController = [[ViewController alloc] initWithNibName:nil bundle:nil];
+
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
2  JTGestureBasedTableViewDemo/ViewController.h
View
@@ -8,6 +8,6 @@
#import <UIKit/UIKit.h>
-@interface ViewController : UIViewController
+@interface ViewController : UITableViewController
@end
49 JTGestureBasedTableViewDemo/ViewController.m
View
@@ -10,14 +10,14 @@
@implementation ViewController
-- (void)didReceiveMemoryWarning
-{
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
-}
-
#pragma mark - View lifecycle
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
+ }
+ return self;
+}
+
- (void)viewDidLoad
{
[super viewDidLoad];
@@ -61,4 +61,41 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
}
}
+#pragma mark UITableViewDatasource
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return 20;
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ static NSString *cellIdentifier = @"MyCell";
+
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ if (cell == nil) {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
+ }
+
+ cell.textLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
+
+ return cell;
+}
+
+#pragma mark UITableViewDelegate
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ if ([[tableView indexPathForSelectedRow] isEqual:indexPath]) {
+ return 44 * 2;
+ }
+ return 44;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ [tableView beginUpdates];
+ [tableView endUpdates];
+}
+
@end
58 JTGestureBasedTableViewDemo/en.lproj/ViewController_iPad.xib
View
@@ -2,17 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C25</string>
- <string key="IBDocument.InterfaceBuilderVersion">1919</string>
- <string key="IBDocument.AppKitVersion">1138.11</string>
- <string key="IBDocument.HIToolboxVersion">566.00</string>
+ <string key="IBDocument.SystemVersion">11C74</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.23</string>
+ <string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">916</string>
+ <string key="NS.object.0">933</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
- <string>IBUIView</string>
+ <string>IBUITableView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -30,23 +30,29 @@
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
- <object class="IBUIView" id="766721923">
+ <object class="IBUITableView" id="1065806599">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
+ <string key="NSReuseIdentifierKey">_NS:408</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace">
- <int key="NSID">2</int>
- </object>
</object>
+ <bool key="IBUIClipsSubviews">YES</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+ <bool key="IBUIAlwaysBounceVertical">YES</bool>
+ <int key="IBUISeparatorStyle">1</int>
+ <int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
+ <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
+ <float key="IBUIRowHeight">44</float>
+ <float key="IBUISectionHeaderHeight">22</float>
+ <float key="IBUISectionFooterHeight">22</float>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -55,9 +61,25 @@
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="841351856"/>
- <reference key="destination" ref="766721923"/>
+ <reference key="destination" ref="1065806599"/>
+ </object>
+ <int key="connectionID">7</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">dataSource</string>
+ <reference key="source" ref="1065806599"/>
+ <reference key="destination" ref="841351856"/>
+ </object>
+ <int key="connectionID">5</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="1065806599"/>
+ <reference key="destination" ref="841351856"/>
</object>
- <int key="connectionID">3</int>
+ <int key="connectionID">6</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -80,8 +102,8 @@
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="766721923"/>
+ <int key="objectID">4</int>
+ <reference key="object" ref="1065806599"/>
<reference key="parent" ref="0"/>
</object>
</array>
@@ -91,19 +113,19 @@
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">3</int>
+ <int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">ViewController</string>
- <string key="superclassName">UIViewController</string>
+ <string key="superclassName">UITableViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ViewController.h</string>
@@ -115,6 +137,6 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">916</string>
+ <string key="IBCocoaTouchPluginVersion">933</string>
</data>
</archive>
61 JTGestureBasedTableViewDemo/en.lproj/ViewController_iPhone.xib
View
@@ -2,17 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
- <string key="IBDocument.SystemVersion">11C25</string>
- <string key="IBDocument.InterfaceBuilderVersion">1919</string>
- <string key="IBDocument.AppKitVersion">1138.11</string>
- <string key="IBDocument.HIToolboxVersion">566.00</string>
+ <string key="IBDocument.SystemVersion">11C74</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.23</string>
+ <string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">916</string>
+ <string key="NS.object.0">933</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
- <string>IBUIView</string>
+ <string>IBUITableView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -30,22 +30,27 @@
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
- <object class="IBUIView" id="774585933">
+ <object class="IBUITableView" id="648862734">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
+ <string key="NSReuseIdentifierKey">_NS:418</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC43NQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace">
- <int key="NSID">2</int>
- </object>
+ <bytes key="NSWhite">MQA</bytes>
</object>
- <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIAlwaysBounceVertical">YES</bool>
+ <int key="IBUISeparatorStyle">1</int>
+ <int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
+ <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
+ <float key="IBUIRowHeight">44</float>
+ <float key="IBUISectionHeaderHeight">22</float>
+ <float key="IBUISectionFooterHeight">22</float>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
@@ -54,9 +59,25 @@
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
- <reference key="destination" ref="774585933"/>
+ <reference key="destination" ref="648862734"/>
+ </object>
+ <int key="connectionID">11</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">dataSource</string>
+ <reference key="source" ref="648862734"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">9</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="648862734"/>
+ <reference key="destination" ref="372490531"/>
</object>
- <int key="connectionID">7</int>
+ <int key="connectionID">10</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -79,8 +100,8 @@
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">6</int>
- <reference key="object" ref="774585933"/>
+ <int key="objectID">8</int>
+ <reference key="object" ref="648862734"/>
<reference key="parent" ref="0"/>
</object>
</array>
@@ -90,19 +111,19 @@
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">7</int>
+ <int key="maxID">11</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">ViewController</string>
- <string key="superclassName">UIViewController</string>
+ <string key="superclassName">UITableViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ViewController.h</string>
@@ -114,6 +135,6 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">916</string>
+ <string key="IBCocoaTouchPluginVersion">933</string>
</data>
</archive>
Please sign in to comment.
Something went wrong with that request. Please try again.