From 4e65e7147f6bfcf79c4a5f9e72f8688cecd90279 Mon Sep 17 00:00:00 2001 From: "David W. Stockton" Date: Sat, 15 Mar 2014 09:38:22 -0400 Subject: [PATCH] Corrects test logic in -verifyConfiguration (no functional change) --- UITableView+Reorder.xcodeproj/project.pbxproj | 6 +----- UITableView+Reorder/UITableView+Reorder.h | 1 + UITableView+Reorder/UITableView+Reorder.m | 19 ++++++++++++++----- .../UITableView+Reorder-Info.plist | 4 ++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/UITableView+Reorder.xcodeproj/project.pbxproj b/UITableView+Reorder.xcodeproj/project.pbxproj index f6d236f..48ae4ff 100644 --- a/UITableView+Reorder.xcodeproj/project.pbxproj +++ b/UITableView+Reorder.xcodeproj/project.pbxproj @@ -230,7 +230,7 @@ 24794CD018C5F57E004AEB34 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0500; + LastUpgradeCheck = 0510; ORGANIZATIONNAME = Syntonicity; TargetAttributes = { 24794CFB18C5F57E004AEB34 = { @@ -352,7 +352,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -391,7 +390,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -451,7 +449,6 @@ 24794D1118C5F57E004AEB34 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UITableView+Reorder.app/UITableView+Reorder"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -474,7 +471,6 @@ 24794D1218C5F57E004AEB34 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UITableView+Reorder.app/UITableView+Reorder"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", diff --git a/UITableView+Reorder/UITableView+Reorder.h b/UITableView+Reorder/UITableView+Reorder.h index 8abe9bf..1770bfe 100644 --- a/UITableView+Reorder/UITableView+Reorder.h +++ b/UITableView+Reorder/UITableView+Reorder.h @@ -1,5 +1,6 @@ // // UITableView+Reorder.h +// Version 1.0.3 // // Created by David W. Stockton on 3/3/14. // Copyright (c) 2014 Syntonicity, LLC. diff --git a/UITableView+Reorder/UITableView+Reorder.m b/UITableView+Reorder/UITableView+Reorder.m index 3e031bf..c3cabd7 100644 --- a/UITableView+Reorder/UITableView+Reorder.m +++ b/UITableView+Reorder/UITableView+Reorder.m @@ -1,5 +1,6 @@ // // UITableView+Reorder.m +// Version 1.0.3 // // Created by David W. Stockton on 3/3/14. // Copyright (c) 2014 Syntonicity, LLC. @@ -954,13 +955,19 @@ - (void) verifyConfiguration { } // If there are different heights, try swapping their locations and make sure heights also swap... if( indexPathForH0 && indexPathForH1 && h0 != h1 ) { - //NSLog( @"The cell at row %d in section %d has a height of %g and row %d in section %d has a height of %g", indexPathForH0.row, indexPathForH0.section, h0, indexPathForH1.row, indexPathForH1.section, h1 ); + DLog( @"Before the faked move, the cell at row %d in section %d has a height of %g and row %d in section %d has a height of %g", indexPathForH0.row, indexPathForH0.section, h0, indexPathForH1.row, indexPathForH1.section, h1 ); self.fromIndexPathOfRowBeingMoved = indexPathForH0; self.toIndexPathForRowBeingMoved = indexPathForH1; - CGFloat h0X = [self.delegate tableView: self heightForRowAtIndexPath: indexPathForH0]; - CGFloat h1X = [self.delegate tableView: self heightForRowAtIndexPath: indexPathForH1]; - //NSLog( @"With row swap the cell at row %d in section %d has a height of %g and row %d in section %d has a height of %g", indexPathForH0.row, indexPathForH0.section, h0X, indexPathForH1.row, indexPathForH1.section, h1X ); - if( h0 != h1X || h1 != h0X ) { + NSIndexPath *newIndexPathForH1; + if( indexPathForH0.section != indexPathForH1.section ) { + newIndexPathForH1 = [NSIndexPath indexPathForRow: indexPathForH1.row + 1 inSection: indexPathForH1.section]; + } else { + newIndexPathForH1 = [NSIndexPath indexPathForRow: indexPathForH1.row - 1 inSection: indexPathForH1.section]; + } + CGFloat h0X = [self.delegate tableView: self heightForRowAtIndexPath: indexPathForH1]; + CGFloat h1X = [self.delegate tableView: self heightForRowAtIndexPath: newIndexPathForH1]; + DLog( @"With row swap the cell at row %d in section %d has a height of %g and row %d in section %d has a height of %g", indexPathForH1.row, indexPathForH1.section, h0X, newIndexPathForH1.row, newIndexPathForH1.section, h1X ); + if( h0 != h0X || h1 != h1X ) { NSLog( @" " ); NSLog( @"*** Warning: indexPath does not appear to be adjusted in tableView delegate method" ); NSLog( @" 'tableView:heightForRowAtIndexPath:'. The index path passed to this" ); @@ -975,6 +982,8 @@ - (void) verifyConfiguration { } self.fromIndexPathOfRowBeingMoved = nil; self.toIndexPathForRowBeingMoved = nil; + } else { + DLog( @"No cells of different heights found." ); } } else { NSLog( @" " ); diff --git a/UITableView+ReorderDemo/UITableView+Reorder-Info.plist b/UITableView+ReorderDemo/UITableView+Reorder-Info.plist index bc9567c..11f2bbc 100644 --- a/UITableView+ReorderDemo/UITableView+Reorder-Info.plist +++ b/UITableView+ReorderDemo/UITableView+Reorder-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.2 + 1.0.3 CFBundleSignature ???? CFBundleVersion - 309 + 315 LSRequiresIPhoneOS UIMainStoryboardFile