From 2888d43ef04a9149569e3c84f716b2460277b055 Mon Sep 17 00:00:00 2001 From: Andrea Mazzini Date: Thu, 7 Aug 2014 16:03:43 +0200 Subject: [PATCH 1/4] Updated sample to show NSInternalInconsistencyException --- .../CSStickyHeaderFlowLayoutDemo.xccheckout | 16 ++++++++-------- .../CSParallaxHeaderViewController.m | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Project/CSStickyHeaderFlowLayoutDemo.xcworkspace/xcshareddata/CSStickyHeaderFlowLayoutDemo.xccheckout b/Project/CSStickyHeaderFlowLayoutDemo.xcworkspace/xcshareddata/CSStickyHeaderFlowLayoutDemo.xccheckout index 8082dae..ecd6a08 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo.xcworkspace/xcshareddata/CSStickyHeaderFlowLayoutDemo.xccheckout +++ b/Project/CSStickyHeaderFlowLayoutDemo.xcworkspace/xcshareddata/CSStickyHeaderFlowLayoutDemo.xccheckout @@ -5,36 +5,36 @@ IDESourceControlProjectFavoriteDictionaryKey IDESourceControlProjectIdentifier - 48E17D25-39A0-4DEC-83D6-22CE1C0C0217 + 3F83CD62-5795-4D2C-B544-27696BCFCC55 IDESourceControlProjectName CSStickyHeaderFlowLayoutDemo IDESourceControlProjectOriginsDictionary - 9FCEA6B4-6BFD-40A1-97AA-77294F4A62B7 - https://github.com/jamztang/CSStickyHeaderFlowLayout.git + 5187E190-6F2C-4DE6-BFD9-C50E3089CF95 + ssh://github.com/andreamazz/CSStickyHeaderFlowLayout.git IDESourceControlProjectPath Project/CSStickyHeaderFlowLayoutDemo.xcworkspace IDESourceControlProjectRelativeInstallPathDictionary - 9FCEA6B4-6BFD-40A1-97AA-77294F4A62B7 + 5187E190-6F2C-4DE6-BFD9-C50E3089CF95 ../.. IDESourceControlProjectURL - https://github.com/jamztang/CSStickyHeaderFlowLayout.git + ssh://github.com/andreamazz/CSStickyHeaderFlowLayout.git IDESourceControlProjectVersion 110 IDESourceControlProjectWCCIdentifier - 9FCEA6B4-6BFD-40A1-97AA-77294F4A62B7 + 5187E190-6F2C-4DE6-BFD9-C50E3089CF95 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - 9FCEA6B4-6BFD-40A1-97AA-77294F4A62B7 + 5187E190-6F2C-4DE6-BFD9-C50E3089CF95 IDESourceControlWCCName - CSStickyHeaderFlowLayout + sticky diff --git a/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m b/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m index 34c939c..be84599 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m +++ b/Project/CSStickyHeaderFlowLayoutDemo/CSParallaxHeaderViewController.m @@ -24,11 +24,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder { if (self) { self.sections = @[ @{@"Twitter":@"http://twitter.com"}, - @{@"Facebook":@"http://facebook.com"}, - @{@"Tumblr":@"http://tumblr.com"}, - @{@"Pinterest":@"http://pinterest.com"}, - @{@"Instagram":@"http://instagram.com"}, - @{@"Github":@"http://github.com"}, + @{@"Facebook":@"http://facebook.com"} ]; self.headerNib = [UINib nibWithNibName:@"CSParallaxHeader" bundle:nil]; @@ -59,7 +55,11 @@ - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - return 1; + if (section == 0) { + return 1; + } + + return 4; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { From 5d3d38da88ebb474c246a9bda9dda6b31273be78 Mon Sep 17 00:00:00 2001 From: James Tang Date: Wed, 17 Sep 2014 08:22:42 +0800 Subject: [PATCH 2/4] fixes #25 Add BaseCell to fix Xcode 6 GM auto layout warning --- .../project.pbxproj | 6 +++++ .../CSAlwaysOnTopHeader.h | 4 +++- .../CSAlwaysOnTopHeader.xib | 23 +++++++------------ .../CSBaseCollectionViewCell.h | 13 +++++++++++ .../CSBaseCollectionViewCell.m | 18 +++++++++++++++ Project/CSStickyHeaderFlowLayoutDemo/CSCell.h | 3 ++- .../CSGrowHeader.xib | 12 ++++++---- .../CSParallaxHeader.xib | 14 +++++++---- .../CSSearchBarHeader.xib | 14 +++++++---- .../CSSectionHeader.xib | 14 +++++++---- 10 files changed, 85 insertions(+), 36 deletions(-) create mode 100644 Project/CSStickyHeaderFlowLayoutDemo/CSBaseCollectionViewCell.h create mode 100644 Project/CSStickyHeaderFlowLayoutDemo/CSBaseCollectionViewCell.m diff --git a/Project/CSStickyHeaderFlowLayoutDemo.xcodeproj/project.pbxproj b/Project/CSStickyHeaderFlowLayoutDemo.xcodeproj/project.pbxproj index 990cfcb..16295b2 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo.xcodeproj/project.pbxproj +++ b/Project/CSStickyHeaderFlowLayoutDemo.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 1A14657818F13832003B643B /* CSStickyParallaxHeaderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A14657718F13832003B643B /* CSStickyParallaxHeaderViewController.m */; }; 1A18AE5518F18764003DC8CF /* CSAlwaysOnTopHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A18AE5418F18764003DC8CF /* CSAlwaysOnTopHeader.xib */; }; 1A18AE5818F1947B003DC8CF /* CSAlwaysOnTopHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A18AE5718F1947B003DC8CF /* CSAlwaysOnTopHeader.m */; }; + 1A7557EA19C8FE95006F894E /* CSBaseCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7557E919C8FE95006F894E /* CSBaseCollectionViewCell.m */; }; 1AC0D88518AA38380072B3F1 /* CSParallaxHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1AC0D88418AA38380072B3F1 /* CSParallaxHeader.xib */; }; 1AC0D88718AA39B50072B3F1 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AC0D88618AA39B50072B3F1 /* MapKit.framework */; }; 1AC0D88918AA3AF80072B3F1 /* CSSearchBarHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1AC0D88818AA3AF80072B3F1 /* CSSearchBarHeader.xib */; }; @@ -55,6 +56,8 @@ 1A18AE5418F18764003DC8CF /* CSAlwaysOnTopHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CSAlwaysOnTopHeader.xib; sourceTree = ""; }; 1A18AE5618F1947B003DC8CF /* CSAlwaysOnTopHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSAlwaysOnTopHeader.h; sourceTree = ""; }; 1A18AE5718F1947B003DC8CF /* CSAlwaysOnTopHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSAlwaysOnTopHeader.m; sourceTree = ""; }; + 1A7557E819C8FE95006F894E /* CSBaseCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSBaseCollectionViewCell.h; sourceTree = ""; }; + 1A7557E919C8FE95006F894E /* CSBaseCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSBaseCollectionViewCell.m; sourceTree = ""; }; 1AC0D88418AA38380072B3F1 /* CSParallaxHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CSParallaxHeader.xib; sourceTree = ""; }; 1AC0D88618AA39B50072B3F1 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; 1AC0D88818AA3AF80072B3F1 /* CSSearchBarHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CSSearchBarHeader.xib; sourceTree = ""; }; @@ -207,6 +210,8 @@ 1AFE098F187D685200CA880A /* Cell */ = { isa = PBXGroup; children = ( + 1A7557E819C8FE95006F894E /* CSBaseCollectionViewCell.h */, + 1A7557E919C8FE95006F894E /* CSBaseCollectionViewCell.m */, 1AFE0990187D688300CA880A /* CSCell.h */, 1AFE0991187D688300CA880A /* CSCell.m */, 1A18AE5618F1947B003DC8CF /* CSAlwaysOnTopHeader.h */, @@ -367,6 +372,7 @@ 1A0117F418AD036800AC836F /* CSGrowHeaderViewController.m in Sources */, 1A14657818F13832003B643B /* CSStickyParallaxHeaderViewController.m in Sources */, 1AC0D88C18AA3B300072B3F1 /* CSLockedHeaderViewController.m in Sources */, + 1A7557EA19C8FE95006F894E /* CSBaseCollectionViewCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.h b/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.h index 935c6bd..d72a7c1 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.h +++ b/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.h @@ -7,10 +7,12 @@ // #import "CSCell.h" +#import "CSBaseCollectionViewCell.h" -@interface CSAlwaysOnTopHeader : CSCell +@interface CSAlwaysOnTopHeader : CSBaseCollectionViewCell @property (weak, nonatomic) IBOutlet UILabel *titleLabel; @property (weak, nonatomic) IBOutlet UISearchBar *searchBar; @end + diff --git a/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.xib b/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.xib index 99281b7..684d1d7 100644 --- a/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.xib +++ b/Project/CSStickyHeaderFlowLayoutDemo/CSAlwaysOnTopHeader.xib @@ -1,7 +1,8 @@ - + - + + @@ -15,22 +16,18 @@ - - @@ -38,37 +35,30 @@ - - - - - @@ -101,7 +90,6 @@