├── .gitignore ├── AutoLayoutSplitView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── AutoLayoutSplitView.xcscheme ├── AutoLayoutSplitView ├── AppDelegate.h ├── AppDelegate.m ├── AutoLayoutSplitView-Info.plist ├── AutoLayoutSplitView-Prefix.pch ├── Base.lproj │ └── MainMenu.xib ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── butterfly.jpg ├── en.lproj │ ├── Credits.rtf │ └── InfoPlist.strings └── main.m ├── AutoLayoutSplitViewTests ├── AutoLayoutSplitViewTests-Info.plist ├── AutoLayoutSplitViewTests.m └── en.lproj │ └── InfoPlist.strings └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | #CocoaPods 21 | Pods 22 | -------------------------------------------------------------------------------- /AutoLayoutSplitView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A67E6DAE1872397B00CD86D2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A67E6DAD1872397B00CD86D2 /* Cocoa.framework */; }; 11 | A67E6DB81872397B00CD86D2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A67E6DB61872397B00CD86D2 /* InfoPlist.strings */; }; 12 | A67E6DBA1872397B00CD86D2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A67E6DB91872397B00CD86D2 /* main.m */; }; 13 | A67E6DBE1872397B00CD86D2 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = A67E6DBC1872397B00CD86D2 /* Credits.rtf */; }; 14 | A67E6DC11872397B00CD86D2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A67E6DC01872397B00CD86D2 /* AppDelegate.m */; }; 15 | A67E6DC41872397B00CD86D2 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = A67E6DC21872397B00CD86D2 /* MainMenu.xib */; }; 16 | A67E6DC61872397B00CD86D2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A67E6DC51872397B00CD86D2 /* Images.xcassets */; }; 17 | A67E6DCD1872397B00CD86D2 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A67E6DCC1872397B00CD86D2 /* XCTest.framework */; }; 18 | A67E6DCE1872397B00CD86D2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A67E6DAD1872397B00CD86D2 /* Cocoa.framework */; }; 19 | A67E6DD61872397B00CD86D2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A67E6DD41872397B00CD86D2 /* InfoPlist.strings */; }; 20 | A67E6DD81872397B00CD86D2 /* AutoLayoutSplitViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A67E6DD71872397B00CD86D2 /* AutoLayoutSplitViewTests.m */; }; 21 | A67E6DE418727F1200CD86D2 /* butterfly.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A67E6DE318727F1200CD86D2 /* butterfly.jpg */; }; 22 | A6C390B421F57A7200D8532F /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6C390B221F57A7100D8532F /* Quartz.framework */; }; 23 | A6C390B521F57A7200D8532F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6C390B321F57A7200D8532F /* QuartzCore.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | A67E6DCF1872397B00CD86D2 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = A67E6DA21872397B00CD86D2 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = A67E6DA91872397B00CD86D2; 32 | remoteInfo = AutoLayoutSplitView; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | A67E6DAA1872397B00CD86D2 /* AutoLayoutSplitView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AutoLayoutSplitView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | A67E6DAD1872397B00CD86D2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 39 | A67E6DB01872397B00CD86D2 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 40 | A67E6DB11872397B00CD86D2 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 41 | A67E6DB21872397B00CD86D2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 42 | A67E6DB51872397B00CD86D2 /* AutoLayoutSplitView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AutoLayoutSplitView-Info.plist"; sourceTree = ""; }; 43 | A67E6DB71872397B00CD86D2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 44 | A67E6DB91872397B00CD86D2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | A67E6DBB1872397B00CD86D2 /* AutoLayoutSplitView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AutoLayoutSplitView-Prefix.pch"; sourceTree = ""; }; 46 | A67E6DBD1872397B00CD86D2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 47 | A67E6DBF1872397B00CD86D2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | A67E6DC01872397B00CD86D2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | A67E6DC31872397B00CD86D2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 50 | A67E6DC51872397B00CD86D2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 51 | A67E6DCB1872397B00CD86D2 /* AutoLayoutSplitViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AutoLayoutSplitViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | A67E6DCC1872397B00CD86D2 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 53 | A67E6DD31872397B00CD86D2 /* AutoLayoutSplitViewTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AutoLayoutSplitViewTests-Info.plist"; sourceTree = ""; }; 54 | A67E6DD51872397B00CD86D2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 55 | A67E6DD71872397B00CD86D2 /* AutoLayoutSplitViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AutoLayoutSplitViewTests.m; sourceTree = ""; }; 56 | A67E6DE318727F1200CD86D2 /* butterfly.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = butterfly.jpg; sourceTree = ""; }; 57 | A6C390B221F57A7100D8532F /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; 58 | A6C390B321F57A7200D8532F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | A67E6DA71872397B00CD86D2 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | A6C390B421F57A7200D8532F /* Quartz.framework in Frameworks */, 67 | A6C390B521F57A7200D8532F /* QuartzCore.framework in Frameworks */, 68 | A67E6DAE1872397B00CD86D2 /* Cocoa.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | A67E6DC81872397B00CD86D2 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | A67E6DCE1872397B00CD86D2 /* Cocoa.framework in Frameworks */, 77 | A67E6DCD1872397B00CD86D2 /* XCTest.framework in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | A67E6DA11872397B00CD86D2 = { 85 | isa = PBXGroup; 86 | children = ( 87 | A67E6DB31872397B00CD86D2 /* AutoLayoutSplitView */, 88 | A67E6DD11872397B00CD86D2 /* AutoLayoutSplitViewTests */, 89 | A67E6DAC1872397B00CD86D2 /* Frameworks */, 90 | A67E6DAB1872397B00CD86D2 /* Products */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | A67E6DAB1872397B00CD86D2 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | A67E6DAA1872397B00CD86D2 /* AutoLayoutSplitView.app */, 98 | A67E6DCB1872397B00CD86D2 /* AutoLayoutSplitViewTests.xctest */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | A67E6DAC1872397B00CD86D2 /* Frameworks */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | A6C390B221F57A7100D8532F /* Quartz.framework */, 107 | A6C390B321F57A7200D8532F /* QuartzCore.framework */, 108 | A67E6DAD1872397B00CD86D2 /* Cocoa.framework */, 109 | A67E6DCC1872397B00CD86D2 /* XCTest.framework */, 110 | A67E6DAF1872397B00CD86D2 /* Other Frameworks */, 111 | ); 112 | name = Frameworks; 113 | sourceTree = ""; 114 | }; 115 | A67E6DAF1872397B00CD86D2 /* Other Frameworks */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | A67E6DB01872397B00CD86D2 /* AppKit.framework */, 119 | A67E6DB11872397B00CD86D2 /* CoreData.framework */, 120 | A67E6DB21872397B00CD86D2 /* Foundation.framework */, 121 | ); 122 | name = "Other Frameworks"; 123 | sourceTree = ""; 124 | }; 125 | A67E6DB31872397B00CD86D2 /* AutoLayoutSplitView */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | A67E6DBF1872397B00CD86D2 /* AppDelegate.h */, 129 | A67E6DC01872397B00CD86D2 /* AppDelegate.m */, 130 | A67E6DC21872397B00CD86D2 /* MainMenu.xib */, 131 | A67E6DC51872397B00CD86D2 /* Images.xcassets */, 132 | A67E6DE318727F1200CD86D2 /* butterfly.jpg */, 133 | A67E6DB41872397B00CD86D2 /* Supporting Files */, 134 | ); 135 | path = AutoLayoutSplitView; 136 | sourceTree = ""; 137 | }; 138 | A67E6DB41872397B00CD86D2 /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | A67E6DB51872397B00CD86D2 /* AutoLayoutSplitView-Info.plist */, 142 | A67E6DB61872397B00CD86D2 /* InfoPlist.strings */, 143 | A67E6DB91872397B00CD86D2 /* main.m */, 144 | A67E6DBB1872397B00CD86D2 /* AutoLayoutSplitView-Prefix.pch */, 145 | A67E6DBC1872397B00CD86D2 /* Credits.rtf */, 146 | ); 147 | name = "Supporting Files"; 148 | sourceTree = ""; 149 | }; 150 | A67E6DD11872397B00CD86D2 /* AutoLayoutSplitViewTests */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | A67E6DD71872397B00CD86D2 /* AutoLayoutSplitViewTests.m */, 154 | A67E6DD21872397B00CD86D2 /* Supporting Files */, 155 | ); 156 | path = AutoLayoutSplitViewTests; 157 | sourceTree = ""; 158 | }; 159 | A67E6DD21872397B00CD86D2 /* Supporting Files */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | A67E6DD31872397B00CD86D2 /* AutoLayoutSplitViewTests-Info.plist */, 163 | A67E6DD41872397B00CD86D2 /* InfoPlist.strings */, 164 | ); 165 | name = "Supporting Files"; 166 | sourceTree = ""; 167 | }; 168 | /* End PBXGroup section */ 169 | 170 | /* Begin PBXNativeTarget section */ 171 | A67E6DA91872397B00CD86D2 /* AutoLayoutSplitView */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = A67E6DDB1872397B00CD86D2 /* Build configuration list for PBXNativeTarget "AutoLayoutSplitView" */; 174 | buildPhases = ( 175 | A67E6DA61872397B00CD86D2 /* Sources */, 176 | A67E6DA71872397B00CD86D2 /* Frameworks */, 177 | A67E6DA81872397B00CD86D2 /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | ); 183 | name = AutoLayoutSplitView; 184 | productName = AutoLayoutSplitView; 185 | productReference = A67E6DAA1872397B00CD86D2 /* AutoLayoutSplitView.app */; 186 | productType = "com.apple.product-type.application"; 187 | }; 188 | A67E6DCA1872397B00CD86D2 /* AutoLayoutSplitViewTests */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = A67E6DDE1872397B00CD86D2 /* Build configuration list for PBXNativeTarget "AutoLayoutSplitViewTests" */; 191 | buildPhases = ( 192 | A67E6DC71872397B00CD86D2 /* Sources */, 193 | A67E6DC81872397B00CD86D2 /* Frameworks */, 194 | A67E6DC91872397B00CD86D2 /* Resources */, 195 | ); 196 | buildRules = ( 197 | ); 198 | dependencies = ( 199 | A67E6DD01872397B00CD86D2 /* PBXTargetDependency */, 200 | ); 201 | name = AutoLayoutSplitViewTests; 202 | productName = AutoLayoutSplitViewTests; 203 | productReference = A67E6DCB1872397B00CD86D2 /* AutoLayoutSplitViewTests.xctest */; 204 | productType = "com.apple.product-type.bundle.unit-test"; 205 | }; 206 | /* End PBXNativeTarget section */ 207 | 208 | /* Begin PBXProject section */ 209 | A67E6DA21872397B00CD86D2 /* Project object */ = { 210 | isa = PBXProject; 211 | attributes = { 212 | LastUpgradeCheck = 0500; 213 | ORGANIZATIONNAME = "Demitri Muna"; 214 | TargetAttributes = { 215 | A67E6DCA1872397B00CD86D2 = { 216 | TestTargetID = A67E6DA91872397B00CD86D2; 217 | }; 218 | }; 219 | }; 220 | buildConfigurationList = A67E6DA51872397B00CD86D2 /* Build configuration list for PBXProject "AutoLayoutSplitView" */; 221 | compatibilityVersion = "Xcode 3.2"; 222 | developmentRegion = English; 223 | hasScannedForEncodings = 0; 224 | knownRegions = ( 225 | en, 226 | Base, 227 | ); 228 | mainGroup = A67E6DA11872397B00CD86D2; 229 | productRefGroup = A67E6DAB1872397B00CD86D2 /* Products */; 230 | projectDirPath = ""; 231 | projectRoot = ""; 232 | targets = ( 233 | A67E6DA91872397B00CD86D2 /* AutoLayoutSplitView */, 234 | A67E6DCA1872397B00CD86D2 /* AutoLayoutSplitViewTests */, 235 | ); 236 | }; 237 | /* End PBXProject section */ 238 | 239 | /* Begin PBXResourcesBuildPhase section */ 240 | A67E6DA81872397B00CD86D2 /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | A67E6DB81872397B00CD86D2 /* InfoPlist.strings in Resources */, 245 | A67E6DE418727F1200CD86D2 /* butterfly.jpg in Resources */, 246 | A67E6DC61872397B00CD86D2 /* Images.xcassets in Resources */, 247 | A67E6DBE1872397B00CD86D2 /* Credits.rtf in Resources */, 248 | A67E6DC41872397B00CD86D2 /* MainMenu.xib in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | A67E6DC91872397B00CD86D2 /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | A67E6DD61872397B00CD86D2 /* InfoPlist.strings in Resources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | /* End PBXResourcesBuildPhase section */ 261 | 262 | /* Begin PBXSourcesBuildPhase section */ 263 | A67E6DA61872397B00CD86D2 /* Sources */ = { 264 | isa = PBXSourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | A67E6DC11872397B00CD86D2 /* AppDelegate.m in Sources */, 268 | A67E6DBA1872397B00CD86D2 /* main.m in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | A67E6DC71872397B00CD86D2 /* Sources */ = { 273 | isa = PBXSourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | A67E6DD81872397B00CD86D2 /* AutoLayoutSplitViewTests.m in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | /* End PBXSourcesBuildPhase section */ 281 | 282 | /* Begin PBXTargetDependency section */ 283 | A67E6DD01872397B00CD86D2 /* PBXTargetDependency */ = { 284 | isa = PBXTargetDependency; 285 | target = A67E6DA91872397B00CD86D2 /* AutoLayoutSplitView */; 286 | targetProxy = A67E6DCF1872397B00CD86D2 /* PBXContainerItemProxy */; 287 | }; 288 | /* End PBXTargetDependency section */ 289 | 290 | /* Begin PBXVariantGroup section */ 291 | A67E6DB61872397B00CD86D2 /* InfoPlist.strings */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | A67E6DB71872397B00CD86D2 /* en */, 295 | ); 296 | name = InfoPlist.strings; 297 | sourceTree = ""; 298 | }; 299 | A67E6DBC1872397B00CD86D2 /* Credits.rtf */ = { 300 | isa = PBXVariantGroup; 301 | children = ( 302 | A67E6DBD1872397B00CD86D2 /* en */, 303 | ); 304 | name = Credits.rtf; 305 | sourceTree = ""; 306 | }; 307 | A67E6DC21872397B00CD86D2 /* MainMenu.xib */ = { 308 | isa = PBXVariantGroup; 309 | children = ( 310 | A67E6DC31872397B00CD86D2 /* Base */, 311 | ); 312 | name = MainMenu.xib; 313 | sourceTree = ""; 314 | }; 315 | A67E6DD41872397B00CD86D2 /* InfoPlist.strings */ = { 316 | isa = PBXVariantGroup; 317 | children = ( 318 | A67E6DD51872397B00CD86D2 /* en */, 319 | ); 320 | name = InfoPlist.strings; 321 | sourceTree = ""; 322 | }; 323 | /* End PBXVariantGroup section */ 324 | 325 | /* Begin XCBuildConfiguration section */ 326 | A67E6DD91872397B00CD86D2 /* Debug */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BOOL_CONVERSION = YES; 334 | CLANG_WARN_CONSTANT_CONVERSION = YES; 335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 336 | CLANG_WARN_EMPTY_BODY = YES; 337 | CLANG_WARN_ENUM_CONVERSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | COPY_PHASE_STRIP = NO; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_DYNAMIC_NO_PIC = NO; 344 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 345 | GCC_OPTIMIZATION_LEVEL = 0; 346 | GCC_PREPROCESSOR_DEFINITIONS = ( 347 | "DEBUG=1", 348 | "$(inherited)", 349 | ); 350 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | MACOSX_DEPLOYMENT_TARGET = 10.9; 358 | ONLY_ACTIVE_ARCH = YES; 359 | OTHER_CFLAGS = "-DDLOG_DEBUG=1"; 360 | SDKROOT = macosx; 361 | }; 362 | name = Debug; 363 | }; 364 | A67E6DDA1872397B00CD86D2 /* Release */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_SEARCH_USER_PATHS = NO; 368 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 369 | CLANG_CXX_LIBRARY = "libc++"; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 374 | CLANG_WARN_EMPTY_BODY = YES; 375 | CLANG_WARN_ENUM_CONVERSION = YES; 376 | CLANG_WARN_INT_CONVERSION = YES; 377 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 378 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 379 | COPY_PHASE_STRIP = YES; 380 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 381 | ENABLE_NS_ASSERTIONS = NO; 382 | GCC_C_LANGUAGE_STANDARD = gnu99; 383 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 384 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 385 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 386 | GCC_WARN_UNDECLARED_SELECTOR = YES; 387 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 388 | GCC_WARN_UNUSED_FUNCTION = YES; 389 | GCC_WARN_UNUSED_VARIABLE = YES; 390 | MACOSX_DEPLOYMENT_TARGET = 10.9; 391 | SDKROOT = macosx; 392 | }; 393 | name = Release; 394 | }; 395 | A67E6DDC1872397B00CD86D2 /* Debug */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 399 | COMBINE_HIDPI_IMAGES = YES; 400 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 401 | GCC_PREFIX_HEADER = "AutoLayoutSplitView/AutoLayoutSplitView-Prefix.pch"; 402 | INFOPLIST_FILE = "AutoLayoutSplitView/AutoLayoutSplitView-Info.plist"; 403 | MACOSX_DEPLOYMENT_TARGET = 10.7; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | WRAPPER_EXTENSION = app; 406 | }; 407 | name = Debug; 408 | }; 409 | A67E6DDD1872397B00CD86D2 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | COMBINE_HIDPI_IMAGES = YES; 414 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 415 | GCC_PREFIX_HEADER = "AutoLayoutSplitView/AutoLayoutSplitView-Prefix.pch"; 416 | INFOPLIST_FILE = "AutoLayoutSplitView/AutoLayoutSplitView-Info.plist"; 417 | MACOSX_DEPLOYMENT_TARGET = 10.7; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | WRAPPER_EXTENSION = app; 420 | }; 421 | name = Release; 422 | }; 423 | A67E6DDF1872397B00CD86D2 /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AutoLayoutSplitView.app/Contents/MacOS/AutoLayoutSplitView"; 427 | COMBINE_HIDPI_IMAGES = YES; 428 | FRAMEWORK_SEARCH_PATHS = ( 429 | "$(DEVELOPER_FRAMEWORKS_DIR)", 430 | "$(inherited)", 431 | ); 432 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 433 | GCC_PREFIX_HEADER = "AutoLayoutSplitView/AutoLayoutSplitView-Prefix.pch"; 434 | GCC_PREPROCESSOR_DEFINITIONS = ( 435 | "DEBUG=1", 436 | "$(inherited)", 437 | ); 438 | INFOPLIST_FILE = "AutoLayoutSplitViewTests/AutoLayoutSplitViewTests-Info.plist"; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | TEST_HOST = "$(BUNDLE_LOADER)"; 441 | WRAPPER_EXTENSION = xctest; 442 | }; 443 | name = Debug; 444 | }; 445 | A67E6DE01872397B00CD86D2 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AutoLayoutSplitView.app/Contents/MacOS/AutoLayoutSplitView"; 449 | COMBINE_HIDPI_IMAGES = YES; 450 | FRAMEWORK_SEARCH_PATHS = ( 451 | "$(DEVELOPER_FRAMEWORKS_DIR)", 452 | "$(inherited)", 453 | ); 454 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 455 | GCC_PREFIX_HEADER = "AutoLayoutSplitView/AutoLayoutSplitView-Prefix.pch"; 456 | INFOPLIST_FILE = "AutoLayoutSplitViewTests/AutoLayoutSplitViewTests-Info.plist"; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | TEST_HOST = "$(BUNDLE_LOADER)"; 459 | WRAPPER_EXTENSION = xctest; 460 | }; 461 | name = Release; 462 | }; 463 | /* End XCBuildConfiguration section */ 464 | 465 | /* Begin XCConfigurationList section */ 466 | A67E6DA51872397B00CD86D2 /* Build configuration list for PBXProject "AutoLayoutSplitView" */ = { 467 | isa = XCConfigurationList; 468 | buildConfigurations = ( 469 | A67E6DD91872397B00CD86D2 /* Debug */, 470 | A67E6DDA1872397B00CD86D2 /* Release */, 471 | ); 472 | defaultConfigurationIsVisible = 0; 473 | defaultConfigurationName = Release; 474 | }; 475 | A67E6DDB1872397B00CD86D2 /* Build configuration list for PBXNativeTarget "AutoLayoutSplitView" */ = { 476 | isa = XCConfigurationList; 477 | buildConfigurations = ( 478 | A67E6DDC1872397B00CD86D2 /* Debug */, 479 | A67E6DDD1872397B00CD86D2 /* Release */, 480 | ); 481 | defaultConfigurationIsVisible = 0; 482 | defaultConfigurationName = Release; 483 | }; 484 | A67E6DDE1872397B00CD86D2 /* Build configuration list for PBXNativeTarget "AutoLayoutSplitViewTests" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | A67E6DDF1872397B00CD86D2 /* Debug */, 488 | A67E6DE01872397B00CD86D2 /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | /* End XCConfigurationList section */ 494 | }; 495 | rootObject = A67E6DA21872397B00CD86D2 /* Project object */; 496 | } 497 | -------------------------------------------------------------------------------- /AutoLayoutSplitView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AutoLayoutSplitView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AutoLayoutSplitView.xcodeproj/xcshareddata/xcschemes/AutoLayoutSplitView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 78 | 79 | 80 | 81 | 82 | 83 | 89 | 91 | 97 | 98 | 99 | 100 | 102 | 103 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AutoLayoutSplitView 4 | // 5 | // Created by Demitri Muna on 12/30/13. 6 | // 7 | 8 | #import 9 | 10 | @interface AppDelegate : NSObject 11 | { 12 | NSSize originalSize; // original values 13 | } 14 | 15 | @property (nonatomic, strong) IBOutlet NSWindow *window; 16 | @property (nonatomic, weak) IBOutlet NSSplitView *splitView; 17 | @property (nonatomic, weak) IBOutlet NSView *leftPane; 18 | @property (nonatomic, weak) IBOutlet NSView *middlePane; 19 | @property (nonatomic, weak) IBOutlet NSView *rightPane; 20 | @property (nonatomic, weak) IBOutlet NSSlider *slider; 21 | @property (nonatomic, weak) IBOutlet NSScrollView *scrollView; 22 | 23 | // layout constraints 24 | @property (nonatomic, weak) IBOutlet NSLayoutConstraint *splitViewLeadingConstraint; 25 | @property (nonatomic, weak) IBOutlet NSLayoutConstraint *splitViewTrailingConstraint; 26 | 27 | - (IBAction)toggleLeftPane:(id)sender; 28 | - (IBAction)toggleRightPane:(id)sender; 29 | - (IBAction)loadPhoto:(id)sender; 30 | - (IBAction)sliderAction:(id)sender; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AutoLayoutSplitView 4 | // 5 | // Created by Demitri Muna on 12/30/13. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | @interface AppDelegate () 14 | { 15 | // remember the width of the left pane before being collapsed (optional) 16 | CGFloat _lastLeftPaneWidth; 17 | } 18 | 19 | @end 20 | 21 | @implementation AppDelegate 22 | 23 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 24 | { 25 | 26 | /* 27 | NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; 28 | [nc addObserver:self 29 | selector:@selector(splitViewDidResizeSubviews:) 30 | name:NSSplitViewDidResizeSubviewsNotification 31 | object:self.splitView]; 32 | 33 | [nc addObserver:self 34 | selector:@selector(splitViewWillResizeSubviews:) 35 | name:NSSplitViewWillResizeSubviewsNotification 36 | object:self.splitView]; 37 | */ 38 | } 39 | 40 | - (void)awakeFromNib 41 | { 42 | self.leftPane.translatesAutoresizingMaskIntoConstraints = NO; 43 | self.rightPane.translatesAutoresizingMaskIntoConstraints = NO; 44 | _lastLeftPaneWidth = self.leftPane.frame.size.width; 45 | } 46 | 47 | - (IBAction)loadPhoto:(id)sender 48 | { 49 | // load photo 50 | NSURL *photoURL = [[NSBundle mainBundle] URLForResource:@"butterfly" withExtension:@"jpg"]; 51 | NSImage *image = [[NSImage alloc] initWithContentsOfURL:photoURL]; 52 | 53 | originalSize = image.size; 54 | 55 | NSRect imageRect = NSMakeRect(0, 0, image.size.width, image.size.height); 56 | NSImageView *imageView = [[NSImageView alloc] initWithFrame:imageRect]; 57 | imageView.bounds = imageRect; 58 | imageView.image = image; 59 | 60 | // to pass to the bindings dictionary below - can't use dot notation (?) 61 | NSScrollView *scrollView = self.scrollView; 62 | 63 | scrollView.documentView = imageView; 64 | 65 | [self.middlePane addSubview:scrollView]; 66 | 67 | // turn off autoresizing for scroll view 68 | scrollView.translatesAutoresizingMaskIntoConstraints = NO; 69 | 70 | NSDictionary *views = NSDictionaryOfVariableBindings(scrollView); 71 | [self.middlePane addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|" 72 | options:0 73 | metrics:nil 74 | views:views]]; 75 | [self.middlePane addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView]|" 76 | options:0 77 | metrics:nil 78 | views:views]]; 79 | } 80 | 81 | - (IBAction)toggleLeftPane:(id)sender 82 | { 83 | [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { 84 | context.allowsImplicitAnimation = YES; 85 | context.duration = 0.25; // seconds 86 | context.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 87 | 88 | if ([self.splitView isSubviewCollapsed:self.leftPane]) { 89 | // -> expand 90 | [self.splitView setPosition:_lastLeftPaneWidth ofDividerAtIndex:0]; 91 | } else { 92 | // <- collapse 93 | _lastLeftPaneWidth = self.leftPane.frame.size.width; // remember current width to restore 94 | [self.splitView setPosition:0 ofDividerAtIndex:0]; 95 | } 96 | 97 | [self.splitView layoutSubtreeIfNeeded]; 98 | }]; 99 | } 100 | 101 | - (IBAction)toggleRightPane:(id)sender 102 | { 103 | [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { 104 | context.allowsImplicitAnimation = YES; 105 | context.duration = 0.25; // seconds 106 | context.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 107 | 108 | if ([self.splitView isSubviewCollapsed:self.rightPane]) { 109 | // -> expand 110 | [self.splitView setPosition:NSMaxX(self.splitView.frame) - self.rightPane.frame.size.width ofDividerAtIndex:1]; 111 | } else { 112 | // <- collapse 113 | [self.splitView setPosition:NSMaxX(self.splitView.frame) ofDividerAtIndex:1]; 114 | } 115 | 116 | [self.splitView layoutSubtreeIfNeeded]; 117 | }]; 118 | } 119 | 120 | /* 121 | - (void)splitViewDidResizeSubviews:(NSNotification *)aNotification 122 | { 123 | return; 124 | } 125 | 126 | - (void)splitViewWillResizeSubviews:(NSNotification *)aNotification 127 | { 128 | return; 129 | } 130 | */ 131 | 132 | #pragma mark - IBActions 133 | 134 | - (IBAction)sliderAction:(id)sender 135 | { 136 | //DLog(@"scale factor: %f", self.slider.floatValue); 137 | float scaleFactor = self.slider.floatValue; 138 | 139 | self.scrollView.magnification = scaleFactor; 140 | 141 | //NSRect docFrame = self.scrollView.documentView.frame; 142 | //[self.scrollView setMagnification:scaleFactor centeredAtPoint:NSMakePoint(NSMidX(docFrame), NSMidY(docFrame))]; 143 | 144 | self.scrollView.contentView.needsDisplay = YES; 145 | } 146 | 147 | #pragma mark NSSplitViewDelegate methods 148 | 149 | - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview 150 | { 151 | if (subview == self.leftPane) { 152 | return YES; 153 | } 154 | else if (subview == self.rightPane) 155 | return YES; 156 | 157 | return NO; 158 | } 159 | 160 | @end 161 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/AutoLayoutSplitView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | org.demitri.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Demitri Muna. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/AutoLayoutSplitView-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 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | 11 | // To enable this, under Build Settings -> Other C Flags, add: "-DDLOG_DEBUG=1" under "debug" 12 | #ifdef DLOG_DEBUG 13 | # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); 14 | #else 15 | # define DLog(...) 16 | #endif 17 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/Base.lproj/MainMenu.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 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 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 | 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 | 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 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 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 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 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 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | Default 524 | 525 | 526 | 527 | 528 | 529 | 530 | Left to Right 531 | 532 | 533 | 534 | 535 | 536 | 537 | Right to Left 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | Default 549 | 550 | 551 | 552 | 553 | 554 | 555 | Left to Right 556 | 557 | 558 | 559 | 560 | 561 | 562 | Right to Left 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 733 | 746 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /AutoLayoutSplitView/butterfly.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/demitri/SplitViewAutoLayout/81a9dd2ead5d53f425d2cb5ed7f0e0d9bf961462/AutoLayoutSplitView/butterfly.jpg -------------------------------------------------------------------------------- /AutoLayoutSplitView/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AutoLayoutSplitView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AutoLayoutSplitView 4 | // 5 | // Created by Demitri Muna on 12/30/13. 6 | // 7 | 8 | #import 9 | 10 | int main(int argc, const char * argv[]) 11 | { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /AutoLayoutSplitViewTests/AutoLayoutSplitViewTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.demitri.${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 | -------------------------------------------------------------------------------- /AutoLayoutSplitViewTests/AutoLayoutSplitViewTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AutoLayoutSplitViewTests.m 3 | // AutoLayoutSplitViewTests 4 | // 5 | // Created by Demitri Muna on 12/30/13. 6 | // 7 | 8 | #import 9 | 10 | @interface AutoLayoutSplitViewTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation AutoLayoutSplitViewTests 15 | 16 | - (void)setUp 17 | { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown 23 | { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample 29 | { 30 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /AutoLayoutSplitViewTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SplitViewAutoLayout 2 | =================== 3 | 4 | This is a simple project to demonstrate how to use NSSplitView with Auto Layout. It consists of a three-paned view, where the middle pane contains an NSScrollView. The views are animated when expanding/collapsing. No categories or subclasses are used. 5 | 6 | TL;DR 7 | 8 | ```objective-c 9 | // Simply wrap the changes in an NSAnimationContext. 10 | // The split view and sub layers must have CALayers turned on 11 | // (can be done in Interface Builder by checking the boxes for each view). 12 | // 13 | - (IBAction)toggleLeftPane:(id)sender 14 | { 15 | [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { 16 | context.allowsImplicitAnimation = YES; 17 | context.duration = 0.25; // seconds 18 | context.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 19 | 20 | if ([self.splitView isSubviewCollapsed:self.leftPane]) { 21 | // -> expand 22 | [self.splitView setPosition:_lastLeftPaneWidth ofDividerAtIndex:0]; 23 | } else { 24 | // <- collapse 25 | _lastLeftPaneWidth = self.leftPane.frame.size.width; // remember current width to restore 26 | [self.splitView setPosition:0 ofDividerAtIndex:0]; 27 | } 28 | [self.splitView layoutSubtreeIfNeeded]; 29 | }]; 30 | } 31 | ``` 32 | 33 | 34 | 35 | ##### Model 36 | 37 | The layout is roughly analogous to how Xcode is laid out. All sizes described below are set up with Auto Layout constraints. 38 | 39 | * left pane has a minimum width of 100, but can grow (e.g. source view) 40 | * right pane is always fixed with a width of 150 (e.g. a fixed inspector view) 41 | * middle pane has minimum width of 50 42 | * left and right panes can collapse either programmatically or via user dragging (i.e. classic NSSplitView behavior) 43 | * the middle pane should be the most free to resize when the window is resized - the left pane should only be resized upon user interaction (manual resize or a button to collapse it); this is accomplished by setting the middle pane's holding priority lower than the left's 44 | * there are buttons to toggle the left and right panes, and a third to load content into the middle pane 45 | 46 | ##### Project Settings 47 | 48 | Edit the project scheme and add this to "Arguments Passed on Launch" - useful to debug any Auto Layout issues. 49 | 50 | -NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints YES 51 | 52 | ##### Steps Performed in Interface Builder 53 | 54 | * drag NSSplit view to window's view 55 | * drag an NSView into the split view to create a third pane 56 | * drag two buttons to the top of the view 57 | * constrain the buttons to the top and left/right edges of the containing view 58 | * constrain the widths of the buttons 59 | * control-drag from split view to enclosing view in each direction to create four constraints to fill the view, leaving space for the toggle buttons 60 | * add an identifier to each pane view (`leftPane`, `middlePane`, and `rightPane`) 61 | * select left pane, then Edit->Pin->Width, modify constraint created to a width of "greater than or equal" 100 62 | * repeat with middle pane, modify constraint created to a width of "greater than or equal" 50 63 | * select right pane, then Edit->Pin->Width, modify constraint created to a width of "greater than or equal" 100 64 | * select the NSSplitView and change the holding priorities (the important thing is that the left pane have a higher value than the middle): 65 | * left pane: 255 66 | * middle pane: 250 (default) 67 | * right pane: 250 (default) 68 | 69 | * in Interface Builder, turn on Core Animation layers for the split view and all sub views (optional, but required for transitions to be animated) 70 | 71 | #### Troubleshooting 72 | 73 | Initially I had this error upon running the application: 74 | 75 | Unsupported Configuration Content rectangle not entirely on screen with the menu bar ( May not be completely seen for all screen resolution and configurations) 76 | 77 | This was corrected by selecting the window itself in the xib, then the Size Inspector, and moving the initial position of the window to be centered horizontally and vertically on the screen. Not sure what was going on there. 78 | 79 | #### NSSplitView Delegate Methods 80 | 81 | It’s important to note that if some of the `NSSplitView` delegate methods are used, the view will revert to the old springs and structs layout. When using Auto Layout, do not implement these methods: 82 | 83 | -splitView:constrainMinCoordinate:ofSubviewAt: 84 | -splitView:constrainMaxCoordinate:ofSubviewAt: 85 | -splitView:resizeSubviewsWithOldSize: 86 | -splitView:shouldAdjustSizeOfSubview: 87 | 88 | 89 | #### Notes 90 | 91 | The `NSScrollView` has a color background which is helpful for debugging. 92 | 93 | --------------------------------------------------------------------------------