├── .gitignore ├── Examples ├── Basic │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Cell.h │ ├── Cell.m │ ├── PSCollectionViewExample-Info.plist │ ├── PSCollectionViewExample-Prefix.pch │ ├── PSCollectionViewExample.xcodeproj │ │ └── project.pbxproj │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m ├── BatchUpdate │ ├── BatchUpdate.xcodeproj │ │ └── project.pbxproj │ └── BatchUpdate │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── BatchUpdate-Info.plist │ │ ├── BatchUpdate-Prefix.pch │ │ ├── Cell.h │ │ ├── Cell.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── en.lproj │ │ └── InfoPlist.strings │ │ └── main.m ├── CircleLayout │ ├── CircleLayout.xcodeproj │ │ └── project.pbxproj │ ├── CircleLayout │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Cell.h │ │ ├── Cell.m │ │ ├── CircleLayout-Info.plist │ │ ├── CircleLayout-Prefix.pch │ │ ├── CircleLayout.h │ │ ├── CircleLayout.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── main.m │ └── ReadMe.txt ├── CollectionView-Simple │ ├── CollectionView.xcodeproj │ │ └── project.pbxproj │ ├── CollectionView │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Cell.h │ │ ├── Cell.m │ │ ├── CollectionView-Info.plist │ │ ├── CollectionView-Prefix.pch │ │ ├── CustomCellBackground.h │ │ ├── CustomCellBackground.m │ │ ├── DetailViewController.h │ │ ├── DetailViewController.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── en.lproj │ │ │ └── MainStoryboard.storyboard │ │ ├── images │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default-Landscape@2x.png │ │ │ ├── Default-Landscape@2x~ipad.png │ │ │ ├── Default-Portrait@2x.png │ │ │ ├── Default@2x.png │ │ │ ├── full │ │ │ │ ├── 0_full.JPG │ │ │ │ ├── 10_full.JPG │ │ │ │ ├── 11_full.JPG │ │ │ │ ├── 12_full.JPG │ │ │ │ ├── 13_full.JPG │ │ │ │ ├── 14_full.JPG │ │ │ │ ├── 15_full.JPG │ │ │ │ ├── 16_full.JPG │ │ │ │ ├── 17_full.JPG │ │ │ │ ├── 18_full.JPG │ │ │ │ ├── 19_full.JPG │ │ │ │ ├── 1_full.JPG │ │ │ │ ├── 20_full.JPG │ │ │ │ ├── 21_full.JPG │ │ │ │ ├── 22_full.JPG │ │ │ │ ├── 23_full.JPG │ │ │ │ ├── 24_full.JPG │ │ │ │ ├── 25_full.JPG │ │ │ │ ├── 26_full.JPG │ │ │ │ ├── 27_full.JPG │ │ │ │ ├── 28_full.JPG │ │ │ │ ├── 29_full.JPG │ │ │ │ ├── 2_full.JPG │ │ │ │ ├── 30_full.JPG │ │ │ │ ├── 31_full.JPG │ │ │ │ ├── 3_full.JPG │ │ │ │ ├── 4_full.JPG │ │ │ │ ├── 5_full.JPG │ │ │ │ ├── 6_full.JPG │ │ │ │ ├── 7_full.JPG │ │ │ │ ├── 8_full.JPG │ │ │ │ └── 9_full.JPG │ │ │ └── thumb │ │ │ │ ├── 0.JPG │ │ │ │ ├── 1.JPG │ │ │ │ ├── 10.JPG │ │ │ │ ├── 11.JPG │ │ │ │ ├── 12.JPG │ │ │ │ ├── 13.JPG │ │ │ │ ├── 14.JPG │ │ │ │ ├── 15.JPG │ │ │ │ ├── 16.JPG │ │ │ │ ├── 17.JPG │ │ │ │ ├── 18.JPG │ │ │ │ ├── 19.JPG │ │ │ │ ├── 2.JPG │ │ │ │ ├── 20.JPG │ │ │ │ ├── 21.JPG │ │ │ │ ├── 22.JPG │ │ │ │ ├── 23.JPG │ │ │ │ ├── 24.JPG │ │ │ │ ├── 25.JPG │ │ │ │ ├── 26.JPG │ │ │ │ ├── 27.JPG │ │ │ │ ├── 28.JPG │ │ │ │ ├── 29.JPG │ │ │ │ ├── 3.JPG │ │ │ │ ├── 30.JPG │ │ │ │ ├── 31.JPG │ │ │ │ ├── 4.JPG │ │ │ │ ├── 5.JPG │ │ │ │ ├── 6.JPG │ │ │ │ ├── 7.JPG │ │ │ │ ├── 8.JPG │ │ │ │ └── 9.JPG │ │ └── main.m │ └── ReadMe.txt ├── DecorationViews │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Cell.h │ ├── Cell.m │ ├── CollectionViewLayout.h │ ├── CollectionViewLayout.m │ ├── DecorationView.h │ ├── DecorationView.m │ ├── DecorationViewLayoutAttributes.h │ ├── DecorationViewLayoutAttributes.m │ ├── PSCollectionViewExample-Info.plist │ ├── PSCollectionViewExample.xcodeproj │ │ └── project.pbxproj │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── FlowLayoutHorizontal │ ├── CollectionExample.xcodeproj │ │ └── project.pbxproj │ └── CollectionExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── CollectionExample-Info.plist │ │ ├── CollectionExample-Prefix.pch │ │ ├── Default-568h@2x.png │ │ ├── Default.png │ │ ├── Default@2x.png │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ └── MainStoryboard.storyboard │ │ └── main.m ├── FlowLayoutNoNIB │ ├── FlowLayoutNoNIB.xcodeproj │ │ └── project.pbxproj │ └── FlowLayoutNoNIB │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── CollectionViewCell.h │ │ ├── CollectionViewCell.m │ │ ├── Default-568h@2x.png │ │ ├── Default.png │ │ ├── Default@2x.png │ │ ├── FlowLayoutNoNIB-Info.plist │ │ ├── FlowLayoutNoNIB-Prefix.pch │ │ ├── FooterView.h │ │ ├── FooterView.m │ │ ├── HeaderView.h │ │ ├── HeaderView.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── en.lproj │ │ └── InfoPlist.strings │ │ └── main.m ├── LineLayout │ ├── LineLayout.xcodeproj │ │ └── project.pbxproj │ ├── LineLayout │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Cell.h │ │ ├── Cell.m │ │ ├── LineLayout-Info.plist │ │ ├── LineLayout-Prefix.pch │ │ ├── LineLayout.h │ │ ├── LineLayout.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── main.m │ └── ReadMe.txt ├── PinchIt │ ├── PinchIt.xcodeproj │ │ └── project.pbxproj │ ├── PinchIt │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Cell.h │ │ ├── Cell.m │ │ ├── PinchIt-Info.plist │ │ ├── PinchIt-Prefix.pch │ │ ├── PinchLayout.h │ │ ├── PinchLayout.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── main.m │ └── ReadMe.txt └── SelectionDelegateExample │ ├── SelectionDelegateExample.xcodeproj │ └── project.pbxproj │ └── SelectionDelegateExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── ImageGridCell.h │ ├── ImageGridCell.m │ ├── SelectionDelegateExample-Info.plist │ ├── SelectionDelegateExample-Prefix.pch │ ├── UILabel+Highlight.h │ ├── UILabel+Highlight.m │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── HowTo.md ├── LICENSE ├── PSTCollectionView.podspec ├── PSTCollectionView ├── NSIndexPath+PSTCollectionViewAdditions.h ├── NSIndexPath+PSTCollectionViewAdditions.m ├── PSTCollectionView.h ├── PSTCollectionView.m ├── PSTCollectionViewCell.h ├── PSTCollectionViewCell.m ├── PSTCollectionViewCommon.h ├── PSTCollectionViewController.h ├── PSTCollectionViewController.m ├── PSTCollectionViewData.h ├── PSTCollectionViewData.m ├── PSTCollectionViewFlowLayout.h ├── PSTCollectionViewFlowLayout.m ├── PSTCollectionViewItemKey.h ├── PSTCollectionViewItemKey.m ├── PSTCollectionViewLayout+Internals.h ├── PSTCollectionViewLayout.h ├── PSTCollectionViewLayout.m ├── PSTCollectionViewUpdateItem.h ├── PSTCollectionViewUpdateItem.m ├── PSTGridLayoutInfo.h ├── PSTGridLayoutInfo.m ├── PSTGridLayoutItem.h ├── PSTGridLayoutItem.m ├── PSTGridLayoutRow.h ├── PSTGridLayoutRow.m ├── PSTGridLayoutSection.h └── PSTGridLayoutSection.m └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build/* 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | .DS_Store 17 | -------------------------------------------------------------------------------- /Examples/Basic/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PSTCollectionView.h" 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/Basic/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "AppDelegate.h" 9 | #import "ViewController.h" 10 | #import "PSTCollectionViewFlowLayout.h" 11 | 12 | @interface AppDelegate () 13 | @property (strong, nonatomic) ViewController *viewController; 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 20 | self.viewController = [[ViewController alloc] initWithCollectionViewLayout:[PSUICollectionViewFlowLayout new]]; 21 | 22 | self.window.rootViewController = self.viewController; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Examples/Basic/Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // Cell.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PSTCollectionViewCell.h" 10 | 11 | @interface Cell : PSUICollectionViewCell 12 | 13 | @property (strong, nonatomic) UILabel* label; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/Basic/Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // Cell.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "Cell.h" 9 | 10 | @implementation Cell 11 | 12 | - (id)initWithFrame:(CGRect)frame { 13 | if ((self = [super initWithFrame:frame])) { 14 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, frame.size.width, frame.size.height)]; 15 | label.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; 16 | label.textAlignment = UITextAlignmentCenter; 17 | label.font = [UIFont boldSystemFontOfSize:50.0]; 18 | label.backgroundColor = [UIColor underPageBackgroundColor]; 19 | label.textColor = [UIColor blackColor]; 20 | [self.contentView addSubview:label]; 21 | _label = label; 22 | } 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Examples/Basic/PSCollectionViewExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apple.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/Basic/PSCollectionViewExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #ifndef __IPHONE_4_3 4 | #error "This project uses features only available in iOS SDK 4.3 and later." 5 | #endif 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #import "PSTCollectionView.h" 11 | #endif 12 | -------------------------------------------------------------------------------- /Examples/Basic/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PSTCollectionView.h" 10 | 11 | @interface ViewController : PSUICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Basic/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "ViewController.h" 9 | #import "Cell.h" 10 | 11 | #define kPSTEnableFastAnimationTest 12 | 13 | @interface ViewController () 14 | @property (atomic, readwrite, assign) NSInteger cellCount; 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.cellCount = 10; 23 | [self.collectionView registerClass:[Cell class] forCellWithReuseIdentifier:@"MY_CELL"]; 24 | 25 | #ifdef kPSTEnableFastAnimationTest 26 | double delayInSeconds = 1.0; 27 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); 28 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ 29 | [self addMoreCells]; 30 | }); 31 | #endif 32 | } 33 | 34 | /////////////////////////////////////////////////////////////////////////////////////////// 35 | #pragma mark - PSTCollectionViewDataSource 36 | 37 | - (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section { 38 | return self.cellCount; 39 | } 40 | 41 | /////////////////////////////////////////////////////////////////////////////////////////// 42 | #pragma mark - PSTCollectionViewDelegate 43 | 44 | - (PSUICollectionViewCell *)collectionView:(PSUICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 45 | Cell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MY_CELL" forIndexPath:indexPath]; 46 | return cell; 47 | } 48 | 49 | /////////////////////////////////////////////////////////////////////////////////////////// 50 | #pragma mark - PSTCollectionViewDelegateFlowLayout 51 | 52 | - (CGSize)collectionView:(PSUICollectionView *)collectionView layout:(PSUICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { 53 | return CGSizeMake(200, 200); 54 | } 55 | 56 | - (CGFloat)collectionView:(PSUICollectionView *)collectionView layout:(PSUICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { 57 | return 10; 58 | } 59 | 60 | - (CGFloat)collectionView:(PSUICollectionView *)collectionView layout:(PSUICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { 61 | return 50; 62 | } 63 | 64 | //------------------------------------------------------------------------------ 65 | #pragma mark - UIScrollViewDelegate Methods 66 | 67 | #ifdef kPSTEnableFastAnimationTest 68 | - (void)addMoreCells { 69 | if (!self.isViewLoaded || !self.view.window) return; 70 | 71 | // Add a cell 72 | self.cellCount += 1; 73 | [self.collectionView performBatchUpdates:^{ 74 | NSIndexPath *path = [NSIndexPath indexPathForItem:0 inSection:0]; 75 | [self.collectionView insertItemsAtIndexPaths:@[path]]; 76 | } completion:nil]; 77 | 78 | // Wait a bit to add more 79 | double delayInSeconds = 0.25; 80 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); 81 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ 82 | [self addMoreCells]; 83 | }); 84 | } 85 | #endif 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /Examples/Basic/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/Basic/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "AppDelegate.h" 10 | 11 | int main(int argc, char *argv[]) { 12 | @autoreleasepool { 13 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // BatchUpdate 4 | // 5 | // Created by Alex Burgel on 4/17/13. 6 | // 7 | // 8 | 9 | @class ViewController; 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @property (strong, nonatomic) ViewController *viewController; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // BatchUpdate 4 | // 5 | // Created by Alex Burgel on 4/17/13. 6 | // 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | 18 | PSUICollectionViewFlowLayout *layout = [[PSUICollectionViewFlowLayout alloc] init]; 19 | layout.sectionInset = UIEdgeInsetsMake(70, 0, 0, 0); 20 | 21 | self.viewController = [[ViewController alloc] initWithCollectionViewLayout:layout]; 22 | 23 | self.window.rootViewController = self.viewController; 24 | [self.window makeKeyAndVisible]; 25 | return YES; 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/BatchUpdate-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apple.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/BatchUpdate-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'BatchUpdate' target in the 'BatchUpdate' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import "PSTCollectionView.h" 15 | #endif 16 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/Cell.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Cell.h 4 | Abstract: 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | 98 | @interface Cell : PSUICollectionViewCell 99 | 100 | @property (strong, nonatomic) UILabel* label; 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/ViewController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: ViewController.h 4 | Abstract: 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | @interface ViewController : PSUICollectionViewController 98 | 99 | @property (nonatomic, strong) NSMutableArray* sections; 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/BatchUpdate/BatchUpdate/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // BatchUpdate 4 | // 5 | // Created by Alex Burgel on 4/17/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/CircleLayout/CircleLayout/Cell.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Cell.h 4 | Abstract: 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | 98 | @interface Cell : PSUICollectionViewCell 99 | 100 | @property (strong, nonatomic) UILabel* label; 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /Examples/CircleLayout/CircleLayout/CircleLayout-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apple.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/CircleLayout/CircleLayout/CircleLayout-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CircleLayout' target in the 'CircleLayout' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_3 8 | #warning "This project uses features only available in iOS SDK 4.3 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import "PSTCollectionView.h" 15 | #endif 16 | -------------------------------------------------------------------------------- /Examples/CircleLayout/CircleLayout/ViewController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: ViewController.h 4 | Abstract: 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | @interface ViewController : PSUICollectionViewController 98 | 99 | @property (nonatomic, strong) NSMutableArray* sections; 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Examples/CircleLayout/CircleLayout/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/CircleLayout/ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | ### CircleLayout ### 3 | 4 | =========================================================================== 5 | DESCRIPTION: 6 | 7 | Shows how to use a collection view to arrange views on a circle and use custom animations when inserting and removing items. 8 | 9 | =========================================================================== 10 | CHANGES FROM PREVIOUS VERSIONS: 11 | 12 | Version 1.0 13 | - First version. 14 | 15 | =========================================================================== 16 | Copyright (C) 2012 Apple Inc. All rights reserved. 17 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: AppDelegate.h 3 | Abstract: The sample's application delegate. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import 50 | 51 | @interface AppDelegate : UIResponder 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: AppDelegate.m 3 | Abstract: The sample's application delegate. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import "AppDelegate.h" 50 | 51 | @implementation AppDelegate 52 | 53 | @synthesize window = _window; 54 | 55 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 56 | { 57 | // Override point for customization after application launch. 58 | return YES; 59 | } 60 | 61 | - (void)applicationWillResignActive:(UIApplication *)application 62 | { 63 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 64 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 65 | } 66 | 67 | - (void)applicationDidEnterBackground:(UIApplication *)application 68 | { 69 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 70 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 71 | } 72 | 73 | - (void)applicationWillEnterForeground:(UIApplication *)application 74 | { 75 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 76 | } 77 | 78 | - (void)applicationDidBecomeActive:(UIApplication *)application 79 | { 80 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 81 | } 82 | 83 | - (void)applicationWillTerminate:(UIApplication *)application 84 | { 85 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/Cell.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: Cell.h 3 | Abstract: Custom collection view cell for image and its label. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import 50 | 51 | @interface Cell : PSUICollectionViewCell 52 | 53 | @property (strong, nonatomic) IBOutlet UIImageView *image; 54 | @property (strong, nonatomic) IBOutlet UILabel *label; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/Cell.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: Cell.m 3 | Abstract: Custom collection view cell for image and its label. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import "Cell.h" 50 | #import "CustomCellBackground.h" 51 | 52 | @implementation Cell 53 | 54 | - (id)initWithCoder:(NSCoder *)aDecoder 55 | { 56 | self = [super initWithCoder:aDecoder]; 57 | if (self) 58 | { 59 | // change to our custom selected background view 60 | CustomCellBackground *backgroundView = [[CustomCellBackground alloc] initWithFrame:CGRectZero]; 61 | self.selectedBackgroundView = backgroundView; 62 | } 63 | return self; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/CollectionView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | company.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/CollectionView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CollectionView' target in the 'CollectionView' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import "PSTCollectionView.h" 15 | #endif 16 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/CustomCellBackground.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: CustomCellBackground.h 3 | Abstract: Custom UIView to draw a rounded blue box to represent a selected cell. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import 50 | 51 | @interface CustomCellBackground : UIView 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/CustomCellBackground.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: CustomCellBackground.m 3 | Abstract: Custom UIView to draw a rounded blue box to represent a selected cell. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import "CustomCellBackground.h" 50 | 51 | @implementation CustomCellBackground 52 | 53 | - (void)drawRect:(CGRect)rect 54 | { 55 | // draw a rounded rect bezier path filled with blue 56 | CGContextRef aRef = UIGraphicsGetCurrentContext(); 57 | CGContextSaveGState(aRef); 58 | UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:5.0f]; 59 | [bezierPath setLineWidth:5.0f]; 60 | [[UIColor blackColor] setStroke]; 61 | 62 | UIColor *fillColor = [UIColor colorWithRed:0.529 green:0.808 blue:0.922 alpha:1]; // color equivalent is #87ceeb 63 | [fillColor setFill]; 64 | 65 | [bezierPath stroke]; 66 | [bezierPath fill]; 67 | CGContextRestoreGState(aRef); 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/DetailViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: DetailViewController.h 3 | Abstract: The secondary detailed view controller for this app. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import 50 | 51 | @interface DetailViewController : UIViewController 52 | 53 | @property (nonatomic, strong) UIImage *image; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/DetailViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: DetailViewController.m 3 | Abstract: The secondary detailed view controller for this app. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import "DetailViewController.h" 50 | 51 | @interface DetailViewController () 52 | @property (nonatomic, weak) IBOutlet UIImageView *imageView; 53 | @end 54 | 55 | @implementation DetailViewController 56 | 57 | - (void)viewWillAppear:(BOOL)animated 58 | { 59 | [super viewWillAppear:animated]; 60 | self.imageView.image = self.image; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/ViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | File: ViewController.h 3 | Abstract: The primary view controller for this app. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import 50 | 51 | @interface ViewController : PSUICollectionViewController 52 | @end 53 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/Default-568h@2x.png -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/Default-Landscape@2x.png -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/Default-Portrait@2x.png -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/Default@2x.png -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/0_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/0_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/10_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/10_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/11_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/11_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/12_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/12_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/13_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/13_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/14_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/14_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/15_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/15_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/16_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/16_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/17_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/17_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/18_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/18_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/19_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/19_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/1_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/1_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/20_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/20_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/21_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/21_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/22_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/22_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/23_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/23_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/24_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/24_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/25_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/25_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/26_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/26_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/27_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/27_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/28_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/28_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/29_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/29_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/2_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/2_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/30_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/30_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/31_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/31_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/3_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/3_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/4_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/4_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/5_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/5_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/6_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/6_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/7_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/7_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/8_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/8_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/full/9_full.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/full/9_full.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/0.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/0.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/1.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/10.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/10.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/11.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/11.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/12.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/12.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/13.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/13.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/14.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/14.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/15.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/15.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/16.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/16.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/17.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/17.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/18.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/18.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/19.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/19.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/2.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/20.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/20.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/21.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/21.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/22.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/22.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/23.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/23.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/24.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/24.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/25.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/25.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/26.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/26.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/27.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/27.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/28.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/28.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/29.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/29.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/3.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/30.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/30.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/31.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/31.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/4.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/5.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/5.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/6.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/6.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/7.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/7.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/8.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/8.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/images/thumb/9.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/CollectionView-Simple/CollectionView/images/thumb/9.JPG -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/CollectionView/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | File: main.m 3 | Abstract: Main source file for this sample. 4 | 5 | Version: 1.0 6 | 7 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 8 | Inc. ("Apple") in consideration of your agreement to the following 9 | terms, and your use, installation, modification or redistribution of 10 | this Apple software constitutes acceptance of these terms. If you do 11 | not agree with these terms, please do not use, install, modify or 12 | redistribute this Apple software. 13 | 14 | In consideration of your agreement to abide by the following terms, and 15 | subject to these terms, Apple grants you a personal, non-exclusive 16 | license, under Apple's copyrights in this original Apple software (the 17 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 18 | Software, with or without modifications, in source and/or binary forms; 19 | provided that if you redistribute the Apple Software in its entirety and 20 | without modifications, you must retain this notice and the following 21 | text and disclaimers in all such redistributions of the Apple Software. 22 | Neither the name, trademarks, service marks or logos of Apple Inc. may 23 | be used to endorse or promote products derived from the Apple Software 24 | without specific prior written permission from Apple. Except as 25 | expressly stated in this notice, no other rights or licenses, express or 26 | implied, are granted by Apple herein, including but not limited to any 27 | patent rights that may be infringed by your derivative works or by other 28 | works in which the Apple Software may be incorporated. 29 | 30 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 31 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 32 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 34 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 35 | 36 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 37 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 40 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 41 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 42 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 43 | POSSIBILITY OF SUCH DAMAGE. 44 | 45 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 46 | 47 | */ 48 | 49 | #import 50 | 51 | #import "AppDelegate.h" 52 | 53 | int main(int argc, char *argv[]) 54 | { 55 | @autoreleasepool { 56 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Examples/CollectionView-Simple/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ### CollectionView-Simple ### 2 | 3 | =========================================================================== 4 | DESCRIPTION: 5 | 6 | Demonstrates how to use UICollectionView, a way to present ordered data to users in a grid-like fashion. With a collection view object, you are able to define the presentation and arrangement of embedded views. The collection view class works closely with an accompanying layout object to define the placement of individual data items. In this example UIKit provides a standard flow-based layout object that you can use to implement multi-column grids containing items of a standard size. 7 | 8 | When you run the sample, tap each image to navigate to a detailed view of that image. The app also shows how to implement a custom cell and custom selection by subclassing UICollectionViewCell. 9 | 10 | =========================================================================== 11 | BUILD REQUIREMENTS: 12 | 13 | iOS SDK 6.0 14 | 15 | =========================================================================== 16 | RUNTIME REQUIREMENTS: 17 | 18 | iOS 6.0 19 | 20 | =========================================================================== 21 | CHANGES FROM PREVIOUS VERSIONS: 22 | 23 | 1.0 - First version. 24 | 25 | =========================================================================== 26 | Copyright (C) 2012 Apple Inc. All rights reserved. 27 | -------------------------------------------------------------------------------- /Examples/DecorationViews/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PSTCollectionView.h" 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/DecorationViews/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "AppDelegate.h" 9 | #import "ViewController.h" 10 | #import "CollectionViewLayout.h" 11 | 12 | @interface AppDelegate () 13 | @property (strong, nonatomic) ViewController *viewController; 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 20 | self.viewController = [[ViewController alloc] initWithCollectionViewLayout:[CollectionViewLayout new]]; 21 | 22 | self.window.rootViewController = self.viewController; 23 | [self.window makeKeyAndVisible]; 24 | return YES; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Examples/DecorationViews/Cell.h: -------------------------------------------------------------------------------- 1 | // 2 | // Cell.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PSTCollectionView.h" 10 | 11 | @interface Cell : PSUICollectionViewCell 12 | 13 | @property (strong, nonatomic) UILabel* label; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/DecorationViews/Cell.m: -------------------------------------------------------------------------------- 1 | // 2 | // Cell.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "Cell.h" 9 | 10 | @implementation Cell 11 | 12 | - (id)initWithFrame:(CGRect)frame { 13 | if ((self = [super initWithFrame:frame])) { 14 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, frame.size.width, frame.size.height)]; 15 | label.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; 16 | label.textAlignment = UITextAlignmentCenter; 17 | label.font = [UIFont boldSystemFontOfSize:50.0]; 18 | label.backgroundColor = [UIColor underPageBackgroundColor]; 19 | label.textColor = [UIColor blackColor]; 20 | [self.contentView addSubview:label]; 21 | _label = label; 22 | } 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Examples/DecorationViews/CollectionViewLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewLayout.h 3 | // PSCollectionViewExample 4 | // 5 | // Created by Scott Talbot on 7/03/13. 6 | // 7 | 8 | #import "PSTCollectionView.h" 9 | 10 | @interface CollectionViewLayout : PSUICollectionViewFlowLayout 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Examples/DecorationViews/CollectionViewLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewLayout.m 3 | // PSCollectionViewExample 4 | // 5 | // Created by Scott Talbot on 7/03/13. 6 | // 7 | 8 | #import "CollectionViewLayout.h" 9 | #import "DecorationViewLayoutAttributes.h" 10 | #import "DecorationView.h" 11 | 12 | @implementation CollectionViewLayout 13 | 14 | - (id)init { 15 | if ((self = [super init])) { 16 | [self registerClass:[DecorationView class] forDecorationViewOfKind:@"DecorationView1"]; 17 | [self registerClass:[DecorationView class] forDecorationViewOfKind:@"DecorationView2"]; 18 | } 19 | return self; 20 | } 21 | 22 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { 23 | NSMutableArray *layoutAttributes = [NSMutableArray arrayWithArray:[super layoutAttributesForElementsInRect:rect]]; 24 | 25 | CGSize const collectionViewContentSize = self.collectionViewContentSize; 26 | 27 | { 28 | DecorationViewLayoutAttributes *attributes = [DecorationViewLayoutAttributes layoutAttributesForDecorationViewOfKind:@"DecorationView1" withIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; 29 | attributes.frame = (CGRect){ 30 | .size.width = collectionViewContentSize.width / 2., 31 | .size.height = collectionViewContentSize.height 32 | }; 33 | attributes.backgroundColor = [UIColor redColor]; 34 | [layoutAttributes addObject:attributes]; 35 | } 36 | { 37 | DecorationViewLayoutAttributes *attributes = [DecorationViewLayoutAttributes layoutAttributesForDecorationViewOfKind:@"DecorationView2" withIndexPath:[NSIndexPath indexPathForItem:0 inSection:0]]; 38 | attributes.frame = (CGRect){ 39 | .origin.x = collectionViewContentSize.width / 2., 40 | .size.width = collectionViewContentSize.width / 2., 41 | .size.height = collectionViewContentSize.height 42 | }; 43 | attributes.backgroundColor = [UIColor blueColor]; 44 | [layoutAttributes addObject:attributes]; 45 | } 46 | 47 | return layoutAttributes; 48 | } 49 | 50 | - (PSTCollectionViewLayoutAttributes *)layoutAttributesForDecorationViewOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { 51 | CGSize const collectionViewContentSize = self.collectionViewContentSize; 52 | 53 | if ([@"DecorationView1" isEqualToString:kind]) { 54 | DecorationViewLayoutAttributes *attributes = [DecorationViewLayoutAttributes layoutAttributesForDecorationViewOfKind:kind withIndexPath:indexPath]; 55 | attributes.frame = (CGRect){ 56 | .size.width = collectionViewContentSize.width / 2., 57 | .size.height = collectionViewContentSize.height 58 | }; 59 | attributes.backgroundColor = [UIColor redColor]; 60 | return attributes; 61 | } 62 | 63 | if ([@"DecorationView2" isEqualToString:kind]) { 64 | DecorationViewLayoutAttributes *attributes = [DecorationViewLayoutAttributes layoutAttributesForDecorationViewOfKind:kind withIndexPath:indexPath]; 65 | attributes.frame = (CGRect){ 66 | .origin.x = collectionViewContentSize.width / 2., 67 | .size.width = collectionViewContentSize.width / 2., 68 | .size.height = collectionViewContentSize.height 69 | }; 70 | attributes.backgroundColor = [UIColor redColor]; 71 | return attributes; 72 | } 73 | 74 | return nil; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Examples/DecorationViews/DecorationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DecorationView.h 3 | // PSCollectionViewExample 4 | // 5 | // Created by Scott Talbot on 7/03/13. 6 | // 7 | 8 | #import "PSTCollectionView.h" 9 | 10 | @interface DecorationView : PSUICollectionReusableView 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Examples/DecorationViews/DecorationView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DecorationView.m 3 | // PSCollectionViewExample 4 | // 5 | // Created by Scott Talbot on 7/03/13. 6 | // 7 | 8 | #import "DecorationView.h" 9 | #import "DecorationViewLayoutAttributes.h" 10 | 11 | 12 | @implementation DecorationView 13 | 14 | - (void)applyLayoutAttributes:(PSTCollectionViewLayoutAttributes *)layoutAttributes { 15 | DecorationViewLayoutAttributes *decorationAttributes = nil; 16 | if ([layoutAttributes isKindOfClass:[DecorationViewLayoutAttributes class]]) { 17 | decorationAttributes = (DecorationViewLayoutAttributes *)layoutAttributes; 18 | } 19 | 20 | UIColor * const backgroundColor = decorationAttributes.backgroundColor ?: [UIColor orangeColor]; 21 | self.backgroundColor = [backgroundColor colorWithAlphaComponent:.5]; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Examples/DecorationViews/DecorationViewLayoutAttributes.h: -------------------------------------------------------------------------------- 1 | // 2 | // DecorationViewLayoutAttributes.h 3 | // PSCollectionViewExample 4 | // 5 | // Created by Scott Talbot on 7/03/13. 6 | // 7 | 8 | #import "PSTCollectionView.h" 9 | 10 | @interface DecorationViewLayoutAttributes : PSUICollectionViewLayoutAttributes 11 | 12 | @property (nonatomic,strong) UIColor *backgroundColor; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Examples/DecorationViews/DecorationViewLayoutAttributes.m: -------------------------------------------------------------------------------- 1 | // 2 | // DecorationViewLayoutAttributes.m 3 | // PSCollectionViewExample 4 | // 5 | // Created by Scott Talbot on 7/03/13. 6 | // 7 | 8 | #import "DecorationViewLayoutAttributes.h" 9 | 10 | @implementation DecorationViewLayoutAttributes 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Examples/DecorationViews/PSCollectionViewExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apple.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/DecorationViews/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PSTCollectionView.h" 10 | 11 | @interface ViewController : PSUICollectionViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/DecorationViews/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "ViewController.h" 9 | #import "Cell.h" 10 | #import "DecorationView.h" 11 | 12 | @interface ViewController () 13 | @property (atomic, readwrite, assign) NSInteger cellCount; 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | /////////////////////////////////////////////////////////////////////////////////////////// 19 | #pragma mark - UIViewController 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | self.cellCount = 10; 25 | [self.collectionView registerClass:[Cell class] forCellWithReuseIdentifier:@"MY_CELL"]; 26 | } 27 | 28 | /////////////////////////////////////////////////////////////////////////////////////////// 29 | #pragma mark - PSTCollectionViewDataSource 30 | 31 | - (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section { 32 | return self.cellCount; 33 | } 34 | 35 | /////////////////////////////////////////////////////////////////////////////////////////// 36 | #pragma mark - PSTCollectionViewDelegate 37 | 38 | - (PSTCollectionViewCell *)collectionView:(PSTCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 39 | Cell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MY_CELL" forIndexPath:indexPath]; 40 | return cell; 41 | } 42 | 43 | /////////////////////////////////////////////////////////////////////////////////////////// 44 | #pragma mark - PSTCollectionViewDelegateFlowLayout 45 | 46 | - (CGSize)collectionView:(PSTCollectionView *)collectionView layout:(PSTCollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { 47 | return CGSizeMake(200, 200); 48 | } 49 | 50 | - (CGFloat)collectionView:(PSTCollectionView *)collectionView layout:(PSTCollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { 51 | return 10; 52 | } 53 | 54 | - (CGFloat)collectionView:(PSTCollectionView *)collectionView layout:(PSTCollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { 55 | return 50; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Examples/DecorationViews/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "AppDelegate.h" 10 | 11 | int main(int argc, char *argv[]) { 12 | @autoreleasepool { 13 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CollectionExample 4 | // 5 | // Created by Barry Haanstra on 19-10-12. 6 | // Copyright (c) 2012 Haanstra. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CollectionExample 4 | // 5 | // Created by Barry Haanstra on 19-10-12. 6 | // Copyright (c) 2012 Haanstra. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/CollectionExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | eu.haanstra.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/CollectionExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CollectionExample' target in the 'CollectionExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/FlowLayoutHorizontal/CollectionExample/Default-568h@2x.png -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/FlowLayoutHorizontal/CollectionExample/Default.png -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/FlowLayoutHorizontal/CollectionExample/Default@2x.png -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CollectionExample 4 | // 5 | // Created by Barry Haanstra on 19-10-12. 6 | // Copyright (c) 2012 Haanstra. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PSTCollectionView.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @property (weak, nonatomic) IBOutlet PSUICollectionView *collectionView; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CollectionExample 4 | // 5 | // Created by Barry Haanstra on 19-10-12. 6 | // Copyright (c) 2012 Haanstra. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @implementation ViewController { 12 | NSArray *data; 13 | } 14 | 15 | static NSString *cellIdentifier = @"TestCell"; 16 | static NSString *headerViewIdentifier = @"Test Header View"; 17 | static NSString *footerViewIdentifier = @"Test Footer View"; 18 | 19 | 20 | #pragma mark - 21 | #pragma mark Rotation stuff 22 | 23 | - (BOOL)shouldAutorotate { 24 | return YES; 25 | } 26 | 27 | 28 | - (NSUInteger)supportedInterfaceOrientations { 29 | return UIInterfaceOrientationMaskLandscape; 30 | } 31 | 32 | 33 | - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 34 | return UIInterfaceOrientationLandscapeLeft; 35 | } 36 | 37 | 38 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { 39 | if ((orientation == UIInterfaceOrientationLandscapeRight) || (orientation == UIInterfaceOrientationLandscapeLeft)) { 40 | return YES; 41 | } 42 | 43 | return NO; 44 | } 45 | 46 | 47 | #pragma mark - 48 | #pragma mark Setup 49 | 50 | - (void)viewDidLoad { 51 | [super viewDidLoad]; 52 | 53 | data = @[ 54 | @[@"One", @"Two", @"Three"], 55 | @[@"Four", @"Five", @"Six"], 56 | @[], 57 | @[@"Seven"], 58 | ]; 59 | } 60 | 61 | 62 | #pragma mark - 63 | #pragma mark PSUICollectionView stuff 64 | 65 | - (NSInteger)numberOfSectionsInCollectionView:(PSUICollectionView *)collectionView { 66 | return [data count]; 67 | } 68 | 69 | 70 | - (NSInteger)collectionView:(PSUICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 71 | return [[data objectAtIndex:section] count]; 72 | } 73 | 74 | 75 | - (PSUICollectionViewCell *)collectionView:(PSUICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 76 | PSUICollectionViewCell *cell = (PSUICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath]; 77 | 78 | UILabel *label = (UILabel *)[cell viewWithTag:123]; 79 | label.text = [[data objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; 80 | 81 | return cell; 82 | } 83 | 84 | - (PSUICollectionReusableView *)collectionView:(PSUICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { 85 | NSString *identifier = nil; 86 | 87 | if ([kind isEqualToString:PSTCollectionElementKindSectionHeader]) { 88 | identifier = headerViewIdentifier; 89 | } else if ([kind isEqualToString:PSTCollectionElementKindSectionFooter]) { 90 | identifier = footerViewIdentifier; 91 | } 92 | PSUICollectionReusableView *supplementaryView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:identifier forIndexPath:indexPath]; 93 | 94 | // TODO Setup view 95 | 96 | return supplementaryView; 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/FlowLayoutHorizontal/CollectionExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CollectionExample 4 | // 5 | // Created by Barry Haanstra on 19-10-12. 6 | // Copyright (c) 2012 Haanstra. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | self.window.backgroundColor = [UIColor whiteColor]; 18 | self.window.rootViewController = [[ViewController alloc] init]; 19 | [self.window makeKeyAndVisible]; 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application 24 | { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 27 | } 28 | 29 | - (void)applicationDidEnterBackground:(UIApplication *)application 30 | { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | - (void)applicationWillEnterForeground:(UIApplication *)application 36 | { 37 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | - (void)applicationDidBecomeActive:(UIApplication *)application 41 | { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | - (void)applicationWillTerminate:(UIApplication *)application 46 | { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/CollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.h 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "PSTCollectionView.h" 10 | 11 | @interface CollectionViewCell : PSUICollectionViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/CollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.m 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "CollectionViewCell.h" 10 | 11 | @implementation CollectionViewCell 12 | 13 | - (id)initWithFrame:(CGRect)frame { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | [self setBackgroundColor:[UIColor yellowColor]]; 17 | 18 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, floor((CGRectGetHeight(self.bounds)-30)/2), CGRectGetWidth(self.bounds), 30)]; 19 | [label setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin]; 20 | [label setTag:123]; 21 | [label setBackgroundColor:[UIColor clearColor]]; 22 | [label setTextAlignment:NSTextAlignmentCenter]; 23 | [self addSubview:label]; 24 | } 25 | return self; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/Default-568h@2x.png -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/Default.png -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/Default@2x.png -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/FlowLayoutNoNIB-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.blanchealley.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/FlowLayoutNoNIB-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FlowLayoutNoNIB' target in the 'FlowLayoutNoNIB' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/FooterView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FooterView.h 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "PSTCollectionView.h" 10 | 11 | @interface FooterView : PSUICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/FooterView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FooterView.m 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "FooterView.h" 10 | 11 | @implementation FooterView 12 | 13 | - (id)initWithFrame:(CGRect)frame { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | [self setBackgroundColor:[UIColor purpleColor]]; 17 | } 18 | return self; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/HeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HeaderView.h 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "PSTCollectionView.h" 10 | 11 | @interface HeaderView : PSUICollectionReusableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/HeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HeaderView.m 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "HeaderView.h" 10 | 11 | @implementation HeaderView 12 | 13 | - (id)initWithFrame:(CGRect)frame { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | [self setBackgroundColor:[UIColor greenColor]]; 17 | } 18 | return self; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import 10 | #import "PSTCollectionView.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "CollectionViewCell.h" 11 | #import "HeaderView.h" 12 | #import "FooterView.h" 13 | 14 | @interface ViewController () 15 | 16 | @property (strong, nonatomic) PSUICollectionView *collectionView; 17 | 18 | @end 19 | 20 | 21 | @implementation ViewController { 22 | NSArray *data; 23 | } 24 | 25 | static NSString *cellIdentifier = @"TestCell"; 26 | static NSString *headerViewIdentifier = @"Test Header View"; 27 | static NSString *footerViewIdentifier = @"Test Footer View"; 28 | 29 | 30 | #pragma mark - 31 | #pragma mark Rotation stuff 32 | 33 | - (BOOL)shouldAutorotate { 34 | return YES; 35 | } 36 | 37 | 38 | - (NSUInteger)supportedInterfaceOrientations { 39 | return UIInterfaceOrientationMaskLandscape; 40 | } 41 | 42 | 43 | - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { 44 | return UIInterfaceOrientationLandscapeLeft; 45 | } 46 | 47 | 48 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { 49 | if ((orientation == UIInterfaceOrientationLandscapeRight) || (orientation == UIInterfaceOrientationLandscapeLeft)) { 50 | return YES; 51 | } 52 | 53 | return NO; 54 | } 55 | 56 | 57 | #pragma mark - 58 | #pragma mark Setup 59 | 60 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 61 | { 62 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 63 | if (self) { 64 | } 65 | return self; 66 | } 67 | 68 | - (void)loadView { 69 | [super loadView]; 70 | 71 | self.view.backgroundColor = [UIColor scrollViewTexturedBackgroundColor]; 72 | 73 | PSUICollectionViewFlowLayout *collectionViewFlowLayout = [[PSUICollectionViewFlowLayout alloc] init]; 74 | 75 | [collectionViewFlowLayout setScrollDirection:UICollectionViewScrollDirectionVertical]; 76 | [collectionViewFlowLayout setItemSize:CGSizeMake(245, 250)]; 77 | [collectionViewFlowLayout setHeaderReferenceSize:CGSizeMake(500, 30)]; 78 | [collectionViewFlowLayout setFooterReferenceSize:CGSizeMake(500, 50)]; 79 | [collectionViewFlowLayout setMinimumInteritemSpacing:10]; 80 | [collectionViewFlowLayout setMinimumLineSpacing:10]; 81 | [collectionViewFlowLayout setSectionInset:UIEdgeInsetsMake(10, 0, 20, 0)]; 82 | 83 | _collectionView = [[PSUICollectionView alloc] initWithFrame:CGRectMake(floorf((CGRectGetWidth(self.view.bounds)-500)/2), 0, 500, CGRectGetHeight(self.view.bounds)) collectionViewLayout:collectionViewFlowLayout]; 84 | [_collectionView setDelegate:self]; 85 | [_collectionView setDataSource:self]; 86 | [_collectionView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin]; 87 | [_collectionView setBackgroundColor:[UIColor redColor]]; 88 | 89 | [_collectionView registerClass:[CollectionViewCell class] forCellWithReuseIdentifier:cellIdentifier]; 90 | [_collectionView registerClass:[HeaderView class] forSupplementaryViewOfKind:PSTCollectionElementKindSectionHeader withReuseIdentifier:headerViewIdentifier]; 91 | [_collectionView registerClass:[FooterView class] forSupplementaryViewOfKind:PSTCollectionElementKindSectionFooter withReuseIdentifier:footerViewIdentifier]; 92 | 93 | [self.view addSubview:_collectionView]; 94 | } 95 | 96 | - (void)viewDidLoad { 97 | [super viewDidLoad]; 98 | 99 | data = @[ 100 | @[@"One", @"Two", @"Three"], 101 | @[@"Four", @"Five", @"Six"], 102 | @[], 103 | @[@"Seven"], 104 | ]; 105 | } 106 | 107 | 108 | #pragma mark - 109 | #pragma mark PSUICollectionView stuff 110 | 111 | - (NSInteger)numberOfSectionsInCollectionView:(PSUICollectionView *)collectionView { 112 | return [data count]; 113 | } 114 | 115 | 116 | - (NSInteger)collectionView:(PSUICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 117 | return [[data objectAtIndex:section] count]; 118 | } 119 | 120 | 121 | - (PSUICollectionViewCell *)collectionView:(PSUICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 122 | PSUICollectionViewCell *cell = (PSUICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath]; 123 | 124 | UILabel *label = (UILabel *)[cell viewWithTag:123]; 125 | label.text = [[data objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; 126 | 127 | return cell; 128 | } 129 | 130 | - (PSUICollectionReusableView *)collectionView:(PSUICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { 131 | NSString *identifier = nil; 132 | 133 | if ([kind isEqualToString:PSTCollectionElementKindSectionHeader]) { 134 | identifier = headerViewIdentifier; 135 | } else if ([kind isEqualToString:PSTCollectionElementKindSectionFooter]) { 136 | identifier = footerViewIdentifier; 137 | } 138 | PSUICollectionReusableView *supplementaryView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:identifier forIndexPath:indexPath]; 139 | 140 | // TODO Setup view 141 | 142 | return supplementaryView; 143 | } 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/FlowLayoutNoNIB/FlowLayoutNoNIB/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FlowLayoutNoNIB 4 | // 5 | // Created by Beau G. Bolle on 2012.10.29. 6 | // 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/LineLayout/LineLayout/Cell.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Cell.h 4 | Abstract: Simple collection view cell. 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | @interface Cell : PSUICollectionViewCell 98 | 99 | @property (strong, nonatomic) UILabel* label; 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Examples/LineLayout/LineLayout/LineLayout-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apple.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/LineLayout/LineLayout/LineLayout-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'LineLayout' target in the 'LineLayout' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_3 8 | #warning "This project uses features only available in iOS SDK 4.3 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import "PSTCollectionView.h" 15 | #endif 16 | -------------------------------------------------------------------------------- /Examples/LineLayout/LineLayout/LineLayout.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: LineLayout.h 4 | Abstract: Simple flow layout to lay out items in a line. 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | @interface LineLayout : PSUICollectionViewFlowLayout 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /Examples/LineLayout/LineLayout/ViewController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: ViewController.h 4 | Abstract: Simple collection view controller subclass to lay out views on a line. 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | @interface ViewController : PSUICollectionViewController 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /Examples/LineLayout/LineLayout/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/LineLayout/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ### LineLayout ### 2 | 3 | =========================================================================== 4 | DESCRIPTION: 5 | 6 | This example shows how to implement a document-browser-like-interface as a flow layout subclass, and using automatic invalidation on bounds change to implement the 'scale center cell' effect. It also implements a layout-level method to adjust the scrolling final position so the final cell will always be centered. 7 | 8 | =========================================================================== 9 | CHANGES FROM PREVIOUS VERSIONS: 10 | 11 | Version 1.0 12 | - First version. 13 | 14 | =========================================================================== 15 | Copyright (C) 2012 Apple Inc. All rights reserved. 16 | -------------------------------------------------------------------------------- /Examples/PinchIt/PinchIt/Cell.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Cell.h 4 | Abstract: Simple collection view cell. 5 | 6 | Version: 1.0 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2012 Apple Inc. All Rights Reserved. 47 | 48 | 49 | WWDC 2012 License 50 | 51 | NOTE: This Apple Software was supplied by Apple as part of a WWDC 2012 52 | Session. Please refer to the applicable WWDC 2012 Session for further 53 | information. 54 | 55 | IMPORTANT: This Apple software is supplied to you by Apple 56 | Inc. ("Apple") in consideration of your agreement to the following 57 | terms, and your use, installation, modification or redistribution of 58 | this Apple software constitutes acceptance of these terms. If you do 59 | not agree with these terms, please do not use, install, modify or 60 | redistribute this Apple software. 61 | 62 | In consideration of your agreement to abide by the following terms, and 63 | subject to these terms, Apple grants you a non-exclusive license, under 64 | Apple's copyrights in this original Apple software (the "Apple 65 | Software"), to use, reproduce, modify and redistribute the Apple 66 | Software, with or without modifications, in source and/or binary forms; 67 | provided that if you redistribute the Apple Software in its entirety and 68 | without modifications, you must retain this notice and the following 69 | text and disclaimers in all such redistributions of the Apple Software. 70 | Neither the name, trademarks, service marks or logos of Apple Inc. may 71 | be used to endorse or promote products derived from the Apple Software 72 | without specific prior written permission from Apple. Except as 73 | expressly stated in this notice, no other rights or licenses, express or 74 | implied, are granted by Apple herein, including but not limited to any 75 | patent rights that may be infringed by your derivative works or by other 76 | works in which the Apple Software may be incorporated. 77 | 78 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 79 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 80 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 81 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 82 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 83 | 84 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 85 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 86 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 87 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 88 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 89 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 90 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 91 | POSSIBILITY OF SUCH DAMAGE. 92 | 93 | */ 94 | 95 | #import 96 | 97 | @interface Cell : PSUICollectionViewCell 98 | 99 | @property (strong, nonatomic) UILabel* label; 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Examples/PinchIt/PinchIt/PinchIt-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.apple.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/PinchIt/PinchIt/PinchIt-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'PinchIt' target in the 'PinchIt' project 3 | // 4 | 5 | #import 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #import "PSTCollectionView.h" 11 | #endif 12 | -------------------------------------------------------------------------------- /Examples/PinchIt/PinchIt/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/PinchIt/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ### PinchIt ### 2 | 3 | =========================================================================== 4 | DESCRIPTION: 5 | 6 | Illustrates use of a flow layout subclass to pinch and move a cell. 7 | 8 | 9 | =========================================================================== 10 | CHANGES FROM PREVIOUS VERSIONS: 11 | 12 | Version 1.0 13 | - First version. 14 | 15 | =========================================================================== 16 | Copyright (C) 2012 Apple Inc. All rights reserved. 17 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SelectionDelegateExample 4 | // 5 | // Created by orta therox on 06/11/2012. 6 | // Copyright (c) 2012 orta therox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | @property (strong, nonatomic) UIViewController *viewController; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SelectionDelegateExample 4 | // 5 | // Created by orta therox on 06/11/2012. 6 | // Copyright (c) 2012 orta therox. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | ViewController *viewController = [[ViewController alloc] init]; 18 | self.viewController = [[UINavigationController alloc] initWithRootViewController:viewController]; 19 | self.window.rootViewController = self.viewController; 20 | [self.window makeKeyAndVisible]; 21 | return YES; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/SelectionDelegateExample/SelectionDelegateExample/Default-568h@2x.png -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/SelectionDelegateExample/SelectionDelegateExample/Default.png -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steipete/PSTCollectionView/583d2e5e120d55252bb8c31c49db605668c5cfe8/Examples/SelectionDelegateExample/SelectionDelegateExample/Default@2x.png -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/ImageGridCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImageGridCell.h 3 | // SelectionDelegateExample 4 | // 5 | // Created by orta therox on 06/11/2012. 6 | // Copyright (c) 2012 orta therox. All rights reserved. 7 | // 8 | 9 | #include "UILabel+Highlight.h" 10 | 11 | @interface ImageGridCell : PSUICollectionViewCell 12 | 13 | @property (strong, nonatomic) IBOutlet UIImageView *image; 14 | @property (strong, nonatomic) IBOutlet UILabel *label; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/ImageGridCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImageGridCell.m 3 | // SelectionDelegateExample 4 | // 5 | // Created by orta therox on 06/11/2012. 6 | // Copyright (c) 2012 orta therox. All rights reserved. 7 | // 8 | 9 | #import "ImageGridCell.h" 10 | 11 | static UIEdgeInsets ContentInsets = { .top = 10, .left = 6, .right = 6, .bottom = 0 }; 12 | static CGFloat SubTitleLabelHeight = 24; 13 | 14 | @implementation ImageGridCell 15 | 16 | - (id)initWithFrame:(CGRect)frame { 17 | if (self = [super initWithFrame:frame]) { 18 | UIView *background = [[UIView alloc] init]; 19 | background.backgroundColor = [UIColor colorWithRed:0.109 green:0.419 blue:0.000 alpha:1.000]; 20 | self.selectedBackgroundView = background; 21 | 22 | _image = [[UIImageView alloc] init]; 23 | _image.contentMode = UIViewContentModeScaleAspectFit; 24 | 25 | _label = [[UILabel alloc] init]; 26 | _label.textColor = [UIColor whiteColor]; 27 | _label.textAlignment = UITextAlignmentCenter; 28 | _label.backgroundColor = [UIColor clearColor]; 29 | 30 | [self.contentView addSubview:_image]; 31 | [self.contentView addSubview:_label]; 32 | } 33 | return self; 34 | } 35 | 36 | - (void)layoutSubviews { 37 | CGFloat imageHeight = CGRectGetHeight(self.bounds) - ContentInsets.top - SubTitleLabelHeight - ContentInsets.bottom; 38 | CGFloat imageWidth = CGRectGetWidth(self.bounds) - ContentInsets.left - ContentInsets.right; 39 | 40 | _image.frame = CGRectMake(ContentInsets.left, ContentInsets.top, imageWidth, imageHeight); 41 | _label.frame = CGRectMake(ContentInsets.left, CGRectGetMaxY(_image.frame), imageWidth, SubTitleLabelHeight); 42 | } 43 | 44 | - (void)setHighlighted:(BOOL)highlighted { 45 | NSLog(@"Cell %@ highlight: %@", _label.text, highlighted ? @"ON" : @"OFF"); 46 | if (highlighted) { 47 | _label.backgroundColor = [UIColor yellowColor]; 48 | } 49 | else { 50 | _label.backgroundColor = [UIColor underPageBackgroundColor]; 51 | } 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/SelectionDelegateExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.github.orta.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/SelectionDelegateExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SelectionDelegateExample' target in the 'SelectionDelegateExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #import "PSTCollectionView.h" 15 | #endif 16 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/UILabel+Highlight.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Highlight.h 3 | // SelectionDelegateExample 4 | // 5 | // Created by Eric Chen on 1/21/13. 6 | // Copyright (c) 2013 orta therox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UILabel (Highlight) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/UILabel+Highlight.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Highlight.m 3 | // SelectionDelegateExample 4 | // 5 | // Created by Eric Chen on 1/21/13. 6 | // Copyright (c) 2013 orta therox. All rights reserved. 7 | // 8 | 9 | #import "UILabel+Highlight.h" 10 | 11 | @implementation UILabel (Highlight) 12 | 13 | - (void)setHighlighted:(BOOL)highlighted 14 | { 15 | NSLog(@"Label %@ highlight: %@", self.text, highlighted ? @"ON" : @"OFF"); 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SelectionDelegateExample 4 | // 5 | // Created by orta therox on 06/11/2012. 6 | // Copyright (c) 2012 orta therox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SelectionDelegateExample 4 | // 5 | // Created by orta therox on 06/11/2012. 6 | // Copyright (c) 2012 orta therox. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "ImageGridCell.h" 11 | 12 | CGSize CollectionViewCellSize = { .height = 140, .width = 180 }; 13 | NSString *CollectionViewCellIdentifier = @"SelectionDelegateExample"; 14 | 15 | @interface ViewController (){ 16 | PSUICollectionView *_gridView; 17 | } 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | [self createGridView]; 25 | 26 | UIBarButtonItem *toggleMultiSelectButton = [[UIBarButtonItem alloc] initWithTitle:@"Multi-Select" style:UIBarButtonItemStylePlain target:self action:@selector(toggleAllowsMultipleSelection:)]; 27 | [self.navigationItem setRightBarButtonItem:toggleMultiSelectButton]; 28 | } 29 | 30 | - (void)createGridView { 31 | PSUICollectionViewFlowLayout *layout = [[PSUICollectionViewFlowLayout alloc] init]; 32 | _gridView = [[PSUICollectionView alloc] initWithFrame:[self.view bounds] collectionViewLayout:layout]; 33 | _gridView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 34 | _gridView.delegate = self; 35 | _gridView.dataSource = self; 36 | _gridView.backgroundColor = [UIColor colorWithRed:0.135 green:0.341 blue:0.000 alpha:1.000]; 37 | [_gridView registerClass:[ImageGridCell class] forCellWithReuseIdentifier:CollectionViewCellIdentifier]; 38 | 39 | [self.view addSubview:_gridView]; 40 | } 41 | 42 | - (void)toggleAllowsMultipleSelection:(UIBarButtonItem *)item { 43 | _gridView.allowsMultipleSelection = !_gridView.allowsMultipleSelection; 44 | item.title = _gridView.allowsMultipleSelection ? @"Single-Select" : @"Multi-Select"; 45 | } 46 | 47 | #pragma mark - 48 | #pragma mark Collection View Data Source 49 | 50 | - (NSString *)formatIndexPath:(NSIndexPath *)indexPath { 51 | return [NSString stringWithFormat:@"{%ld,%ld}", (long)indexPath.row, (long)indexPath.section]; 52 | } 53 | 54 | - (PSUICollectionViewCell *)collectionView:(PSUICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 55 | ImageGridCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CollectionViewCellIdentifier forIndexPath:indexPath]; 56 | cell.label.text = [self formatIndexPath:indexPath]; 57 | 58 | // load the image for this cell 59 | NSString *imageToLoad = [NSString stringWithFormat:@"%d.JPG", indexPath.row]; 60 | cell.image.image = [UIImage imageNamed:imageToLoad]; 61 | return cell; 62 | } 63 | 64 | - (CGSize)collectionView:(PSUICollectionView *)collectionView layout:(PSUICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { 65 | return CollectionViewCellSize; 66 | } 67 | 68 | - (NSInteger)collectionView:(PSUICollectionView *)view numberOfItemsInSection:(NSInteger)section { 69 | return 32; 70 | } 71 | 72 | #pragma mark - 73 | #pragma mark Collection View Delegate 74 | 75 | - (void)collectionView:(PSTCollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath 76 | { 77 | NSLog(@"Delegate cell %@ : HIGHLIGHTED", [self formatIndexPath:indexPath]); 78 | } 79 | 80 | - (void)collectionView:(PSTCollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath 81 | { 82 | NSLog(@"Delegate cell %@ : UNHIGHLIGHTED", [self formatIndexPath:indexPath]); 83 | } 84 | 85 | - (void)collectionView:(PSTCollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 86 | { 87 | NSLog(@"Delegate cell %@ : SELECTED", [self formatIndexPath:indexPath]); 88 | } 89 | 90 | - (void)collectionView:(PSTCollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath 91 | { 92 | NSLog(@"Delegate cell %@ : DESELECTED", [self formatIndexPath:indexPath]); 93 | } 94 | 95 | - (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath 96 | { 97 | NSLog(@"Check delegate: should cell %@ highlight?", [self formatIndexPath:indexPath]); 98 | return YES; 99 | } 100 | 101 | - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath 102 | { 103 | NSLog(@"Check delegate: should cell %@ be selected?", [self formatIndexPath:indexPath]); 104 | return YES; 105 | } 106 | 107 | - (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath 108 | { 109 | NSLog(@"Check delegate: should cell %@ be deselected?", [self formatIndexPath:indexPath]); 110 | return YES; 111 | } 112 | 113 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 114 | return YES; 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/SelectionDelegateExample/SelectionDelegateExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SelectionDelegateExample 4 | // 5 | // Created by orta therox on 06/11/2012. 6 | // Copyright (c) 2012 orta therox. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HowTo.md: -------------------------------------------------------------------------------- 1 | HowTo -- Helpful Stuff 2 | ====================== 3 | 4 | My main resource for reverse engineering UICollection is [https://github.com/steipete/iOS6-Runtime-Headers](https://github.com/steipete/iOS6-Runtime-Headers). 5 | 6 | // For debugging purposes only 7 | ``` objective-c 8 | #ifdef DEBUG 9 | NSString *_PSPDFPrintIvars(id obj, NSMutableSet *recursiveSet); 10 | void PSPDFPrintIvars(id obj, BOOL printRecursive) { 11 | NSString *ivarString = _PSPDFPrintIvars(obj, printRecursive ? [NSMutableSet set] : nil); 12 | NSLog(@"%@", ivarString); 13 | } 14 | 15 | NSMutableDictionary *_PSDPFConvertIvarsToDictionary(Class class, id obj); 16 | NSMutableDictionary *_PSDPFConvertIvarsToDictionary(Class class, id obj) { 17 | NSMutableDictionary *dict = [NSMutableDictionary dictionary]; 18 | unsigned int ivarCount; 19 | Ivar *ivars = class_copyIvarList(class, &ivarCount); 20 | for (int i = 0; i < ivarCount; i++) { 21 | NSString *name = @(ivar_getName(ivars[i])); 22 | id value; 23 | @try { value = [obj valueForKey:name]; } 24 | @catch (NSException *exception) { 25 | value = [exception reason]; 26 | } 27 | value = value ?: [NSNull null]; 28 | [dict setObject:value forKey:name]; 29 | } 30 | free(ivars); 31 | return dict; 32 | } 33 | 34 | NSString *_PSPDFPrintIvars(id obj, NSMutableSet *recursiveSet) { 35 | NSMutableString *string = [NSMutableString string]; 36 | [recursiveSet addObject:obj]; 37 | 38 | // query ivar list 39 | NSMutableSet *ivarDictionaries = [NSMutableSet set]; 40 | NSMutableDictionary *dict = _PSDPFConvertIvarsToDictionary([obj class], obj); 41 | Class superClass = class_getSuperclass([obj class]); 42 | while(superClass && ![superClass isEqual:[NSObject class]]) { 43 | NSDictionary *superClassIvarDict = _PSDPFConvertIvarsToDictionary(superClass, obj); 44 | if ([superClassIvarDict count]) { 45 | dict[NSStringFromClass(superClass)] = superClassIvarDict; 46 | 47 | if ([NSStringFromClass(superClass) hasPrefix:@"UICollection"] || [NSStringFromClass(superClass) hasPrefix:@"_UI"]) { 48 | [ivarDictionaries addObject:superClassIvarDict]; 49 | } 50 | } 51 | superClass = class_getSuperclass(superClass); 52 | } 53 | if ([dict count]) { 54 | [string appendFormat:@"<%@= %@>", NSStringFromClass([obj class]), [dict description]]; 55 | } 56 | // dig deeper if recursive is enabled 57 | if (recursiveSet) { 58 | [dict enumerateKeysAndObjectsUsingBlock:^(id key, id dictObj, BOOL *stop) { 59 | if ([ivarDictionaries containsObject:dictObj]) { 60 | [dictObj enumerateKeysAndObjectsUsingBlock:^(id key, id dictObj, BOOL *stop) { 61 | 62 | if (![recursiveSet containsObject:dictObj] && (![dictObj isKindOfClass:[NSDictionary class]] || [dictObj count] > 0) && ![dictObj isKindOfClass:[NSSet set]] && ![dictObj isKindOfClass:NSClassFromString(@"NSConcreteValue")]) { 63 | if ([[dictObj class] conformsToProtocol:@protocol(NSFastEnumeration)]) { 64 | for (id anObj in dictObj) { 65 | [string appendString:_PSPDFPrintIvars(anObj, recursiveSet)]; 66 | } 67 | }else { 68 | [string appendString:_PSPDFPrintIvars(dictObj, recursiveSet)]; 69 | } 70 | } 71 | }]; 72 | }else { 73 | if (![recursiveSet containsObject:dictObj] && (![dictObj isKindOfClass:[NSDictionary class]] || [dictObj count] > 0) && ![dictObj isKindOfClass:[NSSet set]] && ![dictObj isKindOfClass:NSClassFromString(@"NSConcreteValue")]) { 74 | if ([[dictObj class] conformsToProtocol:@protocol(NSFastEnumeration)]) { 75 | for (id anObj in dictObj) { 76 | [string appendString:_PSPDFPrintIvars(anObj, recursiveSet)]; 77 | } 78 | }else { 79 | [string appendString:_PSPDFPrintIvars(dictObj, recursiveSet)]; 80 | } 81 | } 82 | } 83 | }]; 84 | } 85 | 86 | // custom stuff (e.g. get a id * variable that's not KVO compliant) 87 | if([NSStringFromClass([obj class]) isEqualToString:@"UICollectionViewData"]) { 88 | id *outvalue; 89 | object_getInstanceVariable(obj, "_globalItems", (void **)&outvalue); 90 | NSLog(@"done"); 91 | } 92 | return string; 93 | } 94 | #endif 95 | ``` 96 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2013 Peter Steinberger 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /PSTCollectionView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'PSTCollectionView' 3 | s.version = '1.2.3' 4 | s.summary = 'Open Source, 100% API compatible replacement of UICollectionView for iOS4+.' 5 | s.homepage = 'https://github.com/steipete/PSTCollectionView' 6 | s.license = { 7 | :type => 'MIT', 8 | :file => 'LICENSE' 9 | } 10 | s.author = 'Peter Steinberger', 'steipete@gmail.com' 11 | s.source = { 12 | :git => 'https://github.com/steipete/PSTCollectionView.git', 13 | :tag => s.version.to_s 14 | } 15 | s.platform = :ios, '4.3' 16 | s.source_files = 'PSTCollectionView/' 17 | s.frameworks = 'UIKit', 'QuartzCore' 18 | s.requires_arc = true 19 | end 20 | -------------------------------------------------------------------------------- /PSTCollectionView/NSIndexPath+PSTCollectionViewAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSIndexPath+PSTCollectionViewAdditions.h 3 | // PSTCollectionView 4 | // 5 | // Copyright (c) 2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000 11 | 12 | @interface NSIndexPath (PSTCollectionViewAdditions) 13 | 14 | + (NSIndexPath *)indexPathForItem:(NSInteger)item inSection:(NSInteger)section; 15 | 16 | - (NSInteger)item; 17 | 18 | @end 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /PSTCollectionView/NSIndexPath+PSTCollectionViewAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSIndexPath+PSTCollectionViewAdditions.m 3 | // PSTCollectionView 4 | // 5 | // Copyright (c) 2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "NSIndexPath+PSTCollectionViewAdditions.h" 9 | 10 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000 11 | 12 | @implementation NSIndexPath (PSTCollectionViewAdditions) 13 | 14 | // Simple NSIndexPath addition to allow using "item" instead of "row". 15 | + (NSIndexPath *)indexPathForItem:(NSInteger)item inSection:(NSInteger)section { 16 | return [NSIndexPath indexPathForRow:item inSection:section]; 17 | } 18 | 19 | - (NSInteger)item { 20 | return self.row; 21 | } 22 | 23 | @end 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewCell.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "PSTCollectionViewCommon.h" 9 | 10 | @class PSTCollectionViewLayout, PSTCollectionView, PSTCollectionViewLayoutAttributes; 11 | 12 | @interface PSTCollectionReusableView : UIView 13 | 14 | @property (nonatomic, readonly, copy) NSString *reuseIdentifier; 15 | 16 | // Override in subclasses. Called before instance is returned to the reuse queue. 17 | - (void)prepareForReuse; 18 | 19 | // Apply layout attributes on cell. 20 | - (void)applyLayoutAttributes:(PSTCollectionViewLayoutAttributes *)layoutAttributes; 21 | - (void)willTransitionFromLayout:(PSTCollectionViewLayout *)oldLayout toLayout:(PSTCollectionViewLayout *)newLayout; 22 | - (void)didTransitionFromLayout:(PSTCollectionViewLayout *)oldLayout toLayout:(PSTCollectionViewLayout *)newLayout; 23 | 24 | @end 25 | 26 | @interface PSTCollectionReusableView (Internal) 27 | @property (nonatomic, unsafe_unretained) PSTCollectionView *collectionView; 28 | @property (nonatomic, copy) NSString *reuseIdentifier; 29 | @property (nonatomic, strong, readonly) PSTCollectionViewLayoutAttributes *layoutAttributes; 30 | @end 31 | 32 | 33 | @interface PSTCollectionViewCell : PSTCollectionReusableView 34 | 35 | @property (nonatomic, readonly) UIView *contentView; // add custom subviews to the cell's contentView 36 | 37 | // Cells become highlighted when the user touches them. 38 | // The selected state is toggled when the user lifts up from a highlighted cell. 39 | // Override these methods to provide custom UI for a selected or highlighted state. 40 | // The collection view may call the setters inside an animation block. 41 | @property (nonatomic, getter=isSelected) BOOL selected; 42 | @property (nonatomic, getter=isHighlighted) BOOL highlighted; 43 | 44 | // The background view is a subview behind all other views. 45 | // If selectedBackgroundView is different than backgroundView, it will be placed above the background view and animated in on selection. 46 | @property (nonatomic, strong) UIView *backgroundView; 47 | @property (nonatomic, strong) UIView *selectedBackgroundView; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewCommon.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | // Mostly a debug feature, makes classes from UICollection* compatible with PSTCollection* 12 | // (e.g. adding the "real" UICollectionViewFlowLayout to PSTCollectionView. 13 | //#define kPSUIInteroperabilityEnabled 14 | 15 | @class PSTCollectionView, PSTCollectionViewCell, PSTCollectionReusableView; 16 | 17 | @protocol PSTCollectionViewDataSource 18 | @required 19 | 20 | - (NSInteger)collectionView:(PSTCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section; 21 | 22 | // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: 23 | - (PSTCollectionViewCell *)collectionView:(PSTCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath; 24 | 25 | @optional 26 | 27 | - (NSInteger)numberOfSectionsInCollectionView:(PSTCollectionView *)collectionView; 28 | 29 | // The view that is returned must be retrieved from a call to -dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath: 30 | - (PSTCollectionReusableView *)collectionView:(PSTCollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; 31 | 32 | @end 33 | 34 | @protocol PSTCollectionViewDelegate 35 | @optional 36 | 37 | // Methods for notification of selection/deselection and highlight/unhighlight events. 38 | // The sequence of calls leading to selection from a user touch is: 39 | // 40 | // (when the touch begins) 41 | // 1. -collectionView:shouldHighlightItemAtIndexPath: 42 | // 2. -collectionView:didHighlightItemAtIndexPath: 43 | // 44 | // (when the touch lifts) 45 | // 3. -collectionView:shouldSelectItemAtIndexPath: or -collectionView:shouldDeselectItemAtIndexPath: 46 | // 4. -collectionView:didSelectItemAtIndexPath: or -collectionView:didDeselectItemAtIndexPath: 47 | // 5. -collectionView:didUnhighlightItemAtIndexPath: 48 | - (BOOL)collectionView:(PSTCollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath; 49 | 50 | - (void)collectionView:(PSTCollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath; 51 | 52 | - (void)collectionView:(PSTCollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath; 53 | 54 | - (BOOL)collectionView:(PSTCollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath; 55 | 56 | - (BOOL)collectionView:(PSTCollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath; // called when the user taps on an already-selected item in multi-select mode 57 | - (void)collectionView:(PSTCollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath; 58 | 59 | - (void)collectionView:(PSTCollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath; 60 | 61 | - (void)collectionView:(PSTCollectionView *)collectionView didEndDisplayingCell:(PSTCollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath; 62 | 63 | - (void)collectionView:(PSTCollectionView *)collectionView didEndDisplayingSupplementaryView:(PSTCollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath; 64 | 65 | // These methods provide support for copy/paste actions on cells. 66 | // All three should be implemented if any are. 67 | - (BOOL)collectionView:(PSTCollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath; 68 | 69 | - (BOOL)collectionView:(PSTCollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; 70 | 71 | - (void)collectionView:(PSTCollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewController.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "PSTCollectionViewCommon.h" 9 | 10 | @class PSTCollectionViewLayout, PSTCollectionViewController; 11 | 12 | // Simple controller-wrapper around PSTCollectionView. 13 | @interface PSTCollectionViewController : UIViewController 14 | 15 | // Designated initializer. 16 | - (id)initWithCollectionViewLayout:(PSTCollectionViewLayout *)layout; 17 | 18 | // Internally used collection view. If not set, created during loadView. 19 | @property (nonatomic, strong) PSTCollectionView *collectionView; 20 | 21 | // Defaults to YES, and if YES, any selection is cleared in viewWillAppear: 22 | @property (nonatomic, assign) BOOL clearsSelectionOnViewWillAppear; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewData.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewData.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "PSTCollectionViewCommon.h" 9 | 10 | @class PSTCollectionView, PSTCollectionViewLayout, PSTCollectionViewLayoutAttributes; 11 | 12 | // https://github.com/steipete/iOS6-Runtime-Headers/blob/master/UICollectionViewData.h 13 | @interface PSTCollectionViewData : NSObject 14 | 15 | // Designated initializer. 16 | - (id)initWithCollectionView:(PSTCollectionView *)collectionView layout:(PSTCollectionViewLayout *)layout; 17 | 18 | // Ensure data is valid. may fetches items from dataSource and layout. 19 | - (void)validateLayoutInRect:(CGRect)rect; 20 | 21 | - (CGRect)rectForItemAtIndexPath:(NSIndexPath *)indexPath; 22 | 23 | /* 24 | - (CGRect)rectForSupplementaryElementOfKind:(id)arg1 atIndexPath:(id)arg2; 25 | - (CGRect)rectForDecorationElementOfKind:(id)arg1 atIndexPath:(id)arg2; 26 | - (CGRect)rectForGlobalItemIndex:(int)arg1; 27 | */ 28 | 29 | // No fucking idea (yet) 30 | - (NSUInteger)globalIndexForItemAtIndexPath:(NSIndexPath *)indexPath; 31 | 32 | - (NSIndexPath *)indexPathForItemAtGlobalIndex:(NSInteger)index; 33 | 34 | // Fetch layout attributes 35 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect; 36 | 37 | /* 38 | - (PSTCollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath; 39 | - (PSTCollectionViewLayoutAttributes *)layoutAttributesForElementsInSection:(NSInteger)section; 40 | - (PSTCollectionViewLayoutAttributes *)layoutAttributesForGlobalItemIndex:(NSInteger)index; 41 | - (PSTCollectionViewLayoutAttributes *)layoutAttributesForDecorationViewOfKind:(id)arg1 atIndexPath:(NSIndexPath *)indexPath; 42 | - (PSTCollectionViewLayoutAttributes *)layoutAttributesForSupplementaryElementOfKind:(id)arg1 atIndexPath:(NSIndexPath *)indexPath; 43 | - (id)existingSupplementaryLayoutAttributesInSection:(int)arg1; 44 | */ 45 | 46 | // Make data to re-evaluate dataSources. 47 | - (void)invalidate; 48 | 49 | // Access cached item data 50 | - (NSInteger)numberOfItemsBeforeSection:(NSInteger)section; 51 | 52 | - (NSInteger)numberOfItemsInSection:(NSInteger)section; 53 | 54 | - (NSInteger)numberOfItems; 55 | 56 | - (NSInteger)numberOfSections; 57 | 58 | // Total size of the content. 59 | - (CGRect)collectionViewContentRect; 60 | 61 | @property (readonly) BOOL layoutIsPrepared; 62 | 63 | /* 64 | - (void)_setLayoutAttributes:(id)arg1 atGlobalItemIndex:(int)arg2; 65 | - (void)_setupMutableIndexPath:(id*)arg1 forGlobalItemIndex:(int)arg2; 66 | - (id)_screenPageForPoint:(struct CGPoint { float x1; float x2; })arg1; 67 | - (void)_validateContentSize; 68 | - (void)_validateItemCounts; 69 | - (void)_updateItemCounts; 70 | - (void)_loadEverything; 71 | - (void)_prepareToLoadData; 72 | - (void)invalidate:(BOOL)arg1; 73 | */ 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewItemKey.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewItemKey.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "PSTCollectionViewCommon.h" 9 | #import "PSTCollectionViewLayout.h" 10 | 11 | extern NSString *const PSTCollectionElementKindCell; 12 | extern NSString *const PSTCollectionElementKindDecorationView; 13 | @class PSTCollectionViewLayoutAttributes; 14 | 15 | NSString *PSTCollectionViewItemTypeToString(PSTCollectionViewItemType type); // debug helper 16 | 17 | // Used in NSDictionaries 18 | @interface PSTCollectionViewItemKey : NSObject 19 | 20 | + (id)collectionItemKeyForLayoutAttributes:(PSTCollectionViewLayoutAttributes *)layoutAttributes; 21 | 22 | + (id)collectionItemKeyForCellWithIndexPath:(NSIndexPath *)indexPath; 23 | 24 | @property (nonatomic, assign) PSTCollectionViewItemType type; 25 | @property (nonatomic, strong) NSIndexPath *indexPath; 26 | @property (nonatomic, strong) NSString *identifier; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewItemKey.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewItemKey.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "PSTCollectionViewItemKey.h" 9 | 10 | NSString *const PSTCollectionElementKindCell = @"UICollectionElementKindCell"; 11 | 12 | @implementation PSTCollectionViewItemKey 13 | 14 | /////////////////////////////////////////////////////////////////////////////////////////// 15 | #pragma mark - Static 16 | 17 | + (id)collectionItemKeyForCellWithIndexPath:(NSIndexPath *)indexPath { 18 | PSTCollectionViewItemKey *key = [self.class new]; 19 | key.indexPath = indexPath; 20 | key.type = PSTCollectionViewItemTypeCell; 21 | key.identifier = PSTCollectionElementKindCell; 22 | return key; 23 | } 24 | 25 | + (id)collectionItemKeyForLayoutAttributes:(PSTCollectionViewLayoutAttributes *)layoutAttributes { 26 | PSTCollectionViewItemKey *key = [self.class new]; 27 | key.indexPath = layoutAttributes.indexPath; 28 | PSTCollectionViewItemType const itemType = layoutAttributes.representedElementCategory; 29 | key.type = itemType; 30 | key.identifier = layoutAttributes.representedElementKind; 31 | return key; 32 | } 33 | 34 | NSString *PSTCollectionViewItemTypeToString(PSTCollectionViewItemType type) { 35 | switch (type) { 36 | case PSTCollectionViewItemTypeCell: return @"Cell"; 37 | case PSTCollectionViewItemTypeDecorationView: return @"Decoration"; 38 | case PSTCollectionViewItemTypeSupplementaryView: return @"Supplementary"; 39 | default: return @""; 40 | } 41 | } 42 | 43 | /////////////////////////////////////////////////////////////////////////////////////////// 44 | #pragma mark - NSObject 45 | 46 | - (NSString *)description { 47 | return [NSString stringWithFormat:@"<%@: %p Type = %@ Identifier=%@ IndexPath = %@>", NSStringFromClass(self.class), 48 | self, PSTCollectionViewItemTypeToString(self.type), _identifier, self.indexPath]; 49 | } 50 | 51 | - (NSUInteger)hash { 52 | return (([_indexPath hash] + _type) * 31) + [_identifier hash]; 53 | } 54 | 55 | - (BOOL)isEqual:(id)other { 56 | if ([other isKindOfClass:self.class]) { 57 | PSTCollectionViewItemKey *otherKeyItem = (PSTCollectionViewItemKey *)other; 58 | // identifier might be nil? 59 | if (_type == otherKeyItem.type && [_indexPath isEqual:otherKeyItem.indexPath] && ([_identifier isEqualToString:otherKeyItem.identifier] || _identifier == otherKeyItem.identifier)) { 60 | return YES; 61 | } 62 | } 63 | return NO; 64 | } 65 | 66 | /////////////////////////////////////////////////////////////////////////////////////////// 67 | #pragma mark - NSCopying 68 | 69 | - (id)copyWithZone:(NSZone *)zone { 70 | PSTCollectionViewItemKey *itemKey = [self.class new]; 71 | itemKey.indexPath = self.indexPath; 72 | itemKey.type = self.type; 73 | itemKey.identifier = self.identifier; 74 | return itemKey; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewLayout+Internals.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewLayout+Internals.h 3 | // FMPSTCollectionView 4 | // 5 | // Created by Scott Talbot on 27/02/13. 6 | // Copyright (c) 2013 Scott Talbot. All rights reserved. 7 | // 8 | 9 | #import "PSTCollectionViewLayout.h" 10 | 11 | 12 | @interface PSTCollectionViewLayout (Internals) 13 | 14 | @property (nonatomic, copy, readonly) NSDictionary *decorationViewClassDict; 15 | @property (nonatomic, copy, readonly) NSDictionary *decorationViewNibDict; 16 | @property (nonatomic, copy, readonly) NSDictionary *decorationViewExternalObjectsTables; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewUpdateItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewUpdateItem.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // Contributed by Sergey Gavrilyuk. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, PSTCollectionUpdateAction) { 12 | PSTCollectionUpdateActionInsert, 13 | PSTCollectionUpdateActionDelete, 14 | PSTCollectionUpdateActionReload, 15 | PSTCollectionUpdateActionMove, 16 | PSTCollectionUpdateActionNone 17 | }; 18 | 19 | @interface PSTCollectionViewUpdateItem : NSObject 20 | 21 | @property (nonatomic, readonly, strong) NSIndexPath *indexPathBeforeUpdate; // nil for PSTCollectionUpdateActionInsert 22 | @property (nonatomic, readonly, strong) NSIndexPath *indexPathAfterUpdate; // nil for PSTCollectionUpdateActionDelete 23 | @property (nonatomic, readonly, assign) PSTCollectionUpdateAction updateAction; 24 | 25 | 26 | - (id)initWithInitialIndexPath:(NSIndexPath *)arg1 27 | finalIndexPath:(NSIndexPath *)arg2 28 | updateAction:(PSTCollectionUpdateAction)arg3; 29 | 30 | - (id)initWithAction:(PSTCollectionUpdateAction)arg1 31 | forIndexPath:(NSIndexPath *)indexPath; 32 | 33 | - (id)initWithOldIndexPath:(NSIndexPath *)arg1 newIndexPath:(NSIndexPath *)arg2; 34 | 35 | - (PSTCollectionUpdateAction)updateAction; 36 | 37 | - (NSComparisonResult)compareIndexPaths:(PSTCollectionViewUpdateItem *)otherItem; 38 | 39 | - (NSComparisonResult)inverseCompareIndexPaths:(PSTCollectionViewUpdateItem *)otherItem; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTCollectionViewUpdateItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSTCollectionViewUpdateItem.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // Contributed by Sergey Gavrilyuk. 7 | // 8 | 9 | #import "PSTCollectionViewUpdateItem.h" 10 | #import "NSIndexPath+PSTCollectionViewAdditions.h" 11 | 12 | @interface PSTCollectionViewUpdateItem () { 13 | NSIndexPath *_initialIndexPath; 14 | NSIndexPath *_finalIndexPath; 15 | PSTCollectionUpdateAction _updateAction; 16 | id _gap; 17 | } 18 | @end 19 | 20 | @implementation PSTCollectionViewUpdateItem 21 | 22 | @synthesize updateAction = _updateAction; 23 | @synthesize indexPathBeforeUpdate = _initialIndexPath; 24 | @synthesize indexPathAfterUpdate = _finalIndexPath; 25 | 26 | - (id)initWithInitialIndexPath:(NSIndexPath *)initialIndexPath finalIndexPath:(NSIndexPath *)finalIndexPath updateAction:(PSTCollectionUpdateAction)updateAction { 27 | if ((self = [super init])) { 28 | _initialIndexPath = initialIndexPath; 29 | _finalIndexPath = finalIndexPath; 30 | _updateAction = updateAction; 31 | } 32 | return self; 33 | } 34 | 35 | - (id)initWithAction:(PSTCollectionUpdateAction)updateAction forIndexPath:(NSIndexPath *)indexPath { 36 | if (updateAction == PSTCollectionUpdateActionInsert) 37 | return [self initWithInitialIndexPath:nil finalIndexPath:indexPath updateAction:updateAction]; 38 | else if (updateAction == PSTCollectionUpdateActionDelete) 39 | return [self initWithInitialIndexPath:indexPath finalIndexPath:nil updateAction:updateAction]; 40 | else if (updateAction == PSTCollectionUpdateActionReload) 41 | return [self initWithInitialIndexPath:indexPath finalIndexPath:indexPath updateAction:updateAction]; 42 | 43 | return nil; 44 | } 45 | 46 | - (id)initWithOldIndexPath:(NSIndexPath *)oldIndexPath newIndexPath:(NSIndexPath *)newIndexPath { 47 | return [self initWithInitialIndexPath:oldIndexPath finalIndexPath:newIndexPath updateAction:PSTCollectionUpdateActionMove]; 48 | } 49 | 50 | - (NSString *)description { 51 | NSString *action = nil; 52 | switch (_updateAction) { 53 | case PSTCollectionUpdateActionInsert: action = @"insert"; break; 54 | case PSTCollectionUpdateActionDelete: action = @"delete"; break; 55 | case PSTCollectionUpdateActionMove: action = @"move"; break; 56 | case PSTCollectionUpdateActionReload: action = @"reload"; break; 57 | default: break; 58 | } 59 | 60 | return [NSString stringWithFormat:@"Index path before update (%@) index path after update (%@) action (%@).", _initialIndexPath, _finalIndexPath, action]; 61 | } 62 | 63 | - (void)setNewIndexPath:(NSIndexPath *)indexPath { 64 | _finalIndexPath = indexPath; 65 | } 66 | 67 | - (void)setGap:(id)gap { 68 | _gap = gap; 69 | } 70 | 71 | - (BOOL)isSectionOperation { 72 | return (_initialIndexPath.item == NSNotFound || _finalIndexPath.item == NSNotFound); 73 | } 74 | 75 | - (NSIndexPath *)newIndexPath { 76 | return _finalIndexPath; 77 | } 78 | 79 | - (id)gap { 80 | return _gap; 81 | } 82 | 83 | - (PSTCollectionUpdateAction)action { 84 | return _updateAction; 85 | } 86 | 87 | - (id)indexPath { 88 | //TODO: check this 89 | return _initialIndexPath; 90 | } 91 | 92 | - (NSComparisonResult)compareIndexPaths:(PSTCollectionViewUpdateItem *)otherItem { 93 | NSComparisonResult result = NSOrderedSame; 94 | NSIndexPath *selfIndexPath = nil; 95 | NSIndexPath *otherIndexPath = nil; 96 | 97 | switch (_updateAction) { 98 | case PSTCollectionUpdateActionInsert: 99 | selfIndexPath = _finalIndexPath; 100 | otherIndexPath = [otherItem newIndexPath]; 101 | break; 102 | case PSTCollectionUpdateActionDelete: 103 | selfIndexPath = _initialIndexPath; 104 | otherIndexPath = [otherItem indexPath]; 105 | default: break; 106 | } 107 | 108 | if (self.isSectionOperation) result = [@(selfIndexPath.section) compare:@(otherIndexPath.section)]; 109 | else result = [selfIndexPath compare:otherIndexPath]; 110 | return result; 111 | } 112 | 113 | - (NSComparisonResult)inverseCompareIndexPaths:(PSTCollectionViewUpdateItem *)otherItem { 114 | return (NSComparisonResult)([self compareIndexPaths:otherItem] * -1); 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTGridLayoutInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTGridLayoutInfo.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @class PSTGridLayoutSection; 11 | 12 | /* 13 | Every PSTCollectionViewLayout has a PSTGridLayoutInfo attached. 14 | Is used extensively in PSTCollectionViewFlowLayout. 15 | */ 16 | @interface PSTGridLayoutInfo : NSObject 17 | 18 | @property (nonatomic, strong, readonly) NSArray *sections; 19 | @property (nonatomic, strong) NSDictionary *rowAlignmentOptions; 20 | @property (nonatomic, assign) BOOL usesFloatingHeaderFooter; 21 | 22 | // Vertical/horizontal dimension (depending on horizontal) 23 | // Used to create row objects 24 | @property (nonatomic, assign) CGFloat dimension; 25 | 26 | @property (nonatomic, assign) BOOL horizontal; 27 | @property (nonatomic, assign) BOOL leftToRight; 28 | @property (nonatomic, assign) CGSize contentSize; 29 | 30 | // Frame for specific PSTGridLayoutItem. 31 | - (CGRect)frameForItemAtIndexPath:(NSIndexPath *)indexPath; 32 | 33 | // Add new section. Invalidates layout. 34 | - (PSTGridLayoutSection *)addSection; 35 | 36 | // forces the layout to recompute on next access 37 | // TODO; what's the parameter for? 38 | - (void)invalidate:(BOOL)arg; 39 | 40 | // Make a copy of the current state. 41 | - (PSTGridLayoutInfo *)snapshot; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTGridLayoutInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSTGridLayoutInfo.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "PSTGridLayoutInfo.h" 9 | #import "PSTGridLayoutSection.h" 10 | #import "PSTGridLayoutItem.h" 11 | 12 | @interface PSTGridLayoutInfo () { 13 | NSMutableArray *_sections; 14 | CGRect _visibleBounds; 15 | CGSize _layoutSize; 16 | BOOL _isValid; 17 | } 18 | @property (nonatomic, strong) NSMutableArray *sections; 19 | @end 20 | 21 | @implementation PSTGridLayoutInfo 22 | 23 | /////////////////////////////////////////////////////////////////////////////////////////// 24 | #pragma mark - NSObject 25 | 26 | - (id)init { 27 | if ((self = [super init])) { 28 | _sections = [NSMutableArray new]; 29 | } 30 | return self; 31 | } 32 | 33 | - (NSString *)description { 34 | return [NSString stringWithFormat:@"<%@: %p dimension:%.1f horizontal:%d contentSize:%@ sections:%@>", NSStringFromClass(self.class), self, self.dimension, self.horizontal, NSStringFromCGSize(self.contentSize), self.sections]; 35 | } 36 | 37 | /////////////////////////////////////////////////////////////////////////////////////////// 38 | #pragma mark - Public 39 | 40 | - (PSTGridLayoutInfo *)snapshot { 41 | PSTGridLayoutInfo *layoutInfo = [self.class new]; 42 | layoutInfo.sections = self.sections; 43 | layoutInfo.rowAlignmentOptions = self.rowAlignmentOptions; 44 | layoutInfo.usesFloatingHeaderFooter = self.usesFloatingHeaderFooter; 45 | layoutInfo.dimension = self.dimension; 46 | layoutInfo.horizontal = self.horizontal; 47 | layoutInfo.leftToRight = self.leftToRight; 48 | layoutInfo.contentSize = self.contentSize; 49 | return layoutInfo; 50 | } 51 | 52 | - (CGRect)frameForItemAtIndexPath:(NSIndexPath *)indexPath { 53 | PSTGridLayoutSection *section = self.sections[(NSUInteger)indexPath.section]; 54 | CGRect itemFrame; 55 | if (section.fixedItemSize) { 56 | itemFrame = (CGRect){.size=section.itemSize}; 57 | }else { 58 | itemFrame = [section.items[(NSUInteger)indexPath.item] itemFrame]; 59 | } 60 | return itemFrame; 61 | } 62 | 63 | - (id)addSection { 64 | PSTGridLayoutSection *section = [PSTGridLayoutSection new]; 65 | section.rowAlignmentOptions = self.rowAlignmentOptions; 66 | section.layoutInfo = self; 67 | [_sections addObject:section]; 68 | [self invalidate:NO]; 69 | return section; 70 | } 71 | 72 | - (void)invalidate:(BOOL)arg { 73 | _isValid = NO; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTGridLayoutItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTGridLayoutItem.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @class PSTGridLayoutSection, PSTGridLayoutRow; 11 | 12 | // Represents a single grid item; only created for non-uniform-sized grids. 13 | @interface PSTGridLayoutItem : NSObject 14 | 15 | @property (nonatomic, unsafe_unretained) PSTGridLayoutSection *section; 16 | @property (nonatomic, unsafe_unretained) PSTGridLayoutRow *rowObject; 17 | @property (nonatomic, assign) CGRect itemFrame; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTGridLayoutItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSTGridLayoutItem.m 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import "PSTGridLayoutItem.h" 9 | 10 | @implementation PSTGridLayoutItem 11 | 12 | /////////////////////////////////////////////////////////////////////////////////////////// 13 | #pragma mark - NSObject 14 | 15 | - (NSString *)description { 16 | return [NSString stringWithFormat:@"<%@: %p itemFrame:%@>", NSStringFromClass(self.class), self, NSStringFromCGRect(self.itemFrame)]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTGridLayoutRow.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTGridLayoutRow.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @class PSTGridLayoutSection, PSTGridLayoutItem; 11 | 12 | @interface PSTGridLayoutRow : NSObject 13 | 14 | @property (nonatomic, unsafe_unretained) PSTGridLayoutSection *section; 15 | @property (nonatomic, strong, readonly) NSArray *items; 16 | @property (nonatomic, assign) CGSize rowSize; 17 | @property (nonatomic, assign) CGRect rowFrame; 18 | @property (nonatomic, assign) NSInteger index; 19 | @property (nonatomic, assign) BOOL complete; 20 | @property (nonatomic, assign) BOOL fixedItemSize; 21 | 22 | // @steipete addition for row-fastPath 23 | @property (nonatomic, assign) NSInteger itemCount; 24 | 25 | //- (PSTGridLayoutRow *)copyFromSection:(PSTGridLayoutSection *)section; // ??? 26 | 27 | // Add new item to items array. 28 | - (void)addItem:(PSTGridLayoutItem *)item; 29 | 30 | // Layout current row (if invalid) 31 | - (void)layoutRow; 32 | 33 | // @steipete: Helper to save code in PSTCollectionViewFlowLayout. 34 | // Returns the item rects when fixedItemSize is enabled. 35 | - (NSArray *)itemRects; 36 | 37 | // Set current row frame invalid. 38 | - (void)invalidate; 39 | 40 | // Copy a snapshot of the current row data 41 | - (PSTGridLayoutRow *)snapshot; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /PSTCollectionView/PSTGridLayoutSection.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSTGridLayoutSection.h 3 | // PSPDFKit 4 | // 5 | // Copyright (c) 2012-2013 Peter Steinberger. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @class PSTGridLayoutInfo, PSTGridLayoutRow, PSTGridLayoutItem; 11 | 12 | @interface PSTGridLayoutSection : NSObject 13 | 14 | @property (nonatomic, strong, readonly) NSArray *items; 15 | @property (nonatomic, strong, readonly) NSArray *rows; 16 | 17 | // fast path for equal-size items 18 | @property (nonatomic, assign) BOOL fixedItemSize; 19 | @property (nonatomic, assign) CGSize itemSize; 20 | // depending on fixedItemSize, this either is a _ivar or queries items. 21 | @property (nonatomic, assign) NSInteger itemsCount; 22 | 23 | @property (nonatomic, assign) CGFloat verticalInterstice; 24 | @property (nonatomic, assign) CGFloat horizontalInterstice; 25 | @property (nonatomic, assign) UIEdgeInsets sectionMargins; 26 | 27 | @property (nonatomic, assign) CGRect frame; 28 | @property (nonatomic, assign) CGRect headerFrame; 29 | @property (nonatomic, assign) CGRect footerFrame; 30 | @property (nonatomic, assign) CGFloat headerDimension; 31 | @property (nonatomic, assign) CGFloat footerDimension; 32 | @property (nonatomic, unsafe_unretained) PSTGridLayoutInfo *layoutInfo; 33 | @property (nonatomic, strong) NSDictionary *rowAlignmentOptions; 34 | 35 | @property (nonatomic, assign, readonly) CGFloat otherMargin; 36 | @property (nonatomic, assign, readonly) CGFloat beginMargin; 37 | @property (nonatomic, assign, readonly) CGFloat endMargin; 38 | @property (nonatomic, assign, readonly) CGFloat actualGap; 39 | @property (nonatomic, assign, readonly) CGFloat lastRowBeginMargin; 40 | @property (nonatomic, assign, readonly) CGFloat lastRowEndMargin; 41 | @property (nonatomic, assign, readonly) CGFloat lastRowActualGap; 42 | @property (nonatomic, assign, readonly) BOOL lastRowIncomplete; 43 | @property (nonatomic, assign, readonly) NSInteger itemsByRowCount; 44 | @property (nonatomic, assign, readonly) NSInteger indexOfImcompleteRow; // typo as of iOS6B3 45 | 46 | //- (PSTGridLayoutSection *)copyFromLayoutInfo:(PSTGridLayoutInfo *)layoutInfo; 47 | 48 | // Faster variant of invalidate/compute 49 | - (void)recomputeFromIndex:(NSInteger)index; 50 | 51 | // Invalidate layout. Destroys rows. 52 | - (void)invalidate; 53 | 54 | // Compute layout. Creates rows. 55 | - (void)computeLayout; 56 | 57 | - (PSTGridLayoutItem *)addItem; 58 | 59 | - (PSTGridLayoutRow *)addRow; 60 | 61 | // Copy snapshot of current object 62 | - (PSTGridLayoutSection *)snapshot; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PSTCollectionView 2 | ================= 3 | 4 | UPDATE: I'm no longer using PSTCollectionView in any project. This purely exists to keep old projects alive and for historical reasons. 5 | 6 | Open Source, 100% API compatible replacement of UICollectionView for iOS4.3+ 7 | 8 | **You want to use UICollectionView, but still need to support older versions of iOS? Then you're gonna love this project.** 9 | Originally I wrote it for [PSPDFKit](http://PSPDFKit.com), my iOS PDF framework that supports text selection and annotations, but this project seemed way too useful for others to keep it for myself :) 10 | 11 | **If you want to have PSTCollectionView on iOS4.3/5.x and UICollectionView on iOS6, use PSUICollectionView (basically add PS on any UICollectionView* class to get auto-support for older iOS versions)** 12 | If you always want to use PSTCollectionView, use PSTCollectionView as class names. (replace the UI with PST) 13 | 14 | ## Current State 15 | 16 | Most features work, including the flow layout with fixed or dynamic cell sizes and supplementary views. If you're not doing something fancy, it should just work. 17 | PSTCollectionView is also internally designed very closely to UICollectionView and thus a great study if you're wondering how UICollectionView works. See [HowTo](HowTo.md) for helpful details. 18 | 19 | ## How can I help? 20 | 21 | The best way is if you're already using UICollectionView somewhere. Add PSTCollectionView and try it on iOS4/5. Check if everything works, fix bugs until the result matches 1:1 with iOS6. You can also just pick an issue fron the Issue Tracker and start working there. 22 | 23 | Or start playing around with one of the WWDC examples and try to make them work with PSTCollectionView. Most of them already do, but just not as perfect. 24 | 25 | You could also write a Pinterest-style layout manager. Can't be that hard. 26 | 27 | ## Animations 28 | 29 | Thanks to Sergey Gavrilyuk ([@octogavrix](https://twitter.com/octogavrix)), animations are supported. It's not perfect yet (see LineExample), but it's a great start. 30 | 31 | ## ARC 32 | 33 | PSTCollectionView works with Xcode 4.5.2+ and ARC. 34 | 35 | ## Dependencies 36 | 37 | PSTCollectionView needs the QuartzCore.framework. 38 | 39 | ## Interoperability 40 | 41 | Another goal (at least super useful for debugging) is interoperability between UI/PST classes: 42 | 43 | ``` objective-c 44 | UICollectionViewFlowLayout *flowLayout = [UICollectionViewFlowLayout new]; 45 | PSTCollectionView *collectionView = [[PSTCollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:(PSTCollectionViewFlowLayout *)flowLayout]; 46 | ``` 47 | 48 | (*) Note that for some methods we can't use the _ underscore variants or we risk to get a false-positive on private API use. I've added some runtime hacks to dynamcially add block forwarders for those cases (mainly for UI/PST interoperability) 49 | 50 | ## Creator 51 | 52 | [Peter Steinberger](http://petersteinberger.com) ([@steipete](https://twitter.com/steipete)) 53 | and lots of others! See [Contributors](https://github.com/steipete/PSTCollectionView/graphs/contributors) for a graph. Thanks everyone! 54 | 55 | ## License 56 | 57 | PSTCollectionView is available under the MIT license. See the LICENSE file for more info. 58 | --------------------------------------------------------------------------------