├── UICollectionViewSelfSizingDemo.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── README.md ├── UICollectionViewSelfSizingDemo ├── CollectionReusableView.swift ├── SelfSizingCell.swift ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.swift ├── AppDelegate.swift └── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── .gitignore ├── UICollectionViewSelfSizingDemoTests ├── Info.plist └── UICollectionViewSelfSizingDemoTests.swift └── LICENSE /UICollectionViewSelfSizingDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Self-Sizing-CollectionView-Demo 2 | This is the Demo showed in [iOS8自动调整UITableView和UICollectionView布局](http://yulingtianxia.com/blog/2014/08/17/New-in-Table-and-Collection-Views/) 3 | 4 | Updated to Swift 2.0 5 | 6 | ![](http://7ni3rk.com1.z0.glb.clouddn.com/Self-Sizing CollectionView Demo.png) 7 | 8 | 9 | ##License 10 | 11 | The MIT License. 12 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/CollectionReusableView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionReusableView.swift 3 | // UICollectionViewSelfSizingDemo 4 | // 5 | // Created by 杨萧玉 on 15/4/12. 6 | // Copyright (c) 2015年 杨萧玉. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CollectionReusableView: UICollectionReusableView { 12 | 13 | @IBOutlet weak var titleLabel: UILabel! 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | 28 | # Carthage 29 | # 30 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 31 | # Carthage/Checkouts 32 | 33 | Carthage/Build 34 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/SelfSizingCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SelfSizingCell.swift 3 | // UICollectionViewSelfSizingDemo 4 | // 5 | // Created by 杨萧玉 on 15/4/12. 6 | // Copyright (c) 2015年 杨萧玉. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SelfSizingCell: UICollectionViewCell { 12 | @IBOutlet weak var textLabel: UILabel! 13 | 14 | override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { 15 | let attributes = super.preferredLayoutAttributesFitting(layoutAttributes) 16 | let maxBounds = CGRect.init(x: 0, y: 0, width: .greatestFiniteMagnitude, height: textLabel.frame.size.height) 17 | attributes.frame = textLabel.textRect(forBounds: maxBounds, limitedToNumberOfLines: textLabel.numberOfLines) 18 | return attributes 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 杨萧玉 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemoTests/UICollectionViewSelfSizingDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UICollectionViewSelfSizingDemoTests.swift 3 | // UICollectionViewSelfSizingDemoTests 4 | // 5 | // Created by 杨萧玉 on 15/4/12. 6 | // Copyright (c) 2015年 杨萧玉. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class UICollectionViewSelfSizingDemoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // UICollectionViewSelfSizingDemo 4 | // 5 | // Created by 杨萧玉 on 15/4/12. 6 | // Copyright (c) 2015年 杨萧玉. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let text = "The UICollectionViewFlowLayout class is a concrete layout object that organizes items into a grid with optional header and footer views for each section. The items in the collection view flow from one row or column (depending on the scrolling direction) to the next, with each row comprising as many cells as will fit. Cells can be the same sizes or different sizes." 12 | 13 | let strings = text.components(separatedBy: " ") 14 | class ViewController: UICollectionViewController { 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | // Do any additional setup after loading the view, typically from a nib. 19 | (collectionViewLayout as! UICollectionViewFlowLayout).estimatedItemSize = CGSize(width: 20, height: 20) 20 | } 21 | 22 | override func didReceiveMemoryWarning() { 23 | super.didReceiveMemoryWarning() 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | override func numberOfSections(in collectionView: UICollectionView) -> Int { 28 | return 1 29 | } 30 | 31 | override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 32 | return strings.count 33 | } 34 | 35 | override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 36 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "selfsizingcell", for: indexPath) as! SelfSizingCell 37 | cell.textLabel.text = strings[indexPath.item] 38 | return cell 39 | } 40 | 41 | override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { 42 | print(kind) 43 | return collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "selfsizingheader", for: indexPath) 44 | } 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // UICollectionViewSelfSizingDemo 4 | // 5 | // Created by 杨萧玉 on 15/4/12. 6 | // Copyright (c) 2015年 杨萧玉. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ app: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ app: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(_ app: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ app: UIApplication) { 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 | func applicationDidBecomeActive(_ app: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ app: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /UICollectionViewSelfSizingDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A416BF6F1ADA613100563C49 /* CollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A416BF6E1ADA613100563C49 /* CollectionReusableView.swift */; }; 11 | A4B29CCF1ADA3C6E0089E412 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B29CCE1ADA3C6E0089E412 /* AppDelegate.swift */; }; 12 | A4B29CD11ADA3C6E0089E412 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B29CD01ADA3C6E0089E412 /* ViewController.swift */; }; 13 | A4B29CD41ADA3C6E0089E412 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A4B29CD21ADA3C6E0089E412 /* Main.storyboard */; }; 14 | A4B29CD61ADA3C6E0089E412 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A4B29CD51ADA3C6E0089E412 /* Images.xcassets */; }; 15 | A4B29CD91ADA3C6E0089E412 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A4B29CD71ADA3C6E0089E412 /* LaunchScreen.xib */; }; 16 | A4B29CE51ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B29CE41ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.swift */; }; 17 | A4B29CF11ADA44CA0089E412 /* SelfSizingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B29CF01ADA44CA0089E412 /* SelfSizingCell.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | A4B29CDF1ADA3C6E0089E412 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = A4B29CC11ADA3C6D0089E412 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = A4B29CC81ADA3C6E0089E412; 26 | remoteInfo = UICollectionViewSelfSizingDemo; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | A416BF6E1ADA613100563C49 /* CollectionReusableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionReusableView.swift; sourceTree = ""; }; 32 | A4B29CC91ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UICollectionViewSelfSizingDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | A4B29CCD1ADA3C6E0089E412 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | A4B29CCE1ADA3C6E0089E412 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 35 | A4B29CD01ADA3C6E0089E412 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 36 | A4B29CD31ADA3C6E0089E412 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | A4B29CD51ADA3C6E0089E412 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | A4B29CD81ADA3C6E0089E412 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 39 | A4B29CDE1ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UICollectionViewSelfSizingDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | A4B29CE31ADA3C6E0089E412 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | A4B29CE41ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UICollectionViewSelfSizingDemoTests.swift; sourceTree = ""; }; 42 | A4B29CF01ADA44CA0089E412 /* SelfSizingCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelfSizingCell.swift; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | A4B29CC61ADA3C6E0089E412 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | A4B29CDB1ADA3C6E0089E412 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | /* End PBXFrameworksBuildPhase section */ 61 | 62 | /* Begin PBXGroup section */ 63 | A4B29CC01ADA3C6D0089E412 = { 64 | isa = PBXGroup; 65 | children = ( 66 | A4B29CCB1ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo */, 67 | A4B29CE11ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests */, 68 | A4B29CCA1ADA3C6E0089E412 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | A4B29CCA1ADA3C6E0089E412 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | A4B29CC91ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo.app */, 76 | A4B29CDE1ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.xctest */, 77 | ); 78 | name = Products; 79 | sourceTree = ""; 80 | }; 81 | A4B29CCB1ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | A4B29CCE1ADA3C6E0089E412 /* AppDelegate.swift */, 85 | A4B29CD01ADA3C6E0089E412 /* ViewController.swift */, 86 | A4B29CD21ADA3C6E0089E412 /* Main.storyboard */, 87 | A4B29CF01ADA44CA0089E412 /* SelfSizingCell.swift */, 88 | A416BF6E1ADA613100563C49 /* CollectionReusableView.swift */, 89 | A4B29CD51ADA3C6E0089E412 /* Images.xcassets */, 90 | A4B29CD71ADA3C6E0089E412 /* LaunchScreen.xib */, 91 | A4B29CCC1ADA3C6E0089E412 /* Supporting Files */, 92 | ); 93 | path = UICollectionViewSelfSizingDemo; 94 | sourceTree = ""; 95 | }; 96 | A4B29CCC1ADA3C6E0089E412 /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | A4B29CCD1ADA3C6E0089E412 /* Info.plist */, 100 | ); 101 | name = "Supporting Files"; 102 | sourceTree = ""; 103 | }; 104 | A4B29CE11ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | A4B29CE41ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.swift */, 108 | A4B29CE21ADA3C6E0089E412 /* Supporting Files */, 109 | ); 110 | path = UICollectionViewSelfSizingDemoTests; 111 | sourceTree = ""; 112 | }; 113 | A4B29CE21ADA3C6E0089E412 /* Supporting Files */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | A4B29CE31ADA3C6E0089E412 /* Info.plist */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | A4B29CC81ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = A4B29CE81ADA3C6E0089E412 /* Build configuration list for PBXNativeTarget "UICollectionViewSelfSizingDemo" */; 127 | buildPhases = ( 128 | A4B29CC51ADA3C6E0089E412 /* Sources */, 129 | A4B29CC61ADA3C6E0089E412 /* Frameworks */, 130 | A4B29CC71ADA3C6E0089E412 /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = UICollectionViewSelfSizingDemo; 137 | productName = UICollectionViewSelfSizingDemo; 138 | productReference = A4B29CC91ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo.app */; 139 | productType = "com.apple.product-type.application"; 140 | }; 141 | A4B29CDD1ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = A4B29CEB1ADA3C6E0089E412 /* Build configuration list for PBXNativeTarget "UICollectionViewSelfSizingDemoTests" */; 144 | buildPhases = ( 145 | A4B29CDA1ADA3C6E0089E412 /* Sources */, 146 | A4B29CDB1ADA3C6E0089E412 /* Frameworks */, 147 | A4B29CDC1ADA3C6E0089E412 /* Resources */, 148 | ); 149 | buildRules = ( 150 | ); 151 | dependencies = ( 152 | A4B29CE01ADA3C6E0089E412 /* PBXTargetDependency */, 153 | ); 154 | name = UICollectionViewSelfSizingDemoTests; 155 | productName = UICollectionViewSelfSizingDemoTests; 156 | productReference = A4B29CDE1ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.xctest */; 157 | productType = "com.apple.product-type.bundle.unit-test"; 158 | }; 159 | /* End PBXNativeTarget section */ 160 | 161 | /* Begin PBXProject section */ 162 | A4B29CC11ADA3C6D0089E412 /* Project object */ = { 163 | isa = PBXProject; 164 | attributes = { 165 | LastSwiftMigration = 0700; 166 | LastSwiftUpdateCheck = 0700; 167 | LastUpgradeCheck = 0940; 168 | ORGANIZATIONNAME = "杨萧玉"; 169 | TargetAttributes = { 170 | A4B29CC81ADA3C6E0089E412 = { 171 | CreatedOnToolsVersion = 6.3; 172 | }; 173 | A4B29CDD1ADA3C6E0089E412 = { 174 | CreatedOnToolsVersion = 6.3; 175 | TestTargetID = A4B29CC81ADA3C6E0089E412; 176 | }; 177 | }; 178 | }; 179 | buildConfigurationList = A4B29CC41ADA3C6E0089E412 /* Build configuration list for PBXProject "UICollectionViewSelfSizingDemo" */; 180 | compatibilityVersion = "Xcode 3.2"; 181 | developmentRegion = English; 182 | hasScannedForEncodings = 0; 183 | knownRegions = ( 184 | en, 185 | Base, 186 | ); 187 | mainGroup = A4B29CC01ADA3C6D0089E412; 188 | productRefGroup = A4B29CCA1ADA3C6E0089E412 /* Products */; 189 | projectDirPath = ""; 190 | projectRoot = ""; 191 | targets = ( 192 | A4B29CC81ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo */, 193 | A4B29CDD1ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests */, 194 | ); 195 | }; 196 | /* End PBXProject section */ 197 | 198 | /* Begin PBXResourcesBuildPhase section */ 199 | A4B29CC71ADA3C6E0089E412 /* Resources */ = { 200 | isa = PBXResourcesBuildPhase; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | A4B29CD41ADA3C6E0089E412 /* Main.storyboard in Resources */, 204 | A4B29CD91ADA3C6E0089E412 /* LaunchScreen.xib in Resources */, 205 | A4B29CD61ADA3C6E0089E412 /* Images.xcassets in Resources */, 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | A4B29CDC1ADA3C6E0089E412 /* Resources */ = { 210 | isa = PBXResourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXResourcesBuildPhase section */ 217 | 218 | /* Begin PBXSourcesBuildPhase section */ 219 | A4B29CC51ADA3C6E0089E412 /* Sources */ = { 220 | isa = PBXSourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | A4B29CD11ADA3C6E0089E412 /* ViewController.swift in Sources */, 224 | A416BF6F1ADA613100563C49 /* CollectionReusableView.swift in Sources */, 225 | A4B29CCF1ADA3C6E0089E412 /* AppDelegate.swift in Sources */, 226 | A4B29CF11ADA44CA0089E412 /* SelfSizingCell.swift in Sources */, 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | A4B29CDA1ADA3C6E0089E412 /* Sources */ = { 231 | isa = PBXSourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | A4B29CE51ADA3C6E0089E412 /* UICollectionViewSelfSizingDemoTests.swift in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin PBXTargetDependency section */ 241 | A4B29CE01ADA3C6E0089E412 /* PBXTargetDependency */ = { 242 | isa = PBXTargetDependency; 243 | target = A4B29CC81ADA3C6E0089E412 /* UICollectionViewSelfSizingDemo */; 244 | targetProxy = A4B29CDF1ADA3C6E0089E412 /* PBXContainerItemProxy */; 245 | }; 246 | /* End PBXTargetDependency section */ 247 | 248 | /* Begin PBXVariantGroup section */ 249 | A4B29CD21ADA3C6E0089E412 /* Main.storyboard */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | A4B29CD31ADA3C6E0089E412 /* Base */, 253 | ); 254 | name = Main.storyboard; 255 | sourceTree = ""; 256 | }; 257 | A4B29CD71ADA3C6E0089E412 /* LaunchScreen.xib */ = { 258 | isa = PBXVariantGroup; 259 | children = ( 260 | A4B29CD81ADA3C6E0089E412 /* Base */, 261 | ); 262 | name = LaunchScreen.xib; 263 | sourceTree = ""; 264 | }; 265 | /* End PBXVariantGroup section */ 266 | 267 | /* Begin XCBuildConfiguration section */ 268 | A4B29CE61ADA3C6E0089E412 /* Debug */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | ALWAYS_SEARCH_USER_PATHS = NO; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_EMPTY_BODY = YES; 283 | CLANG_WARN_ENUM_CONVERSION = YES; 284 | CLANG_WARN_INFINITE_RECURSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 287 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 288 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 289 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 290 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 291 | CLANG_WARN_STRICT_PROTOTYPES = YES; 292 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 293 | CLANG_WARN_UNREACHABLE_CODE = YES; 294 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 295 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 296 | COPY_PHASE_STRIP = NO; 297 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 298 | ENABLE_STRICT_OBJC_MSGSEND = YES; 299 | ENABLE_TESTABILITY = YES; 300 | GCC_C_LANGUAGE_STANDARD = gnu99; 301 | GCC_DYNAMIC_NO_PIC = NO; 302 | GCC_NO_COMMON_BLOCKS = YES; 303 | GCC_OPTIMIZATION_LEVEL = 0; 304 | GCC_PREPROCESSOR_DEFINITIONS = ( 305 | "DEBUG=1", 306 | "$(inherited)", 307 | ); 308 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 309 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 310 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 311 | GCC_WARN_UNDECLARED_SELECTOR = YES; 312 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 313 | GCC_WARN_UNUSED_FUNCTION = YES; 314 | GCC_WARN_UNUSED_VARIABLE = YES; 315 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 316 | MTL_ENABLE_DEBUG_INFO = YES; 317 | ONLY_ACTIVE_ARCH = YES; 318 | SDKROOT = iphoneos; 319 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 320 | SWIFT_VERSION = 4.0; 321 | TARGETED_DEVICE_FAMILY = "1,2"; 322 | }; 323 | name = Debug; 324 | }; 325 | A4B29CE71ADA3C6E0089E412 /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_COMMA = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 338 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 339 | CLANG_WARN_EMPTY_BODY = YES; 340 | CLANG_WARN_ENUM_CONVERSION = YES; 341 | CLANG_WARN_INFINITE_RECURSION = YES; 342 | CLANG_WARN_INT_CONVERSION = YES; 343 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 344 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 345 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 347 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 348 | CLANG_WARN_STRICT_PROTOTYPES = YES; 349 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 355 | ENABLE_NS_ASSERTIONS = NO; 356 | ENABLE_STRICT_OBJC_MSGSEND = YES; 357 | GCC_C_LANGUAGE_STANDARD = gnu99; 358 | GCC_NO_COMMON_BLOCKS = YES; 359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 361 | GCC_WARN_UNDECLARED_SELECTOR = YES; 362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 363 | GCC_WARN_UNUSED_FUNCTION = YES; 364 | GCC_WARN_UNUSED_VARIABLE = YES; 365 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 366 | MTL_ENABLE_DEBUG_INFO = NO; 367 | SDKROOT = iphoneos; 368 | SWIFT_COMPILATION_MODE = wholemodule; 369 | SWIFT_VERSION = 4.0; 370 | TARGETED_DEVICE_FAMILY = "1,2"; 371 | VALIDATE_PRODUCT = YES; 372 | }; 373 | name = Release; 374 | }; 375 | A4B29CE91ADA3C6E0089E412 /* Debug */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 379 | INFOPLIST_FILE = UICollectionViewSelfSizingDemo/Info.plist; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_BUNDLE_IDENTIFIER = "com.yulingtianxia.$(PRODUCT_NAME:rfc1034identifier)"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | }; 384 | name = Debug; 385 | }; 386 | A4B29CEA1ADA3C6E0089E412 /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 390 | INFOPLIST_FILE = UICollectionViewSelfSizingDemo/Info.plist; 391 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 392 | PRODUCT_BUNDLE_IDENTIFIER = "com.yulingtianxia.$(PRODUCT_NAME:rfc1034identifier)"; 393 | PRODUCT_NAME = "$(TARGET_NAME)"; 394 | }; 395 | name = Release; 396 | }; 397 | A4B29CEC1ADA3C6E0089E412 /* Debug */ = { 398 | isa = XCBuildConfiguration; 399 | buildSettings = { 400 | BUNDLE_LOADER = "$(TEST_HOST)"; 401 | FRAMEWORK_SEARCH_PATHS = ""; 402 | GCC_PREPROCESSOR_DEFINITIONS = ( 403 | "DEBUG=1", 404 | "$(inherited)", 405 | ); 406 | INFOPLIST_FILE = UICollectionViewSelfSizingDemoTests/Info.plist; 407 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 408 | PRODUCT_BUNDLE_IDENTIFIER = "com.yulingtianxia.$(PRODUCT_NAME:rfc1034identifier)"; 409 | PRODUCT_NAME = "$(TARGET_NAME)"; 410 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UICollectionViewSelfSizingDemo.app/UICollectionViewSelfSizingDemo"; 411 | }; 412 | name = Debug; 413 | }; 414 | A4B29CED1ADA3C6E0089E412 /* Release */ = { 415 | isa = XCBuildConfiguration; 416 | buildSettings = { 417 | BUNDLE_LOADER = "$(TEST_HOST)"; 418 | FRAMEWORK_SEARCH_PATHS = ""; 419 | INFOPLIST_FILE = UICollectionViewSelfSizingDemoTests/Info.plist; 420 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 421 | PRODUCT_BUNDLE_IDENTIFIER = "com.yulingtianxia.$(PRODUCT_NAME:rfc1034identifier)"; 422 | PRODUCT_NAME = "$(TARGET_NAME)"; 423 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UICollectionViewSelfSizingDemo.app/UICollectionViewSelfSizingDemo"; 424 | }; 425 | name = Release; 426 | }; 427 | /* End XCBuildConfiguration section */ 428 | 429 | /* Begin XCConfigurationList section */ 430 | A4B29CC41ADA3C6E0089E412 /* Build configuration list for PBXProject "UICollectionViewSelfSizingDemo" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | A4B29CE61ADA3C6E0089E412 /* Debug */, 434 | A4B29CE71ADA3C6E0089E412 /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | A4B29CE81ADA3C6E0089E412 /* Build configuration list for PBXNativeTarget "UICollectionViewSelfSizingDemo" */ = { 440 | isa = XCConfigurationList; 441 | buildConfigurations = ( 442 | A4B29CE91ADA3C6E0089E412 /* Debug */, 443 | A4B29CEA1ADA3C6E0089E412 /* Release */, 444 | ); 445 | defaultConfigurationIsVisible = 0; 446 | defaultConfigurationName = Release; 447 | }; 448 | A4B29CEB1ADA3C6E0089E412 /* Build configuration list for PBXNativeTarget "UICollectionViewSelfSizingDemoTests" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | A4B29CEC1ADA3C6E0089E412 /* Debug */, 452 | A4B29CED1ADA3C6E0089E412 /* Release */, 453 | ); 454 | defaultConfigurationIsVisible = 0; 455 | defaultConfigurationName = Release; 456 | }; 457 | /* End XCConfigurationList section */ 458 | }; 459 | rootObject = A4B29CC11ADA3C6D0089E412 /* Project object */; 460 | } 461 | --------------------------------------------------------------------------------