├── AutoLayoutShowcase.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── AutoLayoutShowcase.xccheckout │ └── xcuserdata │ │ └── phil.xcuserdatad │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── phil.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── AutoLayoutShowcase.xcscheme │ └── xcschememanagement.plist ├── AutoLayoutShowcase ├── ALCatalogViewController.swift ├── ALDynamicLayoutViewController.swift ├── ALLayoutContainerViewController.swift ├── ALNavigationController.swift ├── ALProfileTableViewCell.swift ├── ALProfileViewController.swift ├── ALScaleLayoutViewController.swift ├── AppDelegate.swift ├── AutoLayoutShowcase-Bridging-Header.h ├── Base.lproj │ ├── LaunchScreen.xib │ ├── Main.storyboard │ └── Main.storyboard.backup.storyboard ├── Bridging-Header.h ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── avatar.imageset │ │ ├── Contents.json │ │ └── avatar.png │ ├── bear.imageset │ │ ├── Contents.json │ │ └── bear.png │ ├── cell_icon.imageset │ │ ├── Contents.json │ │ └── icon1.png │ ├── header_bg.imageset │ │ ├── Contents.json │ │ └── header_bg.png │ ├── icon_comments.imageset │ │ ├── Contents.json │ │ └── icon_comments@2x.png │ ├── icon_location.imageset │ │ ├── Contents.json │ │ └── icon_location@2x.png │ └── icon_star.imageset │ │ ├── Contents.json │ │ └── icon_follow@2x.png ├── Info.plist ├── NSDate+Format.swift ├── NSLayoutConstraint+Separator.swift ├── TRCircleAvatarView.swift ├── TRProfileHeaderView.swift ├── TRProfileHeaderView.xib ├── UIColor+Hex.swift ├── UIScrollView+ParallaxHeader.h ├── UIScrollView+ParallaxHeader.m ├── UITableView+ContentTouches.swift └── UIView+SpringAnimations.swift └── Resources ├── avatar.png ├── bear.png ├── dynamic1.png ├── header_bg.png ├── icon1.png ├── marks_1.png ├── parallax1.png └── scale1.png /AutoLayoutShowcase.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4ADDC3C81ACCE1300076C01B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3C71ACCE1300076C01B /* AppDelegate.swift */; }; 11 | 4ADDC3CA1ACCE1300076C01B /* ALCatalogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3C91ACCE1300076C01B /* ALCatalogViewController.swift */; }; 12 | 4ADDC3CC1ACCE1300076C01B /* ALLayoutContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3CB1ACCE1300076C01B /* ALLayoutContainerViewController.swift */; }; 13 | 4ADDC3CF1ACCE1300076C01B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4ADDC3CD1ACCE1300076C01B /* Main.storyboard */; }; 14 | 4ADDC3D11ACCE1300076C01B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4ADDC3D01ACCE1300076C01B /* Images.xcassets */; }; 15 | 4ADDC3D41ACCE1300076C01B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4ADDC3D21ACCE1300076C01B /* LaunchScreen.xib */; }; 16 | 4ADDC3EA1ACCE6200076C01B /* ALNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3E91ACCE6200076C01B /* ALNavigationController.swift */; }; 17 | 4ADDC3ED1ACCEBFC0076C01B /* ALProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3EC1ACCEBFC0076C01B /* ALProfileViewController.swift */; }; 18 | 4ADDC3F11ACCEDB00076C01B /* TRProfileHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3EF1ACCEDB00076C01B /* TRProfileHeaderView.swift */; }; 19 | 4ADDC3F21ACCEDB00076C01B /* TRProfileHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4ADDC3F01ACCEDB00076C01B /* TRProfileHeaderView.xib */; }; 20 | 4ADDC3F51ACCEDDD0076C01B /* TRCircleAvatarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3F41ACCEDDD0076C01B /* TRCircleAvatarView.swift */; }; 21 | 4ADDC3FB1ACCEDFE0076C01B /* UIColor+Hex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3F71ACCEDFE0076C01B /* UIColor+Hex.swift */; }; 22 | 4ADDC3FC1ACCEDFE0076C01B /* NSDate+Format.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3F81ACCEDFE0076C01B /* NSDate+Format.swift */; }; 23 | 4ADDC3FD1ACCEDFE0076C01B /* NSLayoutConstraint+Separator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3F91ACCEDFE0076C01B /* NSLayoutConstraint+Separator.swift */; }; 24 | 4ADDC3FE1ACCEDFE0076C01B /* UITableView+ContentTouches.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC3FA1ACCEDFE0076C01B /* UITableView+ContentTouches.swift */; }; 25 | 4ADDC4031ACCEE9F0076C01B /* UIScrollView+ParallaxHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC4021ACCEE9F0076C01B /* UIScrollView+ParallaxHeader.m */; }; 26 | 4ADDC4071ACCF65E0076C01B /* ALProfileTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC4061ACCF65E0076C01B /* ALProfileTableViewCell.swift */; }; 27 | 4ADDC43F1ACD3CC80076C01B /* ALDynamicLayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC43E1ACD3CC80076C01B /* ALDynamicLayoutViewController.swift */; }; 28 | 4ADDC4411ACD543E0076C01B /* UIView+SpringAnimations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC4401ACD543E0076C01B /* UIView+SpringAnimations.swift */; }; 29 | 4ADDC4441ACD552C0076C01B /* ALScaleLayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ADDC4431ACD552C0076C01B /* ALScaleLayoutViewController.swift */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 4ADDC3C21ACCE1300076C01B /* AutoLayoutShowcase.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AutoLayoutShowcase.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 4ADDC3C61ACCE1300076C01B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 4ADDC3C71ACCE1300076C01B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 36 | 4ADDC3C91ACCE1300076C01B /* ALCatalogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ALCatalogViewController.swift; sourceTree = ""; }; 37 | 4ADDC3CB1ACCE1300076C01B /* ALLayoutContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ALLayoutContainerViewController.swift; sourceTree = ""; }; 38 | 4ADDC3CE1ACCE1300076C01B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 4ADDC3D01ACCE1300076C01B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 4ADDC3D31ACCE1300076C01B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 41 | 4ADDC3E91ACCE6200076C01B /* ALNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ALNavigationController.swift; sourceTree = ""; }; 42 | 4ADDC3EC1ACCEBFC0076C01B /* ALProfileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ALProfileViewController.swift; sourceTree = ""; }; 43 | 4ADDC3EF1ACCEDB00076C01B /* TRProfileHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TRProfileHeaderView.swift; sourceTree = ""; }; 44 | 4ADDC3F01ACCEDB00076C01B /* TRProfileHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TRProfileHeaderView.xib; sourceTree = ""; }; 45 | 4ADDC3F41ACCEDDD0076C01B /* TRCircleAvatarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TRCircleAvatarView.swift; sourceTree = ""; }; 46 | 4ADDC3F71ACCEDFE0076C01B /* UIColor+Hex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Hex.swift"; sourceTree = ""; }; 47 | 4ADDC3F81ACCEDFE0076C01B /* NSDate+Format.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSDate+Format.swift"; sourceTree = ""; }; 48 | 4ADDC3F91ACCEDFE0076C01B /* NSLayoutConstraint+Separator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSLayoutConstraint+Separator.swift"; sourceTree = ""; }; 49 | 4ADDC3FA1ACCEDFE0076C01B /* UITableView+ContentTouches.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableView+ContentTouches.swift"; sourceTree = ""; }; 50 | 4ADDC4001ACCEE9E0076C01B /* AutoLayoutShowcase-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AutoLayoutShowcase-Bridging-Header.h"; sourceTree = ""; }; 51 | 4ADDC4011ACCEE9F0076C01B /* UIScrollView+ParallaxHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+ParallaxHeader.h"; sourceTree = ""; }; 52 | 4ADDC4021ACCEE9F0076C01B /* UIScrollView+ParallaxHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+ParallaxHeader.m"; sourceTree = ""; }; 53 | 4ADDC4041ACCEFD50076C01B /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; 54 | 4ADDC4061ACCF65E0076C01B /* ALProfileTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ALProfileTableViewCell.swift; sourceTree = ""; }; 55 | 4ADDC43E1ACD3CC80076C01B /* ALDynamicLayoutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ALDynamicLayoutViewController.swift; sourceTree = ""; }; 56 | 4ADDC4401ACD543E0076C01B /* UIView+SpringAnimations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+SpringAnimations.swift"; sourceTree = ""; }; 57 | 4ADDC4431ACD552C0076C01B /* ALScaleLayoutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ALScaleLayoutViewController.swift; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 4ADDC3BF1ACCE1300076C01B /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 4ADDC3B91ACCE1300076C01B = { 72 | isa = PBXGroup; 73 | children = ( 74 | 4ADDC3C41ACCE1300076C01B /* AutoLayoutShowcase */, 75 | 4ADDC3C31ACCE1300076C01B /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 4ADDC3C31ACCE1300076C01B /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 4ADDC3C21ACCE1300076C01B /* AutoLayoutShowcase.app */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | 4ADDC3C41ACCE1300076C01B /* AutoLayoutShowcase */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 4ADDC3C71ACCE1300076C01B /* AppDelegate.swift */, 91 | 4ADDC3E91ACCE6200076C01B /* ALNavigationController.swift */, 92 | 4ADDC3C91ACCE1300076C01B /* ALCatalogViewController.swift */, 93 | 4ADDC3CD1ACCE1300076C01B /* Main.storyboard */, 94 | 4ADDC3EB1ACCEBED0076C01B /* Example Pages */, 95 | 4ADDC3F61ACCEDEB0076C01B /* Vendor */, 96 | 4ADDC3EE1ACCED2A0076C01B /* Resources */, 97 | 4ADDC3C51ACCE1300076C01B /* Supporting Files */, 98 | ); 99 | path = AutoLayoutShowcase; 100 | sourceTree = ""; 101 | }; 102 | 4ADDC3C51ACCE1300076C01B /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 4ADDC4041ACCEFD50076C01B /* Bridging-Header.h */, 106 | 4ADDC3C61ACCE1300076C01B /* Info.plist */, 107 | ); 108 | name = "Supporting Files"; 109 | sourceTree = ""; 110 | }; 111 | 4ADDC3EB1ACCEBED0076C01B /* Example Pages */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 4ADDC43D1ACD32BE0076C01B /* Dynamic Layout */, 115 | 4ADDC3F31ACCEDB60076C01B /* Profile */, 116 | ); 117 | name = "Example Pages"; 118 | sourceTree = ""; 119 | }; 120 | 4ADDC3EE1ACCED2A0076C01B /* Resources */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 4ADDC3D01ACCE1300076C01B /* Images.xcassets */, 124 | 4ADDC3D21ACCE1300076C01B /* LaunchScreen.xib */, 125 | ); 126 | name = Resources; 127 | sourceTree = ""; 128 | }; 129 | 4ADDC3F31ACCEDB60076C01B /* Profile */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 4ADDC3EC1ACCEBFC0076C01B /* ALProfileViewController.swift */, 133 | 4ADDC4061ACCF65E0076C01B /* ALProfileTableViewCell.swift */, 134 | 4ADDC4051ACCF6500076C01B /* Header */, 135 | ); 136 | name = Profile; 137 | sourceTree = ""; 138 | }; 139 | 4ADDC3F61ACCEDEB0076C01B /* Vendor */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 4ADDC3FF1ACCEE010076C01B /* Extensions */, 143 | ); 144 | name = Vendor; 145 | sourceTree = ""; 146 | }; 147 | 4ADDC3FF1ACCEE010076C01B /* Extensions */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 4ADDC4011ACCEE9F0076C01B /* UIScrollView+ParallaxHeader.h */, 151 | 4ADDC4021ACCEE9F0076C01B /* UIScrollView+ParallaxHeader.m */, 152 | 4ADDC3F71ACCEDFE0076C01B /* UIColor+Hex.swift */, 153 | 4ADDC3F81ACCEDFE0076C01B /* NSDate+Format.swift */, 154 | 4ADDC3F91ACCEDFE0076C01B /* NSLayoutConstraint+Separator.swift */, 155 | 4ADDC3FA1ACCEDFE0076C01B /* UITableView+ContentTouches.swift */, 156 | 4ADDC4401ACD543E0076C01B /* UIView+SpringAnimations.swift */, 157 | 4ADDC4001ACCEE9E0076C01B /* AutoLayoutShowcase-Bridging-Header.h */, 158 | ); 159 | name = Extensions; 160 | sourceTree = ""; 161 | }; 162 | 4ADDC4051ACCF6500076C01B /* Header */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 4ADDC3EF1ACCEDB00076C01B /* TRProfileHeaderView.swift */, 166 | 4ADDC3F01ACCEDB00076C01B /* TRProfileHeaderView.xib */, 167 | 4ADDC3F41ACCEDDD0076C01B /* TRCircleAvatarView.swift */, 168 | ); 169 | name = Header; 170 | sourceTree = ""; 171 | }; 172 | 4ADDC43D1ACD32BE0076C01B /* Dynamic Layout */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | 4ADDC3CB1ACCE1300076C01B /* ALLayoutContainerViewController.swift */, 176 | 4ADDC43E1ACD3CC80076C01B /* ALDynamicLayoutViewController.swift */, 177 | 4ADDC4431ACD552C0076C01B /* ALScaleLayoutViewController.swift */, 178 | ); 179 | name = "Dynamic Layout"; 180 | sourceTree = ""; 181 | }; 182 | /* End PBXGroup section */ 183 | 184 | /* Begin PBXNativeTarget section */ 185 | 4ADDC3C11ACCE1300076C01B /* AutoLayoutShowcase */ = { 186 | isa = PBXNativeTarget; 187 | buildConfigurationList = 4ADDC3E31ACCE1300076C01B /* Build configuration list for PBXNativeTarget "AutoLayoutShowcase" */; 188 | buildPhases = ( 189 | 4ADDC3BE1ACCE1300076C01B /* Sources */, 190 | 4ADDC3BF1ACCE1300076C01B /* Frameworks */, 191 | 4ADDC3C01ACCE1300076C01B /* Resources */, 192 | ); 193 | buildRules = ( 194 | ); 195 | dependencies = ( 196 | ); 197 | name = AutoLayoutShowcase; 198 | productName = AutoLayoutShowcase; 199 | productReference = 4ADDC3C21ACCE1300076C01B /* AutoLayoutShowcase.app */; 200 | productType = "com.apple.product-type.application"; 201 | }; 202 | /* End PBXNativeTarget section */ 203 | 204 | /* Begin PBXProject section */ 205 | 4ADDC3BA1ACCE1300076C01B /* Project object */ = { 206 | isa = PBXProject; 207 | attributes = { 208 | LastUpgradeCheck = 0620; 209 | ORGANIZATIONNAME = Phil; 210 | TargetAttributes = { 211 | 4ADDC3C11ACCE1300076C01B = { 212 | CreatedOnToolsVersion = 6.2; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = 4ADDC3BD1ACCE1300076C01B /* Build configuration list for PBXProject "AutoLayoutShowcase" */; 217 | compatibilityVersion = "Xcode 3.2"; 218 | developmentRegion = English; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | Base, 223 | ); 224 | mainGroup = 4ADDC3B91ACCE1300076C01B; 225 | productRefGroup = 4ADDC3C31ACCE1300076C01B /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | 4ADDC3C11ACCE1300076C01B /* AutoLayoutShowcase */, 230 | ); 231 | }; 232 | /* End PBXProject section */ 233 | 234 | /* Begin PBXResourcesBuildPhase section */ 235 | 4ADDC3C01ACCE1300076C01B /* Resources */ = { 236 | isa = PBXResourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | 4ADDC3CF1ACCE1300076C01B /* Main.storyboard in Resources */, 240 | 4ADDC3D41ACCE1300076C01B /* LaunchScreen.xib in Resources */, 241 | 4ADDC3D11ACCE1300076C01B /* Images.xcassets in Resources */, 242 | 4ADDC3F21ACCEDB00076C01B /* TRProfileHeaderView.xib in Resources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | /* End PBXResourcesBuildPhase section */ 247 | 248 | /* Begin PBXSourcesBuildPhase section */ 249 | 4ADDC3BE1ACCE1300076C01B /* Sources */ = { 250 | isa = PBXSourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | 4ADDC3EA1ACCE6200076C01B /* ALNavigationController.swift in Sources */, 254 | 4ADDC3FD1ACCEDFE0076C01B /* NSLayoutConstraint+Separator.swift in Sources */, 255 | 4ADDC3FB1ACCEDFE0076C01B /* UIColor+Hex.swift in Sources */, 256 | 4ADDC4071ACCF65E0076C01B /* ALProfileTableViewCell.swift in Sources */, 257 | 4ADDC3F11ACCEDB00076C01B /* TRProfileHeaderView.swift in Sources */, 258 | 4ADDC4031ACCEE9F0076C01B /* UIScrollView+ParallaxHeader.m in Sources */, 259 | 4ADDC3F51ACCEDDD0076C01B /* TRCircleAvatarView.swift in Sources */, 260 | 4ADDC43F1ACD3CC80076C01B /* ALDynamicLayoutViewController.swift in Sources */, 261 | 4ADDC3CC1ACCE1300076C01B /* ALLayoutContainerViewController.swift in Sources */, 262 | 4ADDC3FC1ACCEDFE0076C01B /* NSDate+Format.swift in Sources */, 263 | 4ADDC4441ACD552C0076C01B /* ALScaleLayoutViewController.swift in Sources */, 264 | 4ADDC4411ACD543E0076C01B /* UIView+SpringAnimations.swift in Sources */, 265 | 4ADDC3CA1ACCE1300076C01B /* ALCatalogViewController.swift in Sources */, 266 | 4ADDC3FE1ACCEDFE0076C01B /* UITableView+ContentTouches.swift in Sources */, 267 | 4ADDC3ED1ACCEBFC0076C01B /* ALProfileViewController.swift in Sources */, 268 | 4ADDC3C81ACCE1300076C01B /* AppDelegate.swift in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | /* End PBXSourcesBuildPhase section */ 273 | 274 | /* Begin PBXVariantGroup section */ 275 | 4ADDC3CD1ACCE1300076C01B /* Main.storyboard */ = { 276 | isa = PBXVariantGroup; 277 | children = ( 278 | 4ADDC3CE1ACCE1300076C01B /* Base */, 279 | ); 280 | name = Main.storyboard; 281 | sourceTree = ""; 282 | }; 283 | 4ADDC3D21ACCE1300076C01B /* LaunchScreen.xib */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 4ADDC3D31ACCE1300076C01B /* Base */, 287 | ); 288 | name = LaunchScreen.xib; 289 | sourceTree = ""; 290 | }; 291 | /* End PBXVariantGroup section */ 292 | 293 | /* Begin XCBuildConfiguration section */ 294 | 4ADDC3E11ACCE1300076C01B /* Debug */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ALWAYS_SEARCH_USER_PATHS = NO; 298 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 299 | CLANG_CXX_LIBRARY = "libc++"; 300 | CLANG_ENABLE_MODULES = YES; 301 | CLANG_ENABLE_OBJC_ARC = YES; 302 | CLANG_WARN_BOOL_CONVERSION = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 305 | CLANG_WARN_EMPTY_BODY = YES; 306 | CLANG_WARN_ENUM_CONVERSION = YES; 307 | CLANG_WARN_INT_CONVERSION = YES; 308 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 309 | CLANG_WARN_UNREACHABLE_CODE = YES; 310 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 311 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 312 | COPY_PHASE_STRIP = NO; 313 | ENABLE_STRICT_OBJC_MSGSEND = YES; 314 | GCC_C_LANGUAGE_STANDARD = gnu99; 315 | GCC_DYNAMIC_NO_PIC = NO; 316 | GCC_OPTIMIZATION_LEVEL = 0; 317 | GCC_PREPROCESSOR_DEFINITIONS = ( 318 | "DEBUG=1", 319 | "$(inherited)", 320 | ); 321 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 322 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 323 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 324 | GCC_WARN_UNDECLARED_SELECTOR = YES; 325 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 326 | GCC_WARN_UNUSED_FUNCTION = YES; 327 | GCC_WARN_UNUSED_VARIABLE = YES; 328 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 329 | MTL_ENABLE_DEBUG_INFO = YES; 330 | ONLY_ACTIVE_ARCH = YES; 331 | SDKROOT = iphoneos; 332 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 333 | }; 334 | name = Debug; 335 | }; 336 | 4ADDC3E21ACCE1300076C01B /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ALWAYS_SEARCH_USER_PATHS = NO; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BOOL_CONVERSION = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INT_CONVERSION = YES; 350 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 351 | CLANG_WARN_UNREACHABLE_CODE = YES; 352 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 353 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 354 | COPY_PHASE_STRIP = NO; 355 | ENABLE_NS_ASSERTIONS = NO; 356 | ENABLE_STRICT_OBJC_MSGSEND = YES; 357 | GCC_C_LANGUAGE_STANDARD = gnu99; 358 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 359 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 360 | GCC_WARN_UNDECLARED_SELECTOR = YES; 361 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 362 | GCC_WARN_UNUSED_FUNCTION = YES; 363 | GCC_WARN_UNUSED_VARIABLE = YES; 364 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 365 | MTL_ENABLE_DEBUG_INFO = NO; 366 | SDKROOT = iphoneos; 367 | VALIDATE_PRODUCT = YES; 368 | }; 369 | name = Release; 370 | }; 371 | 4ADDC3E41ACCE1300076C01B /* Debug */ = { 372 | isa = XCBuildConfiguration; 373 | buildSettings = { 374 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 375 | CLANG_ENABLE_MODULES = YES; 376 | INFOPLIST_FILE = AutoLayoutShowcase/Info.plist; 377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 378 | PRODUCT_NAME = "$(TARGET_NAME)"; 379 | SWIFT_OBJC_BRIDGING_HEADER = "AutoLayoutShowcase/Bridging-Header.h"; 380 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 381 | }; 382 | name = Debug; 383 | }; 384 | 4ADDC3E51ACCE1300076C01B /* Release */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 388 | CLANG_ENABLE_MODULES = YES; 389 | INFOPLIST_FILE = AutoLayoutShowcase/Info.plist; 390 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 391 | PRODUCT_NAME = "$(TARGET_NAME)"; 392 | SWIFT_OBJC_BRIDGING_HEADER = "AutoLayoutShowcase/Bridging-Header.h"; 393 | }; 394 | name = Release; 395 | }; 396 | /* End XCBuildConfiguration section */ 397 | 398 | /* Begin XCConfigurationList section */ 399 | 4ADDC3BD1ACCE1300076C01B /* Build configuration list for PBXProject "AutoLayoutShowcase" */ = { 400 | isa = XCConfigurationList; 401 | buildConfigurations = ( 402 | 4ADDC3E11ACCE1300076C01B /* Debug */, 403 | 4ADDC3E21ACCE1300076C01B /* Release */, 404 | ); 405 | defaultConfigurationIsVisible = 0; 406 | defaultConfigurationName = Release; 407 | }; 408 | 4ADDC3E31ACCE1300076C01B /* Build configuration list for PBXNativeTarget "AutoLayoutShowcase" */ = { 409 | isa = XCConfigurationList; 410 | buildConfigurations = ( 411 | 4ADDC3E41ACCE1300076C01B /* Debug */, 412 | 4ADDC3E51ACCE1300076C01B /* Release */, 413 | ); 414 | defaultConfigurationIsVisible = 0; 415 | defaultConfigurationName = Release; 416 | }; 417 | /* End XCConfigurationList section */ 418 | }; 419 | rootObject = 4ADDC3BA1ACCE1300076C01B /* Project object */; 420 | } 421 | -------------------------------------------------------------------------------- /AutoLayoutShowcase.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AutoLayoutShowcase.xcodeproj/project.xcworkspace/xcshareddata/AutoLayoutShowcase.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | C1D269B6-DF32-49D8-BE7F-BBB3C809DB41 9 | IDESourceControlProjectName 10 | AutoLayoutShowcase 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 0938B2A6718DBFA9B87E593E160DBE435D00B037 14 | https://github.com/philcn/Auto-Layout-Showcase.git 15 | 16 | IDESourceControlProjectPath 17 | AutoLayoutShowcase.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 0938B2A6718DBFA9B87E593E160DBE435D00B037 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/philcn/Auto-Layout-Showcase.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 0938B2A6718DBFA9B87E593E160DBE435D00B037 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 0938B2A6718DBFA9B87E593E160DBE435D00B037 36 | IDESourceControlWCCName 37 | AutoLayoutShowcase 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /AutoLayoutShowcase.xcodeproj/project.xcworkspace/xcuserdata/phil.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AutoLayoutShowcase.xcodeproj/xcuserdata/phil.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AutoLayoutShowcase.xcodeproj/xcuserdata/phil.xcuserdatad/xcschemes/AutoLayoutShowcase.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /AutoLayoutShowcase.xcodeproj/xcuserdata/phil.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AutoLayoutShowcase.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4ADDC3C11ACCE1300076C01B 16 | 17 | primary 18 | 19 | 20 | 4ADDC3D81ACCE1300076C01B 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/ALCatalogViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALCatalogViewController.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ALCatalogViewController: UITableViewController { 12 | 13 | override func awakeFromNib() { 14 | super.awakeFromNib() 15 | } 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | } 20 | 21 | override func viewWillAppear(animated: Bool) { 22 | if let indexPath = tableView.indexPathsForSelectedRows()?.first as? NSIndexPath { 23 | self.tableView.deselectRowAtIndexPath(indexPath, animated: true) 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/ALDynamicLayoutViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALDynamicLayoutViewController.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ALDynamicLayoutViewController: UIViewController { 12 | 13 | @IBOutlet weak var imageView: UIImageView! 14 | @IBOutlet weak var locationIcon: UIImageView! 15 | @IBOutlet weak var commentIcon: UIImageView! 16 | @IBOutlet weak var locationLabel: UILabel! 17 | @IBOutlet weak var commentLabel: UILabel! 18 | @IBOutlet weak var avatarView: TRCircleAvatarView! 19 | 20 | private var comment: String? { 21 | didSet { 22 | self.commentLabel!.text = self.comment! 23 | UIView.animateDefaultSpringAnimation { 24 | self.view.layoutIfNeeded() 25 | } 26 | } 27 | } 28 | 29 | private var comments: [String] = ["日本北海道西南部重要港市,位于北海道之南岸,南临太平洋,隔着津轻海峡与本州岛的青森相望。", 30 | "函馆是日本北海道西南部重要港市。", 31 | "函馆是北海道的南大门,与横滨、长崎一样,也是一座历史悠久的港口贸易城市。最先门户开放的日本港口之一,另一个是下关。"] 32 | 33 | private var commentIndex: Int = 0 { 34 | didSet { 35 | self.comment = self.comments[commentIndex] 36 | } 37 | } 38 | 39 | override func viewDidLoad() { 40 | super.viewDidLoad() 41 | self.avatarView.whenTapped { [unowned self] in 42 | self.randomizeContent() 43 | } 44 | 45 | self.view.layer.borderWidth = 2.0 46 | self.view.layer.borderColor = UIColor(hex: 0x2A2077).CGColor 47 | } 48 | 49 | func randomizeContent() { 50 | self.commentIndex = (self.commentIndex + 1) % self.comments.count 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/ALLayoutContainerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALLayoutContainerViewController.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ALLayoutContainerViewController: UIViewController { 12 | 13 | private var containerViewWidthIndex: Int? { 14 | didSet { 15 | containerViewWidthConstraint.constant = [360, 300, 240][containerViewWidthIndex!] 16 | animateFrameChange() 17 | } 18 | } 19 | 20 | private var containerViewHeightIndex: Int? { 21 | didSet { 22 | containerViewHeightConstraint.constant = [580, 430, 280][containerViewHeightIndex!] 23 | animateFrameChange() 24 | } 25 | } 26 | 27 | private var contentViewController: UIViewController? 28 | 29 | @IBOutlet weak var containerView: UIView! 30 | @IBOutlet weak var containerViewWidthConstraint: NSLayoutConstraint! 31 | @IBOutlet weak var containerViewHeightConstraint: NSLayoutConstraint! 32 | 33 | @IBAction func rearrangeHorizontally(sender: AnyObject) { 34 | self.containerViewWidthIndex = (self.containerViewWidthIndex! + 1) % 3 35 | } 36 | 37 | @IBAction func rearrangeVertically(sender: AnyObject) { 38 | self.containerViewHeightIndex = (self.containerViewHeightIndex! + 1) % 3 39 | } 40 | 41 | override func viewWillAppear(animated: Bool) { 42 | super.viewWillAppear(animated) 43 | self.containerViewWidthIndex = 0 44 | self.containerViewHeightIndex = 0 45 | } 46 | 47 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 48 | if segue.identifier == "ContentViewController" { 49 | if let controller = segue.destinationViewController as? UIViewController { 50 | self.contentViewController = controller 51 | } 52 | } 53 | } 54 | 55 | private func animateFrameChange() { 56 | UIView.animateDefaultSpringAnimation { 57 | self.view.layoutIfNeeded() 58 | } 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/ALNavigationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALNavigationController.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ALNavigationController: UINavigationController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | } 16 | 17 | // Mark: 三件套 18 | 19 | override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation { 20 | return .Slide 21 | } 22 | 23 | override func preferredStatusBarStyle() -> UIStatusBarStyle { 24 | return .LightContent 25 | /* 26 | if let style = self.viewControllers.last?.preferredStatusBarStyle() { 27 | return style 28 | } 29 | return .LightContent 30 | */ 31 | } 32 | 33 | override func prefersStatusBarHidden() -> Bool { 34 | if let hides = self.viewControllers.last?.prefersStatusBarHidden() { 35 | return hides 36 | } 37 | return false 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/ALProfileTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALProfileTableViewCell.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ALProfileTableViewCell: UITableViewCell { 12 | 13 | override func awakeFromNib() { 14 | super.awakeFromNib() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/ALProfileViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALProfileViewController.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ALProfileViewController: UITableViewController { 12 | 13 | lazy var profileHeaderView :TRProfileHeaderView = TRProfileHeaderView.viewFromNib()! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | self.tableView.optimizeForContentTouches() 18 | self.tableView.addParallaxWithView(self.profileHeaderView, andHeight: 225, andShadow: false) 19 | } 20 | 21 | // MARK: - Table view data source 22 | 23 | override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 24 | return 1 25 | } 26 | 27 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 28 | return 10 29 | } 30 | 31 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 32 | let cell = tableView.dequeueReusableCellWithIdentifier("ALProfileTableViewCell", forIndexPath: indexPath) as! UITableViewCell 33 | 34 | return cell 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/ALScaleLayoutViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ALScaleLayoutViewController.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ALScaleLayoutViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | self.view.layer.borderWidth = 2.0 17 | self.view.layer.borderColor = UIColor(hex: 0x2A2077).CGColor 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 17 | return true 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/AutoLayoutShowcase-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 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 | 195 | 201 | 207 | 213 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 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 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 345 | 346 | 347 | 348 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/Base.lproj/Main.storyboard.backup.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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 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 | 195 | 201 | 207 | 213 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 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 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 345 | 346 | 347 | 348 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Bridging-Header.h 3 | // Triangle 4 | // 5 | // Created by Phil on 15/3/19. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | #ifndef Triangle_Bridging_Header_h 10 | #define Triangle_Bridging_Header_h 11 | 12 | #import "UIScrollView+ParallaxHeader.h" 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/avatar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "avatar.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/avatar.imageset/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/AutoLayoutShowcase/Images.xcassets/avatar.imageset/avatar.png -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/bear.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "bear.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/bear.imageset/bear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/AutoLayoutShowcase/Images.xcassets/bear.imageset/bear.png -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/cell_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon1.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/cell_icon.imageset/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/AutoLayoutShowcase/Images.xcassets/cell_icon.imageset/icon1.png -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/header_bg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "header_bg.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/header_bg.imageset/header_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/AutoLayoutShowcase/Images.xcassets/header_bg.imageset/header_bg.png -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/icon_comments.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_comments@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/icon_comments.imageset/icon_comments@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/AutoLayoutShowcase/Images.xcassets/icon_comments.imageset/icon_comments@2x.png -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/icon_location.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_location@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/icon_location.imageset/icon_location@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/AutoLayoutShowcase/Images.xcassets/icon_location.imageset/icon_location@2x.png -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/icon_star.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_follow@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AutoLayoutShowcase/Images.xcassets/icon_star.imageset/icon_follow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/AutoLayoutShowcase/Images.xcassets/icon_star.imageset/icon_follow@2x.png -------------------------------------------------------------------------------- /AutoLayoutShowcase/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.yourcompany.$(PRODUCT_NAME:rfc1034identifier) 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 | UIStatusBarStyle 34 | UIStatusBarStyleLightContent 35 | UIStatusBarTintParameters 36 | 37 | UINavigationBar 38 | 39 | Style 40 | UIBarStyleDefault 41 | Translucent 42 | 43 | 44 | 45 | UISupportedInterfaceOrientations 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | UIViewControllerBasedStatusBarAppearance 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/NSDate+Format.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Format.swift 3 | // Triangle 4 | // 5 | // Created by Phil on 15/3/30. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension NSDate { 12 | private func dateStringWithFormat(format: String) -> String { 13 | let formatter = NSDateFormatter() 14 | formatter.dateFormat = format 15 | return formatter.stringFromDate(self) 16 | } 17 | 18 | func fullDateString() -> String { 19 | return self.dateStringWithFormat("yyyy/MM/dd") 20 | } 21 | 22 | func shortDateString() -> String { 23 | return self.dateStringWithFormat("M月d日") 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/NSLayoutConstraint+Separator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+Separator.swift 3 | // Triangle 4 | // 5 | // Created by Phil on 15/3/21. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension NSLayoutConstraint { 12 | func setAsSeparator() { 13 | self.constant = 1.0 / UIScreen.mainScreen().scale 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/TRCircleAvatarView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRCircleAvatarView.swift 3 | // Triangle 4 | // 5 | // Created by Phil on 15/3/21. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TRCircleAvatarView: UIView { 12 | lazy var imageView: UIImageView = { 13 | let imageView = UIImageView(frame: self.bounds.rectByInsetting(dx: self.borderWidth, dy: self.borderWidth)) 14 | imageView.layer.cornerRadius = imageView.bounds.width / 2.0 15 | imageView.layer.masksToBounds = true 16 | return imageView 17 | }() 18 | 19 | lazy var borderLayer: CAShapeLayer = { 20 | let borderLayer = CAShapeLayer() 21 | borderLayer.path = UIBezierPath(ovalInRect: self.bounds).CGPath 22 | return borderLayer 23 | }() 24 | 25 | lazy var maskLayer: CAShapeLayer = { 26 | let maskLayer = CAShapeLayer() 27 | maskLayer.path = UIBezierPath(ovalInRect: self.imageView.bounds).CGPath 28 | maskLayer.fillColor = UIColor.blackColor().colorWithAlphaComponent(0.4).CGColor 29 | maskLayer.hidden = true 30 | return maskLayer 31 | }() 32 | 33 | var avatarTappedCallback: (() -> Void)? 34 | 35 | var highlighted: Bool = false { 36 | didSet { 37 | self.maskLayer.hidden = !highlighted 38 | } 39 | } 40 | 41 | @IBInspectable var borderLineWidth: CGFloat = 0 { 42 | didSet { 43 | self.borderLayer.lineWidth = borderLineWidth 44 | } 45 | } 46 | 47 | @IBInspectable var borderLineColor: UIColor = UIColor.clearColor() { 48 | didSet { 49 | self.borderLayer.strokeColor = borderLineColor.CGColor 50 | } 51 | } 52 | 53 | @IBInspectable var borderWidth: CGFloat = 2 { 54 | didSet { 55 | self.imageView.frame = self.bounds.rectByInsetting(dx: borderWidth, dy: borderWidth) 56 | self.imageView.layer.cornerRadius = imageView.bounds.width / 2.0 57 | } 58 | } 59 | 60 | @IBInspectable var borderColor: UIColor = UIColor.whiteColor() { 61 | didSet { 62 | self.borderLayer.fillColor = borderColor.CGColor 63 | } 64 | } 65 | 66 | @IBInspectable var image: UIImage? { 67 | didSet { 68 | self.imageView.image = image 69 | } 70 | } 71 | 72 | required init(coder aDecoder: NSCoder) { 73 | super.init(coder: aDecoder) 74 | self.backgroundColor = UIColor.clearColor() 75 | self.layer.insertSublayer(self.borderLayer, atIndex: 0) 76 | self.imageView.layer.addSublayer(self.maskLayer) 77 | self.addSubview(self.imageView) 78 | 79 | let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: Selector("avatarTapped:")) 80 | tapGestureRecognizer.delaysTouchesEnded = false 81 | self.addGestureRecognizer(tapGestureRecognizer) 82 | } 83 | 84 | func avatarTapped(sender: UITapGestureRecognizer) { 85 | if let callback = self.avatarTappedCallback { 86 | callback() 87 | } 88 | } 89 | 90 | override func touchesBegan(touches: Set, withEvent event: UIEvent) { 91 | self.highlighted = true 92 | } 93 | 94 | override func touchesEnded(touches: Set, withEvent event: UIEvent) { 95 | self.highlighted = false 96 | } 97 | 98 | override func touchesCancelled(touches: Set!, withEvent event: UIEvent!) { 99 | self.highlighted = false 100 | } 101 | 102 | func whenTapped(callback: () -> Void) { 103 | self.avatarTappedCallback = callback 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/TRProfileHeaderView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRProfileHeaderView.swift 3 | // Triangle 4 | // 5 | // Created by Phil on 15/3/29. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol TRProfileHeaderData { 12 | var nickname: String { get } 13 | var avatarURL: String { get } 14 | var joinedTime: NSDate? { get } 15 | var activeLocation: String? { get } 16 | var statsPostCount: Int { get } 17 | var statsFollowCount: Int { get } 18 | var statsLiveness: Double { get } 19 | } 20 | 21 | @objc protocol TRProfileHeaderDelegate: class { 22 | optional func profileHeaderAvatarTapped() 23 | } 24 | 25 | class TRProfileHeaderView: UIView { 26 | 27 | weak var delegate: TRProfileHeaderDelegate? 28 | 29 | @IBOutlet weak var avatarView: TRCircleAvatarView! 30 | @IBOutlet weak var nameLabel: UILabel! 31 | @IBOutlet weak var subtitleLabel: UILabel! 32 | @IBOutlet weak var supplementaryLabel: UILabel! 33 | @IBOutlet weak var postCountLabel: UILabel! 34 | @IBOutlet weak var followCountLabel: UILabel! 35 | @IBOutlet weak var activityLabel: UILabel! 36 | @IBOutlet var separatorConstraints: [NSLayoutConstraint]! 37 | 38 | override func awakeFromNib() { 39 | separatorConstraints.map { $0.setAsSeparator() } 40 | } 41 | 42 | var entity: TRProfileHeaderData? { 43 | didSet { 44 | self.avatarView.whenTapped { [weak self] in 45 | self?.delegate?.profileHeaderAvatarTapped?() 46 | return // fuck xcode 6.2 bug 47 | } 48 | 49 | self.nameLabel.text = entity!.nickname 50 | 51 | if let joinedTime = entity?.joinedTime { 52 | let formatter = NSDateFormatter() 53 | formatter.dateFormat = "yyyy 年 MM 月 dd 日" 54 | self.subtitleLabel.text = "\(formatter.stringFromDate(joinedTime))加入" 55 | } 56 | 57 | if let activeLocation = entity?.activeLocation { 58 | self.supplementaryLabel.text = "最近活跃于:\(activeLocation)" 59 | } 60 | 61 | self.postCountLabel.text = "\(entity!.statsPostCount)" 62 | self.followCountLabel.text = "\(entity!.statsFollowCount)" 63 | self.activityLabel.text = "\(Int(entity!.statsLiveness * 100 % 100))%" 64 | } 65 | } 66 | } 67 | 68 | extension TRProfileHeaderView { 69 | class func viewFromNib() -> TRProfileHeaderView? { 70 | let views = UINib(nibName: "TRProfileHeaderView", bundle: nil).instantiateWithOwner(nil, options: nil) 71 | for view in views { 72 | if view.isKindOfClass(self) { 73 | return view as? TRProfileHeaderView 74 | } 75 | } 76 | return nil 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/TRProfileHeaderView.xib: -------------------------------------------------------------------------------- 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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 53 | 61 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 81 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 105 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 129 | 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 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/UIColor+Hex.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+Hex.swift 3 | // Triangle 4 | // 5 | // Created by Phil on 15/3/21. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIColor { 12 | convenience init(hex: UInt32) { 13 | let red = CGFloat((hex & 0xFF0000) >> 16)/256.0 14 | let green = CGFloat((hex & 0xFF00) >> 8)/256.0 15 | let blue = CGFloat(hex & 0xFF)/256.0 16 | 17 | self.init(red:red, green:green, blue:blue, alpha:1.0) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/UIScrollView+ParallaxHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+APParallaxHeader.h 3 | // 4 | // Created by Mathias Amnell on 2013-04-12. 5 | // Copyright (c) 2013 Apping AB. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @class APParallaxView; 11 | @class APParallaxShadowView; 12 | 13 | #pragma mark UIScrollView Category 14 | 15 | @interface UIScrollView (APParallaxHeader) 16 | 17 | - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShadow:(BOOL)shadow; 18 | - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height; 19 | - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height; 20 | - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andShadow:(BOOL)shadow; 21 | 22 | @property (nonatomic, strong, readonly) APParallaxView *parallaxView; 23 | @property (nonatomic, assign) BOOL showsParallax; 24 | 25 | @end 26 | 27 | #pragma mark APParallaxView 28 | 29 | @protocol APParallaxViewDelegate; 30 | 31 | typedef NS_ENUM(NSUInteger, APParallaxTrackingState) { 32 | APParallaxTrackingActive = 0, 33 | APParallaxTrackingInactive 34 | }; 35 | 36 | @interface APParallaxView : UIView 37 | 38 | @property (weak) id delegate; 39 | 40 | @property (nonatomic, readonly) APParallaxTrackingState state; 41 | @property (nonatomic, strong) UIImageView *imageView; 42 | @property (nonatomic, strong) UIView *currentSubView; 43 | @property (nonatomic, strong) APParallaxShadowView *shadowView; 44 | 45 | - (id)initWithFrame:(CGRect)frame andShadow:(BOOL)shadow; 46 | 47 | @end 48 | 49 | @protocol APParallaxViewDelegate 50 | @optional 51 | - (void)parallaxView:(APParallaxView *)view willChangeFrame:(CGRect)frame; 52 | - (void)parallaxView:(APParallaxView *)view didChangeFrame:(CGRect)frame; 53 | @end 54 | 55 | #pragma mark APParallaxShadowView 56 | 57 | @interface APParallaxShadowView : UIView 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/UIScrollView+ParallaxHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIScrollView+APParallaxHeader.m 3 | // 4 | // Created by Mathias Amnell on 2013-04-12. 5 | // Copyright (c) 2013 Apping AB. All rights reserved. 6 | // 7 | 8 | #import "UIScrollView+ParallaxHeader.h" 9 | 10 | #import 11 | 12 | @interface APParallaxView () 13 | 14 | @property (nonatomic, readwrite) APParallaxTrackingState state; 15 | 16 | @property (nonatomic, weak) UIScrollView *scrollView; 17 | @property (nonatomic, readwrite) CGFloat originalTopInset; 18 | @property (nonatomic) CGFloat parallaxHeight; 19 | 20 | @property(nonatomic, assign) BOOL isObserving; 21 | 22 | @end 23 | 24 | 25 | 26 | #pragma mark - UIScrollView (APParallaxHeader) 27 | #import 28 | 29 | static char UIScrollViewParallaxView; 30 | 31 | @implementation UIScrollView (APParallaxHeader) 32 | 33 | - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height { 34 | [self addParallaxWithImage:image andHeight:height andShadow:YES]; 35 | } 36 | 37 | - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShadow:(BOOL)shadow { 38 | if(self.parallaxView) { 39 | if(self.parallaxView.currentSubView) { 40 | [self.parallaxView.currentSubView removeFromSuperview]; 41 | } 42 | [self.parallaxView.imageView setImage:image]; 43 | } 44 | else 45 | { 46 | APParallaxView *view = [[APParallaxView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, height) andShadow:shadow]; 47 | [view setClipsToBounds:YES]; 48 | [view.imageView setImage:image]; 49 | 50 | view.scrollView = self; 51 | view.parallaxHeight = height; 52 | [self addSubview:view]; 53 | 54 | view.originalTopInset = self.contentInset.top; 55 | 56 | UIEdgeInsets newInset = self.contentInset; 57 | newInset.top = height; 58 | self.contentInset = newInset; 59 | 60 | self.parallaxView = view; 61 | self.showsParallax = YES; 62 | } 63 | } 64 | 65 | - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height { 66 | [self addParallaxWithView:view andHeight:height andShadow:YES]; 67 | } 68 | 69 | - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andShadow:(BOOL)shadow { 70 | if(self.parallaxView) { 71 | [self.parallaxView.currentSubView removeFromSuperview]; 72 | [view setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; 73 | [self.parallaxView addSubview:view]; 74 | } 75 | else 76 | { 77 | APParallaxView *parallaxView = [[APParallaxView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, height) andShadow:shadow]; 78 | [parallaxView setClipsToBounds:YES]; 79 | [view setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; 80 | [parallaxView insertSubview:view atIndex:0]; 81 | 82 | parallaxView.scrollView = self; 83 | parallaxView.parallaxHeight = height; 84 | [self addSubview:parallaxView]; 85 | 86 | parallaxView.originalTopInset = self.contentInset.top; 87 | 88 | UIEdgeInsets newInset = self.contentInset; 89 | newInset.top = height; 90 | self.contentInset = newInset; 91 | 92 | self.parallaxView = parallaxView; 93 | self.showsParallax = YES; 94 | } 95 | } 96 | 97 | - (void)setParallaxView:(APParallaxView *)parallaxView { 98 | objc_setAssociatedObject(self, &UIScrollViewParallaxView, 99 | parallaxView, 100 | OBJC_ASSOCIATION_ASSIGN); 101 | } 102 | 103 | - (APParallaxView *)parallaxView { 104 | return objc_getAssociatedObject(self, &UIScrollViewParallaxView); 105 | } 106 | 107 | - (void)setShowsParallax:(BOOL)showsParallax { 108 | self.parallaxView.hidden = !showsParallax; 109 | 110 | if(!showsParallax) { 111 | if (self.parallaxView.isObserving) { 112 | [self removeObserver:self.parallaxView forKeyPath:@"contentOffset"]; 113 | [self removeObserver:self.parallaxView forKeyPath:@"frame"]; 114 | self.parallaxView.isObserving = NO; 115 | } 116 | } 117 | else { 118 | if (!self.parallaxView.isObserving) { 119 | [self addObserver:self.parallaxView forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil]; 120 | [self addObserver:self.parallaxView forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:nil]; 121 | self.parallaxView.isObserving = YES; 122 | } 123 | } 124 | } 125 | 126 | - (BOOL)showsParallax { 127 | return !self.parallaxView.hidden; 128 | } 129 | 130 | @end 131 | 132 | #pragma mark - ShadowLayer 133 | 134 | @implementation APParallaxShadowView 135 | 136 | - (id)initWithFrame:(CGRect)frame { 137 | self = [super initWithFrame:frame]; 138 | if (self) { 139 | [self setOpaque:NO]; 140 | } 141 | return self; 142 | } 143 | 144 | - (void)drawRect:(CGRect)rect { 145 | [super drawRect:rect]; 146 | 147 | //// General Declarations 148 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 149 | CGContextRef context = UIGraphicsGetCurrentContext(); 150 | 151 | 152 | //// Gradient Declarations 153 | NSArray* gradient3Colors = [NSArray arrayWithObjects: 154 | (id)[UIColor colorWithWhite:0 alpha:0.3].CGColor, 155 | (id)[UIColor clearColor].CGColor, nil]; 156 | CGFloat gradient3Locations[] = {0, 1}; 157 | CGGradientRef gradient3 = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)gradient3Colors, gradient3Locations); 158 | 159 | //// Rectangle Drawing 160 | UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRect: CGRectMake(0, 0, CGRectGetWidth(rect), 8)]; 161 | CGContextSaveGState(context); 162 | [rectanglePath addClip]; 163 | CGContextDrawLinearGradient(context, gradient3, CGPointMake(0, CGRectGetHeight(rect)), CGPointMake(0, 0), 0); 164 | CGContextRestoreGState(context); 165 | 166 | 167 | //// Cleanup 168 | CGGradientRelease(gradient3); 169 | CGColorSpaceRelease(colorSpace); 170 | 171 | } 172 | 173 | @end 174 | 175 | #pragma mark - APParallaxView 176 | 177 | @implementation APParallaxView 178 | 179 | - (id)initWithFrame:(CGRect)frame { 180 | self = [self initWithFrame:frame andShadow:YES]; 181 | if (self) { 182 | 183 | } 184 | return self; 185 | } 186 | 187 | - (id)initWithFrame:(CGRect)frame andShadow:(BOOL)shadow { 188 | if(self = [super initWithFrame:frame]) { 189 | 190 | // default styling values 191 | [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; 192 | [self setState:APParallaxTrackingActive]; 193 | [self setAutoresizesSubviews:YES]; 194 | 195 | self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame))]; 196 | [self.imageView setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; 197 | [self.imageView setContentMode:UIViewContentModeScaleAspectFill]; 198 | [self.imageView setClipsToBounds:YES]; 199 | [self addSubview:self.imageView]; 200 | 201 | if (shadow) { 202 | self.shadowView = [[APParallaxShadowView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(frame)-8, CGRectGetWidth(frame), 8)]; 203 | [self.shadowView setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin]; 204 | [self addSubview:self.shadowView]; 205 | } 206 | } 207 | 208 | return self; 209 | } 210 | 211 | - (void)willMoveToSuperview:(UIView *)newSuperview { 212 | if (self.superview && newSuperview == nil) { 213 | UIScrollView *scrollView = (UIScrollView *)self.superview; 214 | if (scrollView.showsParallax) { 215 | if (self.isObserving) { 216 | //If enter this branch, it is the moment just before "APParallaxView's dealloc", so remove observer here 217 | [scrollView removeObserver:self forKeyPath:@"contentOffset"]; 218 | [scrollView removeObserver:self forKeyPath:@"frame"]; 219 | self.isObserving = NO; 220 | } 221 | } 222 | } 223 | } 224 | 225 | - (void)addSubview:(UIView *)view { 226 | [super addSubview:view]; 227 | self.currentSubView = view; 228 | } 229 | 230 | #pragma mark - Observing 231 | 232 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 233 | if([keyPath isEqualToString:@"contentOffset"]) 234 | [self scrollViewDidScroll:[[change valueForKey:NSKeyValueChangeNewKey] CGPointValue]]; 235 | else if([keyPath isEqualToString:@"frame"]) 236 | [self layoutSubviews]; 237 | } 238 | 239 | - (void)scrollViewDidScroll:(CGPoint)contentOffset { 240 | // We do not want to track when the parallax view is hidden 241 | if (contentOffset.y > 0) { 242 | [self setState:APParallaxTrackingInactive]; 243 | } else { 244 | [self setState:APParallaxTrackingActive]; 245 | } 246 | 247 | if(self.state == APParallaxTrackingActive) { 248 | CGFloat yOffset = contentOffset.y*-1; 249 | if ([self.delegate respondsToSelector:@selector(parallaxView:willChangeFrame:)]) { 250 | [self.delegate parallaxView:self willChangeFrame:self.frame]; 251 | } 252 | 253 | [self setFrame:CGRectMake(0, contentOffset.y, CGRectGetWidth(self.frame), yOffset)]; 254 | 255 | if ([self.delegate respondsToSelector:@selector(parallaxView:didChangeFrame:)]) { 256 | [self.delegate parallaxView:self didChangeFrame:self.frame]; 257 | } 258 | } 259 | } 260 | 261 | @end 262 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/UITableView+ContentTouches.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView+ContentTouches.swift 3 | // Triangle 4 | // 5 | // Created by Phil on 15/3/22. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UITableView { 12 | // avoid tableview delaying touch began event of cell *subviews*. 13 | func optimizeForContentTouches() { 14 | for view: AnyObject in self.subviews { 15 | if NSStringFromClass(view.dynamicType) == "UITableViewWrapperView" { 16 | // hack for swift arbitrary message send. 17 | NSTimer.scheduledTimerWithTimeInterval(0, target: view, selector: Selector("setDelaysContentTouches:"), userInfo: false, repeats: false) 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AutoLayoutShowcase/UIView+SpringAnimations.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SpringAnimations.swift 3 | // AutoLayoutShowcase 4 | // 5 | // Created by Phil on 15/4/2. 6 | // Copyright (c) 2015年 Phil. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | class func animateDefaultSpringAnimation(animation: () -> Void) { 13 | UIView.animateWithDuration(0.25, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 1, options: .allZeros, animations: animation, completion: nil) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Resources/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/avatar.png -------------------------------------------------------------------------------- /Resources/bear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/bear.png -------------------------------------------------------------------------------- /Resources/dynamic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/dynamic1.png -------------------------------------------------------------------------------- /Resources/header_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/header_bg.png -------------------------------------------------------------------------------- /Resources/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/icon1.png -------------------------------------------------------------------------------- /Resources/marks_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/marks_1.png -------------------------------------------------------------------------------- /Resources/parallax1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/parallax1.png -------------------------------------------------------------------------------- /Resources/scale1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philcn/Auto-Layout-Showcase/05aea6758de9ca1ec3063d7e87cb06a4a339824a/Resources/scale1.png --------------------------------------------------------------------------------