Skip to content
Browse files

Added implementation in PSTCollectionViewFlowLayout for:

- (void)encodeWithCoder:(NSCoder *)coder
Writes out the same keys that are used in initFromCoder.  This fixes an issue where if the flow layout was serialized and then deserialized it wouldn't
contain the original values.
  • Loading branch information...
1 parent 7ce86e1 commit 544a3ca653bda841bc2ceb2c963c4df64e8f35ec jeff96 committed Mar 18, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 PSTCollectionView/PSTCollectionViewFlowLayout.m
View
13 PSTCollectionView/PSTCollectionViewFlowLayout.m
@@ -113,6 +113,19 @@ - (id)initWithCoder:(NSCoder *)decoder {
return self;
}
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+ [super encodeWithCoder:coder];
+
+ [coder encodeCGSize:self.itemSize forKey:@"UIItemSize"];
+ [coder encodeFloat:self.minimumInteritemSpacing forKey:@"UIInteritemSpacing"];
+ [coder encodeFloat:self.minimumLineSpacing forKey:@"UILineSpacing"];
+ [coder encodeCGSize:self.footerReferenceSize forKey:@"UIFooterReferenceSize"];
+ [coder encodeCGSize:self.headerReferenceSize forKey:@"UIHeaderReferenceSize"];
+ [coder encodeUIEdgeInsets:self.sectionInset forKey:@"UISectionInset"];
+ [coder encodeInteger:self.scrollDirection forKey:@"UIScrollDirection"];
+}
+
///////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - PSTCollectionViewLayout

0 comments on commit 544a3ca

Please sign in to comment.
Something went wrong with that request. Please try again.