├── CellHeightDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── tangxp.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── tangxp.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── CellHeightDemo.xcscheme │ └── xcschememanagement.plist ├── CellHeightDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── BaseViewController.h ├── BaseViewController.m ├── CellHeightDemo-Info.plist ├── CellHeightDemo-Prefix.pch ├── Cells │ ├── C1.h │ ├── C1.m │ ├── C1.xib │ ├── C2.h │ ├── C2.m │ ├── C2.xib │ ├── C3.h │ ├── C3.m │ ├── C3.xib │ ├── C4.h │ ├── C4.m │ ├── C4.xib │ ├── C5.h │ ├── C5.m │ └── C5.xib ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── NSLayoutConstraint+ClassMethodPriority.h ├── NSLayoutConstraint+ClassMethodPriority.m ├── NSString+Ext.h ├── NSString+Ext.m ├── T1ViewController.h ├── T1ViewController.m ├── T2ViewController.h ├── T2ViewController.m ├── T3ViewController.h ├── T3ViewController.m ├── T4ViewController.h ├── T4ViewController.m ├── T5ViewController.h ├── T5ViewController.m ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings ├── img.png └── main.m ├── CellHeightDemoTests ├── CellHeightDemoTests-Info.plist ├── CellHeightDemoTests.m └── en.lproj │ └── InfoPlist.strings └── README.md /CellHeightDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4BC0094A18B5FBDC00D61F27 /* NSLayoutConstraint+ClassMethodPriority.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC0094918B5FBDC00D61F27 /* NSLayoutConstraint+ClassMethodPriority.m */; }; 11 | 4BC0099E18B70B9600D61F27 /* C4.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BC0099D18B70B9600D61F27 /* C4.xib */; }; 12 | 4BC009A118B70BA500D61F27 /* C4.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC009A018B70BA500D61F27 /* C4.m */; }; 13 | 4BC009A418B7184900D61F27 /* C5.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC009A318B7184900D61F27 /* C5.m */; }; 14 | 4BC009A618B7185500D61F27 /* C5.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BC009A518B7185500D61F27 /* C5.xib */; }; 15 | 4BC009A918B7192C00D61F27 /* T5ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC009A818B7192C00D61F27 /* T5ViewController.m */; }; 16 | 4BC009AC18B7390200D61F27 /* C2.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BC009AB18B7390200D61F27 /* C2.m */; }; 17 | 4BC009AE18B7391000D61F27 /* C2.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BC009AD18B7391000D61F27 /* C2.xib */; }; 18 | 4BEBE78C18B59C0E00D674F5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBE78B18B59C0E00D674F5 /* Foundation.framework */; }; 19 | 4BEBE78E18B59C0E00D674F5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBE78D18B59C0E00D674F5 /* CoreGraphics.framework */; }; 20 | 4BEBE79018B59C0E00D674F5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBE78F18B59C0E00D674F5 /* UIKit.framework */; }; 21 | 4BEBE79618B59C0E00D674F5 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBE79418B59C0E00D674F5 /* InfoPlist.strings */; }; 22 | 4BEBE79818B59C0E00D674F5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE79718B59C0E00D674F5 /* main.m */; }; 23 | 4BEBE79C18B59C0E00D674F5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE79B18B59C0E00D674F5 /* AppDelegate.m */; }; 24 | 4BEBE79F18B59C0E00D674F5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBE79D18B59C0E00D674F5 /* Main.storyboard */; }; 25 | 4BEBE7A218B59C0E00D674F5 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7A118B59C0E00D674F5 /* ViewController.m */; }; 26 | 4BEBE7A418B59C0E00D674F5 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBE7A318B59C0E00D674F5 /* Images.xcassets */; }; 27 | 4BEBE7AB18B59C0E00D674F5 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBE7AA18B59C0E00D674F5 /* XCTest.framework */; }; 28 | 4BEBE7AC18B59C0E00D674F5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBE78B18B59C0E00D674F5 /* Foundation.framework */; }; 29 | 4BEBE7AD18B59C0E00D674F5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEBE78F18B59C0E00D674F5 /* UIKit.framework */; }; 30 | 4BEBE7B518B59C0E00D674F5 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBE7B318B59C0E00D674F5 /* InfoPlist.strings */; }; 31 | 4BEBE7B718B59C0E00D674F5 /* CellHeightDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7B618B59C0E00D674F5 /* CellHeightDemoTests.m */; }; 32 | 4BEBE7C218B59D5A00D674F5 /* T1ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7C118B59D5A00D674F5 /* T1ViewController.m */; }; 33 | 4BEBE7C518B59D6400D674F5 /* T2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7C418B59D6400D674F5 /* T2ViewController.m */; }; 34 | 4BEBE7C818B59D6E00D674F5 /* T3ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7C718B59D6E00D674F5 /* T3ViewController.m */; }; 35 | 4BEBE7CB18B59D7700D674F5 /* T4ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7CA18B59D7700D674F5 /* T4ViewController.m */; }; 36 | 4BEBE7DE18B59DC000D674F5 /* C1.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7D918B59DC000D674F5 /* C1.m */; }; 37 | 4BEBE7DF18B59DC000D674F5 /* C1.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBE7DA18B59DC000D674F5 /* C1.xib */; }; 38 | 4BEBE7E318B59E5A00D674F5 /* img.png in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBE7E218B59E5A00D674F5 /* img.png */; }; 39 | 4BEBE7E618B59ECB00D674F5 /* NSString+Ext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7E518B59ECB00D674F5 /* NSString+Ext.m */; }; 40 | 4BEBE7E918B59F1800D674F5 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7E818B59F1800D674F5 /* BaseViewController.m */; }; 41 | 4BEBE7EC18B5A83E00D674F5 /* C3.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEBE7EB18B5A83E00D674F5 /* C3.m */; }; 42 | 4BEBE7EE18B5AAD900D674F5 /* C3.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BEBE7ED18B5AAD900D674F5 /* C3.xib */; }; 43 | /* End PBXBuildFile section */ 44 | 45 | /* Begin PBXContainerItemProxy section */ 46 | 4BEBE7AE18B59C0E00D674F5 /* PBXContainerItemProxy */ = { 47 | isa = PBXContainerItemProxy; 48 | containerPortal = 4BEBE78018B59C0E00D674F5 /* Project object */; 49 | proxyType = 1; 50 | remoteGlobalIDString = 4BEBE78718B59C0E00D674F5; 51 | remoteInfo = CellHeightDemo; 52 | }; 53 | /* End PBXContainerItemProxy section */ 54 | 55 | /* Begin PBXFileReference section */ 56 | 4BC0094818B5FBDC00D61F27 /* NSLayoutConstraint+ClassMethodPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSLayoutConstraint+ClassMethodPriority.h"; sourceTree = ""; }; 57 | 4BC0094918B5FBDC00D61F27 /* NSLayoutConstraint+ClassMethodPriority.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSLayoutConstraint+ClassMethodPriority.m"; sourceTree = ""; }; 58 | 4BC0099D18B70B9600D61F27 /* C4.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = C4.xib; sourceTree = ""; }; 59 | 4BC0099F18B70BA500D61F27 /* C4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = C4.h; sourceTree = ""; }; 60 | 4BC009A018B70BA500D61F27 /* C4.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = C4.m; sourceTree = ""; }; 61 | 4BC009A218B7184900D61F27 /* C5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = C5.h; sourceTree = ""; }; 62 | 4BC009A318B7184900D61F27 /* C5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = C5.m; sourceTree = ""; }; 63 | 4BC009A518B7185500D61F27 /* C5.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = C5.xib; sourceTree = ""; }; 64 | 4BC009A718B7192C00D61F27 /* T5ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = T5ViewController.h; sourceTree = ""; }; 65 | 4BC009A818B7192C00D61F27 /* T5ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = T5ViewController.m; sourceTree = ""; }; 66 | 4BC009AA18B7390200D61F27 /* C2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = C2.h; sourceTree = ""; }; 67 | 4BC009AB18B7390200D61F27 /* C2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = C2.m; sourceTree = ""; }; 68 | 4BC009AD18B7391000D61F27 /* C2.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = C2.xib; sourceTree = ""; }; 69 | 4BEBE78818B59C0E00D674F5 /* CellHeightDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CellHeightDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 70 | 4BEBE78B18B59C0E00D674F5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 71 | 4BEBE78D18B59C0E00D674F5 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 72 | 4BEBE78F18B59C0E00D674F5 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 73 | 4BEBE79318B59C0E00D674F5 /* CellHeightDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CellHeightDemo-Info.plist"; sourceTree = ""; }; 74 | 4BEBE79518B59C0E00D674F5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 75 | 4BEBE79718B59C0E00D674F5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 76 | 4BEBE79918B59C0E00D674F5 /* CellHeightDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CellHeightDemo-Prefix.pch"; sourceTree = ""; }; 77 | 4BEBE79A18B59C0E00D674F5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 78 | 4BEBE79B18B59C0E00D674F5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 79 | 4BEBE79E18B59C0E00D674F5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 80 | 4BEBE7A018B59C0E00D674F5 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 81 | 4BEBE7A118B59C0E00D674F5 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 82 | 4BEBE7A318B59C0E00D674F5 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 83 | 4BEBE7A918B59C0E00D674F5 /* CellHeightDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CellHeightDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 84 | 4BEBE7AA18B59C0E00D674F5 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 85 | 4BEBE7B218B59C0E00D674F5 /* CellHeightDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CellHeightDemoTests-Info.plist"; sourceTree = ""; }; 86 | 4BEBE7B418B59C0E00D674F5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 87 | 4BEBE7B618B59C0E00D674F5 /* CellHeightDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CellHeightDemoTests.m; sourceTree = ""; }; 88 | 4BEBE7C018B59D5A00D674F5 /* T1ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = T1ViewController.h; sourceTree = ""; }; 89 | 4BEBE7C118B59D5A00D674F5 /* T1ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = T1ViewController.m; sourceTree = ""; }; 90 | 4BEBE7C318B59D6400D674F5 /* T2ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = T2ViewController.h; sourceTree = ""; }; 91 | 4BEBE7C418B59D6400D674F5 /* T2ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = T2ViewController.m; sourceTree = ""; }; 92 | 4BEBE7C618B59D6E00D674F5 /* T3ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = T3ViewController.h; sourceTree = ""; }; 93 | 4BEBE7C718B59D6E00D674F5 /* T3ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = T3ViewController.m; sourceTree = ""; }; 94 | 4BEBE7C918B59D7700D674F5 /* T4ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = T4ViewController.h; sourceTree = ""; }; 95 | 4BEBE7CA18B59D7700D674F5 /* T4ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = T4ViewController.m; sourceTree = ""; }; 96 | 4BEBE7D818B59DC000D674F5 /* C1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = C1.h; sourceTree = ""; }; 97 | 4BEBE7D918B59DC000D674F5 /* C1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = C1.m; sourceTree = ""; }; 98 | 4BEBE7DA18B59DC000D674F5 /* C1.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = C1.xib; sourceTree = ""; }; 99 | 4BEBE7E218B59E5A00D674F5 /* img.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = img.png; sourceTree = ""; }; 100 | 4BEBE7E418B59ECB00D674F5 /* NSString+Ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Ext.h"; sourceTree = ""; }; 101 | 4BEBE7E518B59ECB00D674F5 /* NSString+Ext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Ext.m"; sourceTree = ""; }; 102 | 4BEBE7E718B59F1800D674F5 /* BaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = ""; }; 103 | 4BEBE7E818B59F1800D674F5 /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = ""; }; 104 | 4BEBE7EA18B5A83E00D674F5 /* C3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = C3.h; sourceTree = ""; }; 105 | 4BEBE7EB18B5A83E00D674F5 /* C3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = C3.m; sourceTree = ""; }; 106 | 4BEBE7ED18B5AAD900D674F5 /* C3.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = C3.xib; sourceTree = ""; }; 107 | /* End PBXFileReference section */ 108 | 109 | /* Begin PBXFrameworksBuildPhase section */ 110 | 4BEBE78518B59C0E00D674F5 /* Frameworks */ = { 111 | isa = PBXFrameworksBuildPhase; 112 | buildActionMask = 2147483647; 113 | files = ( 114 | 4BEBE78E18B59C0E00D674F5 /* CoreGraphics.framework in Frameworks */, 115 | 4BEBE79018B59C0E00D674F5 /* UIKit.framework in Frameworks */, 116 | 4BEBE78C18B59C0E00D674F5 /* Foundation.framework in Frameworks */, 117 | ); 118 | runOnlyForDeploymentPostprocessing = 0; 119 | }; 120 | 4BEBE7A618B59C0E00D674F5 /* Frameworks */ = { 121 | isa = PBXFrameworksBuildPhase; 122 | buildActionMask = 2147483647; 123 | files = ( 124 | 4BEBE7AB18B59C0E00D674F5 /* XCTest.framework in Frameworks */, 125 | 4BEBE7AD18B59C0E00D674F5 /* UIKit.framework in Frameworks */, 126 | 4BEBE7AC18B59C0E00D674F5 /* Foundation.framework in Frameworks */, 127 | ); 128 | runOnlyForDeploymentPostprocessing = 0; 129 | }; 130 | /* End PBXFrameworksBuildPhase section */ 131 | 132 | /* Begin PBXGroup section */ 133 | 4BEBE77F18B59C0E00D674F5 = { 134 | isa = PBXGroup; 135 | children = ( 136 | 4BEBE79118B59C0E00D674F5 /* CellHeightDemo */, 137 | 4BEBE7B018B59C0E00D674F5 /* CellHeightDemoTests */, 138 | 4BEBE78A18B59C0E00D674F5 /* Frameworks */, 139 | 4BEBE78918B59C0E00D674F5 /* Products */, 140 | ); 141 | sourceTree = ""; 142 | }; 143 | 4BEBE78918B59C0E00D674F5 /* Products */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 4BEBE78818B59C0E00D674F5 /* CellHeightDemo.app */, 147 | 4BEBE7A918B59C0E00D674F5 /* CellHeightDemoTests.xctest */, 148 | ); 149 | name = Products; 150 | sourceTree = ""; 151 | }; 152 | 4BEBE78A18B59C0E00D674F5 /* Frameworks */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 4BEBE78B18B59C0E00D674F5 /* Foundation.framework */, 156 | 4BEBE78D18B59C0E00D674F5 /* CoreGraphics.framework */, 157 | 4BEBE78F18B59C0E00D674F5 /* UIKit.framework */, 158 | 4BEBE7AA18B59C0E00D674F5 /* XCTest.framework */, 159 | ); 160 | name = Frameworks; 161 | sourceTree = ""; 162 | }; 163 | 4BEBE79118B59C0E00D674F5 /* CellHeightDemo */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | 4BC0094818B5FBDC00D61F27 /* NSLayoutConstraint+ClassMethodPriority.h */, 167 | 4BC0094918B5FBDC00D61F27 /* NSLayoutConstraint+ClassMethodPriority.m */, 168 | 4BEBE7E218B59E5A00D674F5 /* img.png */, 169 | 4BEBE7E418B59ECB00D674F5 /* NSString+Ext.h */, 170 | 4BEBE7E518B59ECB00D674F5 /* NSString+Ext.m */, 171 | 4BEBE7D718B59DC000D674F5 /* Cells */, 172 | 4BEBE79A18B59C0E00D674F5 /* AppDelegate.h */, 173 | 4BEBE79B18B59C0E00D674F5 /* AppDelegate.m */, 174 | 4BEBE79D18B59C0E00D674F5 /* Main.storyboard */, 175 | 4BEBE7A018B59C0E00D674F5 /* ViewController.h */, 176 | 4BEBE7A118B59C0E00D674F5 /* ViewController.m */, 177 | 4BEBE7A318B59C0E00D674F5 /* Images.xcassets */, 178 | 4BEBE79218B59C0E00D674F5 /* Supporting Files */, 179 | 4BEBE7C018B59D5A00D674F5 /* T1ViewController.h */, 180 | 4BEBE7C118B59D5A00D674F5 /* T1ViewController.m */, 181 | 4BEBE7C318B59D6400D674F5 /* T2ViewController.h */, 182 | 4BEBE7C418B59D6400D674F5 /* T2ViewController.m */, 183 | 4BEBE7C618B59D6E00D674F5 /* T3ViewController.h */, 184 | 4BEBE7C718B59D6E00D674F5 /* T3ViewController.m */, 185 | 4BEBE7C918B59D7700D674F5 /* T4ViewController.h */, 186 | 4BEBE7CA18B59D7700D674F5 /* T4ViewController.m */, 187 | 4BC009A718B7192C00D61F27 /* T5ViewController.h */, 188 | 4BC009A818B7192C00D61F27 /* T5ViewController.m */, 189 | 4BEBE7E718B59F1800D674F5 /* BaseViewController.h */, 190 | 4BEBE7E818B59F1800D674F5 /* BaseViewController.m */, 191 | ); 192 | path = CellHeightDemo; 193 | sourceTree = ""; 194 | }; 195 | 4BEBE79218B59C0E00D674F5 /* Supporting Files */ = { 196 | isa = PBXGroup; 197 | children = ( 198 | 4BEBE79318B59C0E00D674F5 /* CellHeightDemo-Info.plist */, 199 | 4BEBE79418B59C0E00D674F5 /* InfoPlist.strings */, 200 | 4BEBE79718B59C0E00D674F5 /* main.m */, 201 | 4BEBE79918B59C0E00D674F5 /* CellHeightDemo-Prefix.pch */, 202 | ); 203 | name = "Supporting Files"; 204 | sourceTree = ""; 205 | }; 206 | 4BEBE7B018B59C0E00D674F5 /* CellHeightDemoTests */ = { 207 | isa = PBXGroup; 208 | children = ( 209 | 4BEBE7B618B59C0E00D674F5 /* CellHeightDemoTests.m */, 210 | 4BEBE7B118B59C0E00D674F5 /* Supporting Files */, 211 | ); 212 | path = CellHeightDemoTests; 213 | sourceTree = ""; 214 | }; 215 | 4BEBE7B118B59C0E00D674F5 /* Supporting Files */ = { 216 | isa = PBXGroup; 217 | children = ( 218 | 4BEBE7B218B59C0E00D674F5 /* CellHeightDemoTests-Info.plist */, 219 | 4BEBE7B318B59C0E00D674F5 /* InfoPlist.strings */, 220 | ); 221 | name = "Supporting Files"; 222 | sourceTree = ""; 223 | }; 224 | 4BEBE7D718B59DC000D674F5 /* Cells */ = { 225 | isa = PBXGroup; 226 | children = ( 227 | 4BEBE7D818B59DC000D674F5 /* C1.h */, 228 | 4BEBE7D918B59DC000D674F5 /* C1.m */, 229 | 4BEBE7DA18B59DC000D674F5 /* C1.xib */, 230 | 4BC009AA18B7390200D61F27 /* C2.h */, 231 | 4BC009AB18B7390200D61F27 /* C2.m */, 232 | 4BC009AD18B7391000D61F27 /* C2.xib */, 233 | 4BEBE7EA18B5A83E00D674F5 /* C3.h */, 234 | 4BEBE7EB18B5A83E00D674F5 /* C3.m */, 235 | 4BEBE7ED18B5AAD900D674F5 /* C3.xib */, 236 | 4BC0099F18B70BA500D61F27 /* C4.h */, 237 | 4BC009A018B70BA500D61F27 /* C4.m */, 238 | 4BC0099D18B70B9600D61F27 /* C4.xib */, 239 | 4BC009A218B7184900D61F27 /* C5.h */, 240 | 4BC009A318B7184900D61F27 /* C5.m */, 241 | 4BC009A518B7185500D61F27 /* C5.xib */, 242 | ); 243 | path = Cells; 244 | sourceTree = ""; 245 | }; 246 | /* End PBXGroup section */ 247 | 248 | /* Begin PBXNativeTarget section */ 249 | 4BEBE78718B59C0E00D674F5 /* CellHeightDemo */ = { 250 | isa = PBXNativeTarget; 251 | buildConfigurationList = 4BEBE7BA18B59C0E00D674F5 /* Build configuration list for PBXNativeTarget "CellHeightDemo" */; 252 | buildPhases = ( 253 | 4BEBE78418B59C0E00D674F5 /* Sources */, 254 | 4BEBE78518B59C0E00D674F5 /* Frameworks */, 255 | 4BEBE78618B59C0E00D674F5 /* Resources */, 256 | ); 257 | buildRules = ( 258 | ); 259 | dependencies = ( 260 | ); 261 | name = CellHeightDemo; 262 | productName = CellHeightDemo; 263 | productReference = 4BEBE78818B59C0E00D674F5 /* CellHeightDemo.app */; 264 | productType = "com.apple.product-type.application"; 265 | }; 266 | 4BEBE7A818B59C0E00D674F5 /* CellHeightDemoTests */ = { 267 | isa = PBXNativeTarget; 268 | buildConfigurationList = 4BEBE7BD18B59C0E00D674F5 /* Build configuration list for PBXNativeTarget "CellHeightDemoTests" */; 269 | buildPhases = ( 270 | 4BEBE7A518B59C0E00D674F5 /* Sources */, 271 | 4BEBE7A618B59C0E00D674F5 /* Frameworks */, 272 | 4BEBE7A718B59C0E00D674F5 /* Resources */, 273 | ); 274 | buildRules = ( 275 | ); 276 | dependencies = ( 277 | 4BEBE7AF18B59C0E00D674F5 /* PBXTargetDependency */, 278 | ); 279 | name = CellHeightDemoTests; 280 | productName = CellHeightDemoTests; 281 | productReference = 4BEBE7A918B59C0E00D674F5 /* CellHeightDemoTests.xctest */; 282 | productType = "com.apple.product-type.bundle.unit-test"; 283 | }; 284 | /* End PBXNativeTarget section */ 285 | 286 | /* Begin PBXProject section */ 287 | 4BEBE78018B59C0E00D674F5 /* Project object */ = { 288 | isa = PBXProject; 289 | attributes = { 290 | LastUpgradeCheck = 0500; 291 | ORGANIZATIONNAME = LF; 292 | TargetAttributes = { 293 | 4BEBE7A818B59C0E00D674F5 = { 294 | TestTargetID = 4BEBE78718B59C0E00D674F5; 295 | }; 296 | }; 297 | }; 298 | buildConfigurationList = 4BEBE78318B59C0E00D674F5 /* Build configuration list for PBXProject "CellHeightDemo" */; 299 | compatibilityVersion = "Xcode 3.2"; 300 | developmentRegion = English; 301 | hasScannedForEncodings = 0; 302 | knownRegions = ( 303 | en, 304 | Base, 305 | ); 306 | mainGroup = 4BEBE77F18B59C0E00D674F5; 307 | productRefGroup = 4BEBE78918B59C0E00D674F5 /* Products */; 308 | projectDirPath = ""; 309 | projectRoot = ""; 310 | targets = ( 311 | 4BEBE78718B59C0E00D674F5 /* CellHeightDemo */, 312 | 4BEBE7A818B59C0E00D674F5 /* CellHeightDemoTests */, 313 | ); 314 | }; 315 | /* End PBXProject section */ 316 | 317 | /* Begin PBXResourcesBuildPhase section */ 318 | 4BEBE78618B59C0E00D674F5 /* Resources */ = { 319 | isa = PBXResourcesBuildPhase; 320 | buildActionMask = 2147483647; 321 | files = ( 322 | 4BEBE7A418B59C0E00D674F5 /* Images.xcassets in Resources */, 323 | 4BC009AE18B7391000D61F27 /* C2.xib in Resources */, 324 | 4BEBE79618B59C0E00D674F5 /* InfoPlist.strings in Resources */, 325 | 4BC009A618B7185500D61F27 /* C5.xib in Resources */, 326 | 4BEBE7E318B59E5A00D674F5 /* img.png in Resources */, 327 | 4BEBE79F18B59C0E00D674F5 /* Main.storyboard in Resources */, 328 | 4BEBE7DF18B59DC000D674F5 /* C1.xib in Resources */, 329 | 4BC0099E18B70B9600D61F27 /* C4.xib in Resources */, 330 | 4BEBE7EE18B5AAD900D674F5 /* C3.xib in Resources */, 331 | ); 332 | runOnlyForDeploymentPostprocessing = 0; 333 | }; 334 | 4BEBE7A718B59C0E00D674F5 /* Resources */ = { 335 | isa = PBXResourcesBuildPhase; 336 | buildActionMask = 2147483647; 337 | files = ( 338 | 4BEBE7B518B59C0E00D674F5 /* InfoPlist.strings in Resources */, 339 | ); 340 | runOnlyForDeploymentPostprocessing = 0; 341 | }; 342 | /* End PBXResourcesBuildPhase section */ 343 | 344 | /* Begin PBXSourcesBuildPhase section */ 345 | 4BEBE78418B59C0E00D674F5 /* Sources */ = { 346 | isa = PBXSourcesBuildPhase; 347 | buildActionMask = 2147483647; 348 | files = ( 349 | 4BEBE7A218B59C0E00D674F5 /* ViewController.m in Sources */, 350 | 4BEBE7EC18B5A83E00D674F5 /* C3.m in Sources */, 351 | 4BC009A118B70BA500D61F27 /* C4.m in Sources */, 352 | 4BEBE7C518B59D6400D674F5 /* T2ViewController.m in Sources */, 353 | 4BC009AC18B7390200D61F27 /* C2.m in Sources */, 354 | 4BEBE7E918B59F1800D674F5 /* BaseViewController.m in Sources */, 355 | 4BC009A918B7192C00D61F27 /* T5ViewController.m in Sources */, 356 | 4BEBE7C218B59D5A00D674F5 /* T1ViewController.m in Sources */, 357 | 4BEBE7DE18B59DC000D674F5 /* C1.m in Sources */, 358 | 4BEBE7C818B59D6E00D674F5 /* T3ViewController.m in Sources */, 359 | 4BC009A418B7184900D61F27 /* C5.m in Sources */, 360 | 4BEBE7CB18B59D7700D674F5 /* T4ViewController.m in Sources */, 361 | 4BEBE79C18B59C0E00D674F5 /* AppDelegate.m in Sources */, 362 | 4BEBE7E618B59ECB00D674F5 /* NSString+Ext.m in Sources */, 363 | 4BC0094A18B5FBDC00D61F27 /* NSLayoutConstraint+ClassMethodPriority.m in Sources */, 364 | 4BEBE79818B59C0E00D674F5 /* main.m in Sources */, 365 | ); 366 | runOnlyForDeploymentPostprocessing = 0; 367 | }; 368 | 4BEBE7A518B59C0E00D674F5 /* Sources */ = { 369 | isa = PBXSourcesBuildPhase; 370 | buildActionMask = 2147483647; 371 | files = ( 372 | 4BEBE7B718B59C0E00D674F5 /* CellHeightDemoTests.m in Sources */, 373 | ); 374 | runOnlyForDeploymentPostprocessing = 0; 375 | }; 376 | /* End PBXSourcesBuildPhase section */ 377 | 378 | /* Begin PBXTargetDependency section */ 379 | 4BEBE7AF18B59C0E00D674F5 /* PBXTargetDependency */ = { 380 | isa = PBXTargetDependency; 381 | target = 4BEBE78718B59C0E00D674F5 /* CellHeightDemo */; 382 | targetProxy = 4BEBE7AE18B59C0E00D674F5 /* PBXContainerItemProxy */; 383 | }; 384 | /* End PBXTargetDependency section */ 385 | 386 | /* Begin PBXVariantGroup section */ 387 | 4BEBE79418B59C0E00D674F5 /* InfoPlist.strings */ = { 388 | isa = PBXVariantGroup; 389 | children = ( 390 | 4BEBE79518B59C0E00D674F5 /* en */, 391 | ); 392 | name = InfoPlist.strings; 393 | sourceTree = ""; 394 | }; 395 | 4BEBE79D18B59C0E00D674F5 /* Main.storyboard */ = { 396 | isa = PBXVariantGroup; 397 | children = ( 398 | 4BEBE79E18B59C0E00D674F5 /* Base */, 399 | ); 400 | name = Main.storyboard; 401 | sourceTree = ""; 402 | }; 403 | 4BEBE7B318B59C0E00D674F5 /* InfoPlist.strings */ = { 404 | isa = PBXVariantGroup; 405 | children = ( 406 | 4BEBE7B418B59C0E00D674F5 /* en */, 407 | ); 408 | name = InfoPlist.strings; 409 | sourceTree = ""; 410 | }; 411 | /* End PBXVariantGroup section */ 412 | 413 | /* Begin XCBuildConfiguration section */ 414 | 4BEBE7B818B59C0E00D674F5 /* Debug */ = { 415 | isa = XCBuildConfiguration; 416 | buildSettings = { 417 | ALWAYS_SEARCH_USER_PATHS = NO; 418 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 419 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 420 | CLANG_CXX_LIBRARY = "libc++"; 421 | CLANG_ENABLE_MODULES = YES; 422 | CLANG_ENABLE_OBJC_ARC = YES; 423 | CLANG_WARN_BOOL_CONVERSION = YES; 424 | CLANG_WARN_CONSTANT_CONVERSION = YES; 425 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 426 | CLANG_WARN_EMPTY_BODY = YES; 427 | CLANG_WARN_ENUM_CONVERSION = YES; 428 | CLANG_WARN_INT_CONVERSION = YES; 429 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 430 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 431 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 432 | COPY_PHASE_STRIP = NO; 433 | GCC_C_LANGUAGE_STANDARD = gnu99; 434 | GCC_DYNAMIC_NO_PIC = NO; 435 | GCC_OPTIMIZATION_LEVEL = 0; 436 | GCC_PREPROCESSOR_DEFINITIONS = ( 437 | "DEBUG=1", 438 | "$(inherited)", 439 | ); 440 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 441 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 442 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 443 | GCC_WARN_UNDECLARED_SELECTOR = YES; 444 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 445 | GCC_WARN_UNUSED_FUNCTION = YES; 446 | GCC_WARN_UNUSED_VARIABLE = YES; 447 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 448 | ONLY_ACTIVE_ARCH = YES; 449 | SDKROOT = iphoneos; 450 | }; 451 | name = Debug; 452 | }; 453 | 4BEBE7B918B59C0E00D674F5 /* Release */ = { 454 | isa = XCBuildConfiguration; 455 | buildSettings = { 456 | ALWAYS_SEARCH_USER_PATHS = NO; 457 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 458 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 459 | CLANG_CXX_LIBRARY = "libc++"; 460 | CLANG_ENABLE_MODULES = YES; 461 | CLANG_ENABLE_OBJC_ARC = YES; 462 | CLANG_WARN_BOOL_CONVERSION = YES; 463 | CLANG_WARN_CONSTANT_CONVERSION = YES; 464 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 465 | CLANG_WARN_EMPTY_BODY = YES; 466 | CLANG_WARN_ENUM_CONVERSION = YES; 467 | CLANG_WARN_INT_CONVERSION = YES; 468 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 469 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 470 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 471 | COPY_PHASE_STRIP = YES; 472 | ENABLE_NS_ASSERTIONS = NO; 473 | GCC_C_LANGUAGE_STANDARD = gnu99; 474 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 475 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 476 | GCC_WARN_UNDECLARED_SELECTOR = YES; 477 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 478 | GCC_WARN_UNUSED_FUNCTION = YES; 479 | GCC_WARN_UNUSED_VARIABLE = YES; 480 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 481 | SDKROOT = iphoneos; 482 | VALIDATE_PRODUCT = YES; 483 | }; 484 | name = Release; 485 | }; 486 | 4BEBE7BB18B59C0E00D674F5 /* Debug */ = { 487 | isa = XCBuildConfiguration; 488 | buildSettings = { 489 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 490 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 491 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 492 | GCC_PREFIX_HEADER = "CellHeightDemo/CellHeightDemo-Prefix.pch"; 493 | INFOPLIST_FILE = "CellHeightDemo/CellHeightDemo-Info.plist"; 494 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 495 | PRODUCT_NAME = "$(TARGET_NAME)"; 496 | WRAPPER_EXTENSION = app; 497 | }; 498 | name = Debug; 499 | }; 500 | 4BEBE7BC18B59C0E00D674F5 /* Release */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 505 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 506 | GCC_PREFIX_HEADER = "CellHeightDemo/CellHeightDemo-Prefix.pch"; 507 | INFOPLIST_FILE = "CellHeightDemo/CellHeightDemo-Info.plist"; 508 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | WRAPPER_EXTENSION = app; 511 | }; 512 | name = Release; 513 | }; 514 | 4BEBE7BE18B59C0E00D674F5 /* Debug */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 518 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CellHeightDemo.app/CellHeightDemo"; 519 | FRAMEWORK_SEARCH_PATHS = ( 520 | "$(SDKROOT)/Developer/Library/Frameworks", 521 | "$(inherited)", 522 | "$(DEVELOPER_FRAMEWORKS_DIR)", 523 | ); 524 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 525 | GCC_PREFIX_HEADER = "CellHeightDemo/CellHeightDemo-Prefix.pch"; 526 | GCC_PREPROCESSOR_DEFINITIONS = ( 527 | "DEBUG=1", 528 | "$(inherited)", 529 | ); 530 | INFOPLIST_FILE = "CellHeightDemoTests/CellHeightDemoTests-Info.plist"; 531 | PRODUCT_NAME = "$(TARGET_NAME)"; 532 | TEST_HOST = "$(BUNDLE_LOADER)"; 533 | WRAPPER_EXTENSION = xctest; 534 | }; 535 | name = Debug; 536 | }; 537 | 4BEBE7BF18B59C0E00D674F5 /* Release */ = { 538 | isa = XCBuildConfiguration; 539 | buildSettings = { 540 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 541 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CellHeightDemo.app/CellHeightDemo"; 542 | FRAMEWORK_SEARCH_PATHS = ( 543 | "$(SDKROOT)/Developer/Library/Frameworks", 544 | "$(inherited)", 545 | "$(DEVELOPER_FRAMEWORKS_DIR)", 546 | ); 547 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 548 | GCC_PREFIX_HEADER = "CellHeightDemo/CellHeightDemo-Prefix.pch"; 549 | INFOPLIST_FILE = "CellHeightDemoTests/CellHeightDemoTests-Info.plist"; 550 | PRODUCT_NAME = "$(TARGET_NAME)"; 551 | TEST_HOST = "$(BUNDLE_LOADER)"; 552 | WRAPPER_EXTENSION = xctest; 553 | }; 554 | name = Release; 555 | }; 556 | /* End XCBuildConfiguration section */ 557 | 558 | /* Begin XCConfigurationList section */ 559 | 4BEBE78318B59C0E00D674F5 /* Build configuration list for PBXProject "CellHeightDemo" */ = { 560 | isa = XCConfigurationList; 561 | buildConfigurations = ( 562 | 4BEBE7B818B59C0E00D674F5 /* Debug */, 563 | 4BEBE7B918B59C0E00D674F5 /* Release */, 564 | ); 565 | defaultConfigurationIsVisible = 0; 566 | defaultConfigurationName = Release; 567 | }; 568 | 4BEBE7BA18B59C0E00D674F5 /* Build configuration list for PBXNativeTarget "CellHeightDemo" */ = { 569 | isa = XCConfigurationList; 570 | buildConfigurations = ( 571 | 4BEBE7BB18B59C0E00D674F5 /* Debug */, 572 | 4BEBE7BC18B59C0E00D674F5 /* Release */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | 4BEBE7BD18B59C0E00D674F5 /* Build configuration list for PBXNativeTarget "CellHeightDemoTests" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | 4BEBE7BE18B59C0E00D674F5 /* Debug */, 581 | 4BEBE7BF18B59C0E00D674F5 /* Release */, 582 | ); 583 | defaultConfigurationIsVisible = 0; 584 | defaultConfigurationName = Release; 585 | }; 586 | /* End XCConfigurationList section */ 587 | }; 588 | rootObject = 4BEBE78018B59C0E00D674F5 /* Project object */; 589 | } 590 | -------------------------------------------------------------------------------- /CellHeightDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CellHeightDemo.xcodeproj/project.xcworkspace/xcuserdata/tangxp.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ondev/CellHeightDemo/46d46fb7bc6af08c30984ffa72b62486e6d206fe/CellHeightDemo.xcodeproj/project.xcworkspace/xcuserdata/tangxp.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CellHeightDemo.xcodeproj/project.xcworkspace/xcuserdata/tangxp.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CellHeightDemo.xcodeproj/xcuserdata/tangxp.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /CellHeightDemo.xcodeproj/xcuserdata/tangxp.xcuserdatad/xcschemes/CellHeightDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /CellHeightDemo.xcodeproj/xcuserdata/tangxp.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CellHeightDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4BEBE78718B59C0E00D674F5 16 | 17 | primary 18 | 19 | 20 | 4BEBE7A818B59C0E00D674F5 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CellHeightDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CellHeightDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | //http://www.howlin-interactive.com/2013/01/creating-a-self-sizing-uitextview-within-a-uitableviewcell-in-ios-6/ 11 | //http://johnszumski.com/blog/auto-layout-for-table-view-cells-with-dynamic-heights 12 | //http://technet.weblineindia.com/mobile/add-auto-layout-support-for-uiscrollview-with-example-in-ios-app-development/ 13 | //http://useyourloaf.com/blog/2014/02/14/table-view-cells-with-varying-row-heights.html 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | // Override point for customization after application launch. 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 | -------------------------------------------------------------------------------- /CellHeightDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 30 | 40 | 50 | 60 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 233 | 243 | 249 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | -------------------------------------------------------------------------------- /CellHeightDemo/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseViewController : UITableViewController 12 | 13 | @property (nonatomic, strong) UITableViewCell *prototypeCell; 14 | @property (nonatomic, strong) NSArray *tableData; 15 | @end 16 | -------------------------------------------------------------------------------- /CellHeightDemo/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface BaseViewController () 12 | 13 | @end 14 | 15 | @implementation BaseViewController 16 | 17 | - (id)initWithStyle:(UITableViewStyle)style 18 | { 19 | self = [super initWithStyle:style]; 20 | if (self) { 21 | // Custom initialization 22 | } 23 | return self; 24 | } 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | 30 | self.tableData = @[@"1\n2\n3\n4\n5\n6", @"123456789012345678901234567890", @"1\n2", @"1\n2\n3", @"1"]; 31 | // Uncomment the following line to preserve selection between presentations. 32 | // self.clearsSelectionOnViewWillAppear = NO; 33 | 34 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 35 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 36 | } 37 | 38 | - (void)didReceiveMemoryWarning 39 | { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | #pragma mark - Table view data source 45 | 46 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 47 | { 48 | // Return the number of sections. 49 | return 0; 50 | } 51 | 52 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 53 | { 54 | // Return the number of rows in the section. 55 | return 0; 56 | } 57 | 58 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 59 | { 60 | static NSString *CellIdentifier = @"Cell"; 61 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 62 | 63 | // Configure the cell... 64 | 65 | return cell; 66 | } 67 | 68 | /* 69 | // Override to support conditional editing of the table view. 70 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 71 | { 72 | // Return NO if you do not want the specified item to be editable. 73 | return YES; 74 | } 75 | */ 76 | 77 | /* 78 | // Override to support editing the table view. 79 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 80 | { 81 | if (editingStyle == UITableViewCellEditingStyleDelete) { 82 | // Delete the row from the data source 83 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 84 | } 85 | else if (editingStyle == UITableViewCellEditingStyleInsert) { 86 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 87 | } 88 | } 89 | */ 90 | 91 | /* 92 | // Override to support rearranging the table view. 93 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath 94 | { 95 | } 96 | */ 97 | 98 | /* 99 | // Override to support conditional rearranging of the table view. 100 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 101 | { 102 | // Return NO if you do not want the item to be re-orderable. 103 | return YES; 104 | } 105 | */ 106 | 107 | /* 108 | #pragma mark - Navigation 109 | 110 | // In a story board-based application, you will often want to do a little preparation before navigation 111 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 112 | { 113 | // Get the new view controller using [segue destinationViewController]. 114 | // Pass the selected object to the new view controller. 115 | } 116 | 117 | */ 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /CellHeightDemo/CellHeightDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.lf.celldemo 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 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CellHeightDemo/CellHeightDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C1.h: -------------------------------------------------------------------------------- 1 | // 2 | // C1.h 3 | // CellHigthDemo 4 | // 5 | // Created by Haven on 19/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface C1 : UITableViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UIImageView *i; 14 | @property (weak, nonatomic) IBOutlet UILabel *t; 15 | @end 16 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C1.m: -------------------------------------------------------------------------------- 1 | // 2 | // C1.m 3 | // CellHigthDemo 4 | // 5 | // Created by Haven on 19/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "C1.h" 10 | #import "NSLayoutConstraint+ClassMethodPriority.h" 11 | 12 | @implementation C1 13 | 14 | 15 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 16 | { 17 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 18 | if (self) { 19 | // Initialization code 20 | 21 | } 22 | return self; 23 | } 24 | 25 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 26 | { 27 | [super setSelected:selected animated:animated]; 28 | 29 | // Configure the view for the selected state 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C1.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C2.h: -------------------------------------------------------------------------------- 1 | // 2 | // C2.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface C2 : UITableViewCell 12 | @property (weak, nonatomic) IBOutlet UITextView *t; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C2.m: -------------------------------------------------------------------------------- 1 | // 2 | // C2.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "C2.h" 10 | 11 | @implementation C2 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C2.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C3.h: -------------------------------------------------------------------------------- 1 | // 2 | // C3.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface C3 : UITableViewCell 12 | @property (weak, nonatomic) IBOutlet UILabel *t; 13 | @property (weak, nonatomic) IBOutlet UIImageView *i; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C3.m: -------------------------------------------------------------------------------- 1 | // 2 | // C3.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "C3.h" 10 | 11 | @implementation C3 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C3.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C4.h: -------------------------------------------------------------------------------- 1 | // 2 | // C4.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface C4 : UITableViewCell 12 | @property (weak, nonatomic) IBOutlet UIImageView *i; 13 | @property (weak, nonatomic) IBOutlet UITextView *t; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C4.m: -------------------------------------------------------------------------------- 1 | // 2 | // C4.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "C4.h" 10 | 11 | @implementation C4 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C4.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C5.h: -------------------------------------------------------------------------------- 1 | // 2 | // C5.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface C5 : UITableViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UITextView *t; 14 | @end 15 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C5.m: -------------------------------------------------------------------------------- 1 | // 2 | // C5.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "C5.h" 10 | 11 | @implementation C5 12 | 13 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 14 | { 15 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 23 | { 24 | [super setSelected:selected animated:animated]; 25 | 26 | // Configure the view for the selected state 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CellHeightDemo/Cells/C5.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /CellHeightDemo/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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CellHeightDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /CellHeightDemo/NSLayoutConstraint+ClassMethodPriority.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+ClassMethodPriority.h 3 | // DynamicCellHeights 4 | // 5 | // Copyright (c) 2013 John Szumski. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSLayoutConstraint (ClassMethodPriority) 11 | 12 | + (id)constraintWithItem:(id)view1 13 | attribute:(NSLayoutAttribute)attr1 14 | relatedBy:(NSLayoutRelation)relation 15 | toItem:(id)view2 16 | attribute:(NSLayoutAttribute)attr2 17 | multiplier:(CGFloat)multiplier 18 | constant:(CGFloat)c 19 | priority:(UILayoutPriority)priority; 20 | 21 | @end -------------------------------------------------------------------------------- /CellHeightDemo/NSLayoutConstraint+ClassMethodPriority.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+ClassMethodPriority.m 3 | // DynamicCellHeights 4 | // 5 | // Copyright (c) 2013 John Szumski. All rights reserved. 6 | // 7 | 8 | #import "NSLayoutConstraint+ClassMethodPriority.h" 9 | 10 | @implementation NSLayoutConstraint (ClassMethodPriority) 11 | 12 | + (id)constraintWithItem:(id)view1 13 | attribute:(NSLayoutAttribute)attr1 14 | relatedBy:(NSLayoutRelation)relation 15 | toItem:(id)view2 16 | attribute:(NSLayoutAttribute)attr2 17 | multiplier:(CGFloat)multiplier 18 | constant:(CGFloat)c 19 | priority:(UILayoutPriority)priority { 20 | 21 | NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view1 22 | attribute:attr1 23 | relatedBy:relation 24 | toItem:view2 25 | attribute:attr2 26 | multiplier:multiplier 27 | constant:c]; 28 | constraint.priority = priority; 29 | 30 | return constraint; 31 | } 32 | 33 | @end -------------------------------------------------------------------------------- /CellHeightDemo/NSString+Ext.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Ext.h 3 | // v2ex 4 | // 5 | // Created by Haven on 18/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (Ext) 12 | - (CGSize)calculateSize:(CGSize)size font:(UIFont *)font; 13 | @end 14 | -------------------------------------------------------------------------------- /CellHeightDemo/NSString+Ext.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Ext.m 3 | // v2ex 4 | // 5 | // Created by Haven on 18/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "NSString+Ext.h" 10 | 11 | @implementation NSString (Ext) 12 | - (CGSize)calculateSize:(CGSize)size font:(UIFont *)font { 13 | CGSize expectedLabelSize = CGSizeZero; 14 | 15 | if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { 16 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; 17 | paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping; 18 | NSDictionary *attributes = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paragraphStyle.copy}; 19 | 20 | expectedLabelSize = [self boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size; 21 | } 22 | else { 23 | expectedLabelSize = [self sizeWithFont:font 24 | constrainedToSize:size 25 | lineBreakMode:NSLineBreakByWordWrapping]; 26 | } 27 | 28 | return CGSizeMake(ceil(expectedLabelSize.width), ceil(expectedLabelSize.height)); 29 | } 30 | @end 31 | -------------------------------------------------------------------------------- /CellHeightDemo/T1ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // T1ViewController.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseViewController.h" 11 | 12 | @interface T1ViewController : BaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CellHeightDemo/T1ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // T1ViewController.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "T1ViewController.h" 10 | #import "C1.h" 11 | 12 | @interface T1ViewController () 13 | 14 | @end 15 | 16 | @implementation T1ViewController 17 | 18 | - (id)initWithStyle:(UITableViewStyle)style 19 | { 20 | self = [super initWithStyle:style]; 21 | if (self) { 22 | // Custom initialization 23 | } 24 | return self; 25 | } 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | UINib *cellNib = [UINib nibWithNibName:@"C1" bundle:nil]; 31 | [self.tableView registerNib:cellNib forCellReuseIdentifier:@"C1"]; 32 | self.prototypeCell = [self.tableView dequeueReusableCellWithIdentifier:@"C1"]; 33 | 34 | C1 *c = [[[NSBundle mainBundle] loadNibNamed:@"C1" owner:self options:nil] objectAtIndex:0]; 35 | 36 | CGSize size = [c.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 37 | NSLog(@"h=%f", size.height); 38 | 39 | // Uncomment the following line to preserve selection between presentations. 40 | // self.clearsSelectionOnViewWillAppear = NO; 41 | 42 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 43 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 44 | } 45 | 46 | - (void)didReceiveMemoryWarning 47 | { 48 | [super didReceiveMemoryWarning]; 49 | // Dispose of any resources that can be recreated. 50 | } 51 | 52 | #pragma mark - Table view data source 53 | 54 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 55 | { 56 | // Return the number of sections. 57 | return 1; 58 | } 59 | 60 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 61 | { 62 | // Return the number of rows in the section. 63 | return self.tableData.count; 64 | } 65 | 66 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 67 | { 68 | C1 *cell = [self.tableView dequeueReusableCellWithIdentifier:@"C1"]; 69 | cell.t.text = [self.tableData objectAtIndex:indexPath.row]; 70 | return cell; 71 | } 72 | 73 | #pragma mark - UITableViewDelegate 74 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 75 | C1 *cell = (C1 *)self.prototypeCell; 76 | cell.translatesAutoresizingMaskIntoConstraints = NO; 77 | cell.t.translatesAutoresizingMaskIntoConstraints = NO; 78 | cell.i.translatesAutoresizingMaskIntoConstraints = NO; 79 | cell.t.text = [self.tableData objectAtIndex:indexPath.row]; 80 | CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 81 | NSLog(@"h=%f", size.height + 1); 82 | return 1 + size.height; 83 | } 84 | 85 | - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { 86 | return 66; 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /CellHeightDemo/T2ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // T2ViewController.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseViewController.h" 11 | 12 | @interface T2ViewController : BaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CellHeightDemo/T2ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // T2ViewController.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "T2ViewController.h" 10 | #import "C2.h" 11 | 12 | @interface T2ViewController () 13 | 14 | @end 15 | 16 | @implementation T2ViewController 17 | 18 | - (id)initWithStyle:(UITableViewStyle)style 19 | { 20 | self = [super initWithStyle:style]; 21 | if (self) { 22 | // Custom initialization 23 | } 24 | return self; 25 | } 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | UINib *cellNib = [UINib nibWithNibName:@"C2" bundle:nil]; 31 | [self.tableView registerNib:cellNib forCellReuseIdentifier:@"C2"]; 32 | 33 | self.prototypeCell = [self.tableView dequeueReusableCellWithIdentifier:@"C2"]; 34 | self.tableData = @[@"1\n2\n3\n4\n5\n6", @"123456789012345678901234567890", @"1\n2", @"1\n2\n3", @"1"]; 35 | // Uncomment the following line to preserve selection between presentations. 36 | // self.clearsSelectionOnViewWillAppear = NO; 37 | 38 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 39 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 40 | } 41 | 42 | - (void)didReceiveMemoryWarning 43 | { 44 | [super didReceiveMemoryWarning]; 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | #pragma mark - Table view data source 49 | 50 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 51 | { 52 | // Return the number of sections. 53 | return 1; 54 | } 55 | 56 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 57 | { 58 | // Return the number of rows in the section. 59 | return self.tableData.count; 60 | } 61 | 62 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 63 | { 64 | C2 *cell = [self.tableView dequeueReusableCellWithIdentifier:@"C2"]; 65 | cell.t.text = [self.tableData objectAtIndex:indexPath.row]; 66 | return cell; 67 | } 68 | 69 | #pragma mark - UITableViewDelegate 70 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 71 | C2 *cell = (C2 *)self.prototypeCell; 72 | cell.t.text = [self.tableData objectAtIndex:indexPath.row]; 73 | CGSize s = cell.t.contentSize; //contentSize 在autolayout下,与它的frame相关 74 | CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; 75 | CGSize textViewSize = [cell.t sizeThatFits:CGSizeMake(cell.t.frame.size.width, FLT_MAX)]; 76 | CGFloat h = size.height + textViewSize.height; 77 | h = h > 89 ? h : 89; //89是图片显示的最低高度, 见xib 78 | NSLog(@"h=%f", h); 79 | return 1 + h; 80 | } 81 | 82 | //- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { 83 | // return 66; 84 | //} 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /CellHeightDemo/T3ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // T3ViewController.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseViewController.h" 11 | 12 | @interface T3ViewController : BaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CellHeightDemo/T3ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // T3ViewController.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "T3ViewController.h" 10 | #import "C3.h" 11 | #import "NSString+Ext.h" 12 | 13 | @interface T3ViewController () 14 | 15 | @end 16 | 17 | @implementation T3ViewController 18 | 19 | - (id)initWithStyle:(UITableViewStyle)style 20 | { 21 | self = [super initWithStyle:style]; 22 | if (self) { 23 | // Custom initialization 24 | } 25 | return self; 26 | } 27 | 28 | - (void)viewDidLoad 29 | { 30 | [super viewDidLoad]; 31 | 32 | 33 | UINib *cellNib = [UINib nibWithNibName:@"C3" bundle:nil]; 34 | [self.tableView registerNib:cellNib forCellReuseIdentifier:@"C3"]; 35 | self.prototypeCell = [self.tableView dequeueReusableCellWithIdentifier:@"C3"]; 36 | 37 | // Uncomment the following line to preserve selection between presentations. 38 | // self.clearsSelectionOnViewWillAppear = NO; 39 | 40 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 41 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 42 | } 43 | 44 | - (void)didReceiveMemoryWarning 45 | { 46 | [super didReceiveMemoryWarning]; 47 | // Dispose of any resources that can be recreated. 48 | } 49 | 50 | #pragma mark - Table view data source 51 | 52 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 53 | { 54 | // Return the number of sections. 55 | return 1; 56 | } 57 | 58 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 59 | { 60 | // Return the number of rows in the section. 61 | return self.tableData.count; 62 | } 63 | 64 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 65 | { 66 | C3 *cell = [self.tableView dequeueReusableCellWithIdentifier:@"C3"]; 67 | cell.t.text = [self.tableData objectAtIndex:indexPath.row]; 68 | [cell.t sizeToFit]; 69 | return cell; 70 | } 71 | 72 | #pragma mark - UITableViewDelegate 73 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 74 | C3 *cell = (C3 *)self.prototypeCell; 75 | NSString *str = [self.tableData objectAtIndex:indexPath.row]; 76 | cell.t.text = str; 77 | CGSize s = [str calculateSize:CGSizeMake(cell.t.frame.size.width, FLT_MAX) font:cell.t.font]; 78 | CGFloat defaultHeight = cell.contentView.frame.size.height; 79 | CGFloat height = s.height > defaultHeight ? s.height : defaultHeight; 80 | NSLog(@"h=%f", height); 81 | return 1 + height; 82 | } 83 | 84 | - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { 85 | return 66; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /CellHeightDemo/T4ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // T4ViewController.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseViewController.h" 11 | 12 | @interface T4ViewController : BaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CellHeightDemo/T4ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // T4ViewController.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "T4ViewController.h" 10 | #import "C4.h" 11 | 12 | @interface T4ViewController () 13 | 14 | @end 15 | 16 | @implementation T4ViewController 17 | 18 | - (id)initWithStyle:(UITableViewStyle)style 19 | { 20 | self = [super initWithStyle:style]; 21 | if (self) { 22 | // Custom initialization 23 | } 24 | return self; 25 | } 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | 31 | UINib *cellNib = [UINib nibWithNibName:@"C4" bundle:nil]; 32 | [self.tableView registerNib:cellNib forCellReuseIdentifier:@"C4"]; 33 | self.prototypeCell = [self.tableView dequeueReusableCellWithIdentifier:@"C4"]; 34 | } 35 | 36 | - (void)didReceiveMemoryWarning 37 | { 38 | [super didReceiveMemoryWarning]; 39 | // Dispose of any resources that can be recreated. 40 | } 41 | 42 | #pragma mark - Table view data source 43 | 44 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 45 | { 46 | // Return the number of sections. 47 | return 1; 48 | } 49 | 50 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 51 | { 52 | // Return the number of rows in the section. 53 | return self.tableData.count; 54 | } 55 | 56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 57 | { 58 | C4 *cell = [self.tableView dequeueReusableCellWithIdentifier:@"C4"]; 59 | cell.t.text = [self.tableData objectAtIndex:indexPath.row]; 60 | [cell.t sizeToFit]; 61 | return cell; 62 | } 63 | 64 | #pragma mark - UITableViewDelegate 65 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 66 | C4 *cell = (C4 *)self.prototypeCell; 67 | NSString *str = [self.tableData objectAtIndex:indexPath.row]; 68 | cell.t.text = str; 69 | CGSize s = [cell.t sizeThatFits:CGSizeMake(cell.t.frame.size.width, FLT_MAX)]; 70 | CGFloat defaultHeight = cell.contentView.frame.size.height; 71 | CGFloat height = s.height > defaultHeight ? s.height : defaultHeight; 72 | return 1 + height; 73 | } 74 | 75 | - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { 76 | return UITableViewAutomaticDimension; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /CellHeightDemo/T5ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // T5ViewController.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BaseViewController.h" 11 | 12 | @interface T5ViewController : BaseViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CellHeightDemo/T5ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // T5ViewController.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 21/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "T5ViewController.h" 10 | #import "C5.h" 11 | 12 | @interface T5ViewController () 13 | @property (nonatomic, weak) NSString *updatedStr; 14 | @end 15 | 16 | @implementation T5ViewController 17 | 18 | - (id)initWithStyle:(UITableViewStyle)style 19 | { 20 | self = [super initWithStyle:style]; 21 | if (self) { 22 | // Custom initialization 23 | } 24 | return self; 25 | } 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | 31 | UINib *cellNib = [UINib nibWithNibName:@"C5" bundle:nil]; 32 | [self.tableView registerNib:cellNib forCellReuseIdentifier:@"C5"]; 33 | self.prototypeCell = [self.tableView dequeueReusableCellWithIdentifier:@"C5"]; 34 | } 35 | 36 | - (void)didReceiveMemoryWarning 37 | { 38 | [super didReceiveMemoryWarning]; 39 | // Dispose of any resources that can be recreated. 40 | } 41 | 42 | #pragma mark - Table view data source 43 | 44 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 45 | { 46 | // Return the number of sections. 47 | return 1; 48 | } 49 | 50 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 51 | { 52 | // Return the number of rows in the section. 53 | return 1; 54 | } 55 | 56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 57 | { 58 | C5 *cell = [self.tableView dequeueReusableCellWithIdentifier:@"C5"]; 59 | cell.t.text = @"123"; 60 | cell.t.delegate = self; 61 | return cell; 62 | } 63 | 64 | #pragma mark - UITableViewDelegate 65 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 66 | C5 *cell = (C5 *)self.prototypeCell; 67 | cell.t.text = self.updatedStr; 68 | CGSize s = [cell.t sizeThatFits:CGSizeMake(cell.t.frame.size.width, FLT_MAX)]; 69 | CGFloat defaultHeight = cell.contentView.frame.size.height; 70 | CGFloat height = s.height > defaultHeight ? s.height : defaultHeight; 71 | return 1 + height; 72 | } 73 | 74 | #pragma mark - UITextViewDelegate 75 | - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { 76 | if ([text isEqualToString:@"\n"]) { 77 | NSLog(@"h=%f", textView.contentSize.height); 78 | } 79 | return YES; 80 | } 81 | 82 | - (void)textViewDidChange:(UITextView *)textView { 83 | self.updatedStr = textView.text; 84 | [self.tableView beginUpdates]; 85 | [self.tableView endUpdates]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /CellHeightDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CellHeightDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning 24 | { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CellHeightDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CellHeightDemo/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ondev/CellHeightDemo/46d46fb7bc6af08c30984ffa72b62486e6d206fe/CellHeightDemo/img.png -------------------------------------------------------------------------------- /CellHeightDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CellHeightDemo 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. 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 | -------------------------------------------------------------------------------- /CellHeightDemoTests/CellHeightDemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.lf.extobjc.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /CellHeightDemoTests/CellHeightDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CellHeightDemoTests.m 3 | // CellHeightDemoTests 4 | // 5 | // Created by Haven on 20/2/14. 6 | // Copyright (c) 2014 LF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CellHeightDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CellHeightDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CellHeightDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ondev/CellHeightDemo/46d46fb7bc6af08c30984ffa72b62486e6d206fe/README.md --------------------------------------------------------------------------------