├── .gitignore ├── Demo ├── FSVDemo.xcodeproj │ └── project.pbxproj └── FlexibleSlidingViewDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ └── LaunchScreen.xib │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── MainViewController.h │ ├── MainViewController.m │ ├── ParameterTableViewController.h │ ├── ParameterTableViewController.m │ ├── SimpleViewController.h │ ├── SimpleViewController.m │ ├── SwitchTableViewCell.h │ ├── SwitchTableViewCell.m │ ├── TextFieldTableViewCell.h │ ├── TextFieldTableViewCell.m │ └── main.m ├── FSV Demo.gif ├── FSV Demo.mov ├── FlexibleSlidingView.xcworkspace └── contents.xcworkspacedata ├── LICENSE.txt ├── Library ├── FlexibleSlidingView.xcodeproj │ └── project.pbxproj ├── FlexibleSlidingView │ ├── FSVContainerViewController.h │ ├── FSVContainerViewController.m │ ├── FSVDimension.h │ ├── FSVDimension.m │ ├── FSVRelativePositioning.h │ ├── FSVSandwichView.h │ ├── FSVSandwichView.m │ ├── FSVSlidingStyle.h │ └── FSVSlidingViewState.h └── FlexibleSlidingViewTests │ └── Info.plist └── Readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | #ignore the following directories: 2 | *.app/ 3 | build/ 4 | Docs/html/ 5 | xcuserdata/ 6 | xcuserdatad/ 7 | .svn/ 8 | 9 | #ignore the following files: 10 | .* 11 | *.a 12 | *.fwbackup 13 | *.mode* 14 | *.o 15 | *.pbxuser 16 | *.xcbkptlist 17 | *.xccheckout 18 | *.xcuserstate 19 | 20 | #but do not ignore these files 21 | !.gitignore 22 | -------------------------------------------------------------------------------- /Demo/FSVDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3A031CF71B7F1E2F00B8DDF0 /* libFlexibleSlidingView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A031CF61B7F1E2F00B8DDF0 /* libFlexibleSlidingView.a */; }; 11 | 3A031D0A1B7F1F4B00B8DDF0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031CFA1B7F1F4B00B8DDF0 /* AppDelegate.m */; }; 12 | 3A031D0B1B7F1F4B00B8DDF0 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A031CFB1B7F1F4B00B8DDF0 /* LaunchScreen.xib */; }; 13 | 3A031D0C1B7F1F4B00B8DDF0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3A031CFD1B7F1F4B00B8DDF0 /* Images.xcassets */; }; 14 | 3A031D0E1B7F1F4B00B8DDF0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031CFF1B7F1F4B00B8DDF0 /* main.m */; }; 15 | 3A031D0F1B7F1F4B00B8DDF0 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D011B7F1F4B00B8DDF0 /* MainViewController.m */; }; 16 | 3A031D101B7F1F4B00B8DDF0 /* ParameterTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D031B7F1F4B00B8DDF0 /* ParameterTableViewController.m */; }; 17 | 3A031D111B7F1F4B00B8DDF0 /* SimpleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D051B7F1F4B00B8DDF0 /* SimpleViewController.m */; }; 18 | 3A031D121B7F1F4B00B8DDF0 /* SwitchTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D071B7F1F4B00B8DDF0 /* SwitchTableViewCell.m */; }; 19 | 3A031D131B7F1F4B00B8DDF0 /* TextFieldTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D091B7F1F4B00B8DDF0 /* TextFieldTableViewCell.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 3A031CF61B7F1E2F00B8DDF0 /* libFlexibleSlidingView.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libFlexibleSlidingView.a; path = "../Library/build/Debug-iphoneos/libFlexibleSlidingView.a"; sourceTree = ""; }; 24 | 3A031CF91B7F1F4B00B8DDF0 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | 3A031CFA1B7F1F4B00B8DDF0 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | 3A031CFC1B7F1F4B00B8DDF0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 27 | 3A031CFD1B7F1F4B00B8DDF0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 28 | 3A031CFE1B7F1F4B00B8DDF0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 3A031CFF1B7F1F4B00B8DDF0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 30 | 3A031D001B7F1F4B00B8DDF0 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; 31 | 3A031D011B7F1F4B00B8DDF0 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; 32 | 3A031D021B7F1F4B00B8DDF0 /* ParameterTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParameterTableViewController.h; sourceTree = ""; }; 33 | 3A031D031B7F1F4B00B8DDF0 /* ParameterTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ParameterTableViewController.m; sourceTree = ""; }; 34 | 3A031D041B7F1F4B00B8DDF0 /* SimpleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleViewController.h; sourceTree = ""; }; 35 | 3A031D051B7F1F4B00B8DDF0 /* SimpleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleViewController.m; sourceTree = ""; }; 36 | 3A031D061B7F1F4B00B8DDF0 /* SwitchTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwitchTableViewCell.h; sourceTree = ""; }; 37 | 3A031D071B7F1F4B00B8DDF0 /* SwitchTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SwitchTableViewCell.m; sourceTree = ""; }; 38 | 3A031D081B7F1F4B00B8DDF0 /* TextFieldTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextFieldTableViewCell.h; sourceTree = ""; }; 39 | 3A031D091B7F1F4B00B8DDF0 /* TextFieldTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextFieldTableViewCell.m; sourceTree = ""; }; 40 | 3A2F3FB11B75448B00FF3FE9 /* FSVDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FSVDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 3A2F3FAE1B75448B00FF3FE9 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | 3A031CF71B7F1E2F00B8DDF0 /* libFlexibleSlidingView.a in Frameworks */, 49 | ); 50 | runOnlyForDeploymentPostprocessing = 0; 51 | }; 52 | /* End PBXFrameworksBuildPhase section */ 53 | 54 | /* Begin PBXGroup section */ 55 | 3A031CF81B7F1F4B00B8DDF0 /* FlexibleSlidingViewDemo */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 3A031CF91B7F1F4B00B8DDF0 /* AppDelegate.h */, 59 | 3A031CFA1B7F1F4B00B8DDF0 /* AppDelegate.m */, 60 | 3A031CFF1B7F1F4B00B8DDF0 /* main.m */, 61 | 3A031D001B7F1F4B00B8DDF0 /* MainViewController.h */, 62 | 3A031D011B7F1F4B00B8DDF0 /* MainViewController.m */, 63 | 3A031D021B7F1F4B00B8DDF0 /* ParameterTableViewController.h */, 64 | 3A031D031B7F1F4B00B8DDF0 /* ParameterTableViewController.m */, 65 | 3A031D041B7F1F4B00B8DDF0 /* SimpleViewController.h */, 66 | 3A031D051B7F1F4B00B8DDF0 /* SimpleViewController.m */, 67 | 3A031D061B7F1F4B00B8DDF0 /* SwitchTableViewCell.h */, 68 | 3A031D071B7F1F4B00B8DDF0 /* SwitchTableViewCell.m */, 69 | 3A031D081B7F1F4B00B8DDF0 /* TextFieldTableViewCell.h */, 70 | 3A031D091B7F1F4B00B8DDF0 /* TextFieldTableViewCell.m */, 71 | ); 72 | path = FlexibleSlidingViewDemo; 73 | sourceTree = ""; 74 | }; 75 | 3A031D251B7F221900B8DDF0 /* Supporting Files */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 3A031CFB1B7F1F4B00B8DDF0 /* LaunchScreen.xib */, 79 | 3A031CFD1B7F1F4B00B8DDF0 /* Images.xcassets */, 80 | 3A031CFE1B7F1F4B00B8DDF0 /* Info.plist */, 81 | ); 82 | name = "Supporting Files"; 83 | path = FlexibleSlidingViewDemo; 84 | sourceTree = ""; 85 | }; 86 | 3A2F3FA81B75448B00FF3FE9 = { 87 | isa = PBXGroup; 88 | children = ( 89 | 3A031CF81B7F1F4B00B8DDF0 /* FlexibleSlidingViewDemo */, 90 | 3A2F3FDC1B75453900FF3FE9 /* Frameworks & libraries */, 91 | 3A2F3FB21B75448B00FF3FE9 /* Products */, 92 | 3A031D251B7F221900B8DDF0 /* Supporting Files */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 3A2F3FB21B75448B00FF3FE9 /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 3A2F3FB11B75448B00FF3FE9 /* FSVDemo.app */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 3A2F3FDC1B75453900FF3FE9 /* Frameworks & libraries */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 3A031CF61B7F1E2F00B8DDF0 /* libFlexibleSlidingView.a */, 108 | ); 109 | name = "Frameworks & libraries"; 110 | sourceTree = ""; 111 | }; 112 | /* End PBXGroup section */ 113 | 114 | /* Begin PBXNativeTarget section */ 115 | 3A2F3FB01B75448B00FF3FE9 /* FSVDemo */ = { 116 | isa = PBXNativeTarget; 117 | buildConfigurationList = 3A2F3FD41B75448B00FF3FE9 /* Build configuration list for PBXNativeTarget "FSVDemo" */; 118 | buildPhases = ( 119 | 3A2F3FAD1B75448B00FF3FE9 /* Sources */, 120 | 3A2F3FAE1B75448B00FF3FE9 /* Frameworks */, 121 | 3A2F3FAF1B75448B00FF3FE9 /* Resources */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = FSVDemo; 128 | productName = SWSlidingViewControllerDemo; 129 | productReference = 3A2F3FB11B75448B00FF3FE9 /* FSVDemo.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 3A2F3FA91B75448B00FF3FE9 /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 0640; 139 | ORGANIZATIONNAME = skywind; 140 | TargetAttributes = { 141 | 3A2F3FB01B75448B00FF3FE9 = { 142 | CreatedOnToolsVersion = 6.4; 143 | }; 144 | }; 145 | }; 146 | buildConfigurationList = 3A2F3FAC1B75448B00FF3FE9 /* Build configuration list for PBXProject "FSVDemo" */; 147 | compatibilityVersion = "Xcode 3.2"; 148 | developmentRegion = English; 149 | hasScannedForEncodings = 0; 150 | knownRegions = ( 151 | en, 152 | Base, 153 | ); 154 | mainGroup = 3A2F3FA81B75448B00FF3FE9; 155 | productRefGroup = 3A2F3FB21B75448B00FF3FE9 /* Products */; 156 | projectDirPath = ""; 157 | projectRoot = ""; 158 | targets = ( 159 | 3A2F3FB01B75448B00FF3FE9 /* FSVDemo */, 160 | ); 161 | }; 162 | /* End PBXProject section */ 163 | 164 | /* Begin PBXResourcesBuildPhase section */ 165 | 3A2F3FAF1B75448B00FF3FE9 /* Resources */ = { 166 | isa = PBXResourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | 3A031D0B1B7F1F4B00B8DDF0 /* LaunchScreen.xib in Resources */, 170 | 3A031D0C1B7F1F4B00B8DDF0 /* Images.xcassets in Resources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXResourcesBuildPhase section */ 175 | 176 | /* Begin PBXSourcesBuildPhase section */ 177 | 3A2F3FAD1B75448B00FF3FE9 /* Sources */ = { 178 | isa = PBXSourcesBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | 3A031D131B7F1F4B00B8DDF0 /* TextFieldTableViewCell.m in Sources */, 182 | 3A031D111B7F1F4B00B8DDF0 /* SimpleViewController.m in Sources */, 183 | 3A031D121B7F1F4B00B8DDF0 /* SwitchTableViewCell.m in Sources */, 184 | 3A031D0E1B7F1F4B00B8DDF0 /* main.m in Sources */, 185 | 3A031D101B7F1F4B00B8DDF0 /* ParameterTableViewController.m in Sources */, 186 | 3A031D0F1B7F1F4B00B8DDF0 /* MainViewController.m in Sources */, 187 | 3A031D0A1B7F1F4B00B8DDF0 /* AppDelegate.m in Sources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXSourcesBuildPhase section */ 192 | 193 | /* Begin PBXVariantGroup section */ 194 | 3A031CFB1B7F1F4B00B8DDF0 /* LaunchScreen.xib */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | 3A031CFC1B7F1F4B00B8DDF0 /* Base */, 198 | ); 199 | name = LaunchScreen.xib; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXVariantGroup section */ 203 | 204 | /* Begin XCBuildConfiguration section */ 205 | 3A2F3FD21B75448B00FF3FE9 /* Debug */ = { 206 | isa = XCBuildConfiguration; 207 | buildSettings = { 208 | ALWAYS_SEARCH_USER_PATHS = NO; 209 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 210 | CLANG_CXX_LIBRARY = "libc++"; 211 | CLANG_ENABLE_MODULES = YES; 212 | CLANG_ENABLE_OBJC_ARC = YES; 213 | CLANG_WARN_BOOL_CONVERSION = YES; 214 | CLANG_WARN_CONSTANT_CONVERSION = YES; 215 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 216 | CLANG_WARN_EMPTY_BODY = YES; 217 | CLANG_WARN_ENUM_CONVERSION = YES; 218 | CLANG_WARN_INT_CONVERSION = YES; 219 | CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; 220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 221 | CLANG_WARN_UNREACHABLE_CODE = YES; 222 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 223 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 224 | COPY_PHASE_STRIP = NO; 225 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 226 | ENABLE_STRICT_OBJC_MSGSEND = YES; 227 | GCC_C_LANGUAGE_STANDARD = gnu99; 228 | GCC_DYNAMIC_NO_PIC = NO; 229 | GCC_NO_COMMON_BLOCKS = YES; 230 | GCC_OPTIMIZATION_LEVEL = 0; 231 | GCC_PREPROCESSOR_DEFINITIONS = ( 232 | "DEBUG=1", 233 | "$(inherited)", 234 | ); 235 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 238 | GCC_WARN_MISSING_PARENTHESES = NO; 239 | GCC_WARN_UNDECLARED_SELECTOR = YES; 240 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 241 | GCC_WARN_UNUSED_FUNCTION = YES; 242 | GCC_WARN_UNUSED_VARIABLE = YES; 243 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 244 | MTL_ENABLE_DEBUG_INFO = YES; 245 | ONLY_ACTIVE_ARCH = YES; 246 | SDKROOT = iphoneos; 247 | TARGETED_DEVICE_FAMILY = "1,2"; 248 | USER_HEADER_SEARCH_PATHS = ../Library; 249 | }; 250 | name = Debug; 251 | }; 252 | 3A2F3FD31B75448B00FF3FE9 /* Release */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | ALWAYS_SEARCH_USER_PATHS = NO; 256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 257 | CLANG_CXX_LIBRARY = "libc++"; 258 | CLANG_ENABLE_MODULES = YES; 259 | CLANG_ENABLE_OBJC_ARC = YES; 260 | CLANG_WARN_BOOL_CONVERSION = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 263 | CLANG_WARN_EMPTY_BODY = YES; 264 | CLANG_WARN_ENUM_CONVERSION = YES; 265 | CLANG_WARN_INT_CONVERSION = YES; 266 | CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; 267 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 271 | COPY_PHASE_STRIP = NO; 272 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 273 | ENABLE_NS_ASSERTIONS = NO; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_NO_COMMON_BLOCKS = YES; 277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 279 | GCC_WARN_MISSING_PARENTHESES = NO; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 285 | MTL_ENABLE_DEBUG_INFO = NO; 286 | SDKROOT = iphoneos; 287 | TARGETED_DEVICE_FAMILY = "1,2"; 288 | USER_HEADER_SEARCH_PATHS = ../Library; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Release; 292 | }; 293 | 3A2F3FD51B75448B00FF3FE9 /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 297 | INFOPLIST_FILE = FlexibleSlidingViewDemo/Info.plist; 298 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 299 | PRODUCT_NAME = FSVDemo; 300 | }; 301 | name = Debug; 302 | }; 303 | 3A2F3FD61B75448B00FF3FE9 /* Release */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | INFOPLIST_FILE = FlexibleSlidingViewDemo/Info.plist; 308 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 309 | PRODUCT_NAME = FSVDemo; 310 | }; 311 | name = Release; 312 | }; 313 | /* End XCBuildConfiguration section */ 314 | 315 | /* Begin XCConfigurationList section */ 316 | 3A2F3FAC1B75448B00FF3FE9 /* Build configuration list for PBXProject "FSVDemo" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 3A2F3FD21B75448B00FF3FE9 /* Debug */, 320 | 3A2F3FD31B75448B00FF3FE9 /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | 3A2F3FD41B75448B00FF3FE9 /* Build configuration list for PBXNativeTarget "FSVDemo" */ = { 326 | isa = XCConfigurationList; 327 | buildConfigurations = ( 328 | 3A2F3FD51B75448B00FF3FE9 /* Debug */, 329 | 3A2F3FD61B75448B00FF3FE9 /* Release */, 330 | ); 331 | defaultConfigurationIsVisible = 0; 332 | defaultConfigurationName = Release; 333 | }; 334 | /* End XCConfigurationList section */ 335 | }; 336 | rootObject = 3A2F3FA91B75448B00FF3FE9 /* Project object */; 337 | } 338 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow* window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "MainViewController.h" 11 | #import "ParameterTableViewController.h" 12 | #import "SimpleViewController.h" 13 | 14 | #import "FlexibleSlidingView/FSVDimension.h" 15 | #import "FlexibleSlidingView/FSVRelativePositioning.h" 16 | #import "FlexibleSlidingView/FSVContainerViewController.h" 17 | 18 | #pragma mark Class extensions 19 | @interface AppDelegate () 20 | 21 | @end 22 | 23 | #pragma mark - Implementation 24 | @implementation AppDelegate 25 | @synthesize window=_window; 26 | 27 | #pragma mark - UIApplicationDelegate protocol 28 | -(BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions 29 | { 30 | MainViewController* mainViewController = [MainViewController new]; 31 | 32 | 33 | [mainViewController setAllowTapMinimization:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyTapMinimization]]; 34 | [mainViewController setDarkening:[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyDarkening]]; 35 | [mainViewController setMaxXDimension:[FSVDimension dimensionWithDimension:[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMaxXDimension] absoluteDimension:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMaxXDimension]]]; 36 | [mainViewController setMaxYDimension:[FSVDimension dimensionWithDimension:[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMaxYDimension] absoluteDimension:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMaxYDimension]]]; 37 | [mainViewController setMinXDimension:[FSVDimension dimensionWithDimension:[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMinXDimension] absoluteDimension:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMinXDimension]]]; 38 | [mainViewController setMinYDimension:[FSVDimension dimensionWithDimension:[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMinYDimension] absoluteDimension:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMinYDimension]]]; 39 | [mainViewController setSlidingStyle:(FSVSlidingStyle)[[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsKeySlidingStyle]]; 40 | [mainViewController setSlidingResizes:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyResize]]; 41 | [mainViewController setSnapToLimits:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeySnapToLimits]]; 42 | [mainViewController setXSnapBorder: [[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeySnapXBorder]]; 43 | [mainViewController setYSnapBorder: [[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeySnapYBorder]]; 44 | [mainViewController setSlidingViewPositioning:(FSVRelativePositioning)[[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsKeyRelativePosition]]; 45 | [mainViewController setMainViewController:[SimpleViewController simpleViewControllerWithColor:[UIColor colorWithRed:115.0/255.0 green:190.0/255.0 blue:255.0/255.0 alpha:1.0] 46 | text:@"Main view"]]; 47 | [mainViewController setSlidingViewController:[SimpleViewController simpleViewControllerWithColor:[UIColor colorWithRed:245.0/2550.0 green:255.0/255.0 blue:160.0/255.0 alpha:1.0] 48 | text:@"Sliding view"]]; 49 | [mainViewController setTitle:@"Flexible Sliding Views"]; 50 | [self setWindow:[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]]; 51 | [[self window] makeKeyAndVisible]; 52 | [[self window] setRootViewController:[[UINavigationController alloc] initWithRootViewController:mainViewController]]; 53 | 54 | return YES; 55 | } 56 | 57 | -(BOOL) application:(UIApplication*)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptions 58 | { 59 | NSMutableDictionary* defaults = [NSMutableDictionary dictionary]; 60 | 61 | 62 | [defaults setObject:[NSNumber numberWithBool:NO] forKey:kUserDefaultsKeyAbsoluteMaxXDimension]; 63 | [defaults setObject:[NSNumber numberWithBool:NO] forKey:kUserDefaultsKeyAbsoluteMaxYDimension]; 64 | [defaults setObject:[NSNumber numberWithBool:NO] forKey:kUserDefaultsKeyAbsoluteMinXDimension]; 65 | [defaults setObject:[NSNumber numberWithBool:NO] forKey:kUserDefaultsKeyAbsoluteMinYDimension]; 66 | [defaults setObject:[NSNumber numberWithDouble:1.0] forKey:kUserDefaultsKeyMaxXDimension]; 67 | [defaults setObject:[NSNumber numberWithDouble:1.0] forKey:kUserDefaultsKeyMaxYDimension]; 68 | [defaults setObject:[NSNumber numberWithDouble:0.1] forKey:kUserDefaultsKeyMinXDimension]; 69 | [defaults setObject:[NSNumber numberWithDouble:0.1] forKey:kUserDefaultsKeyMinYDimension]; 70 | [defaults setObject:[NSNumber numberWithDouble:0.5] forKey:kUserDefaultsKeySnapXBorder]; 71 | [defaults setObject:[NSNumber numberWithDouble:0.5] forKey:kUserDefaultsKeySnapYBorder]; 72 | [defaults setObject:[NSNumber numberWithInteger:FSVRelativePositioningBottom] forKey:kUserDefaultsKeyRelativePosition]; 73 | [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; 74 | return YES; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | eu.skywind.$(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 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "FlexibleSlidingView/FSVContainerViewController.h" 10 | 11 | @interface MainViewController : FSVContainerViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/MainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.m 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "MainViewController.h" 10 | #import "ParameterTableViewController.h" 11 | 12 | #import "FlexibleSlidingView/FSVDimension.h" 13 | #import "FlexibleSlidingView/FSVRelativePositioning.h" 14 | 15 | #pragma mark Class extensions 16 | @interface MainViewController () 17 | 18 | /** @name Private methods 19 | * @{ */ 20 | 21 | /// Action handler 22 | -(void) actionAction:(UIBarButtonItem*)sender; 23 | 24 | /// Notification handler 25 | -(void) notificationUserDefaultsChanged:(NSNotification*)notification; 26 | 27 | /** @} */ 28 | @end 29 | 30 | #pragma mark - Implementation 31 | @implementation MainViewController 32 | 33 | #pragma mark - Initialization, object allocation and deallocation 34 | -(void) dealloc 35 | { 36 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 37 | } 38 | 39 | #pragma mark - Methods inherited from UIViewController 40 | -(void) viewDidLoad 41 | { 42 | [super viewDidLoad]; 43 | 44 | [[self navigationItem] setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(actionAction:)]]; 45 | 46 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationUserDefaultsChanged:) name:NSUserDefaultsDidChangeNotification object:nil]; 47 | } 48 | 49 | #pragma mark - UIPopoverPresentationControllerDelegate protocol 50 | -(UIModalPresentationStyle) adaptivePresentationStyleForPresentationController:(UIPresentationController*)controller 51 | { 52 | return UIModalPresentationNone; 53 | } 54 | 55 | #pragma mark - Private methods 56 | -(void) actionAction:(UIBarButtonItem*)sender 57 | { 58 | ParameterTableViewController* parameterTableViewController = [[ParameterTableViewController alloc] initWithStyle:UITableViewStyleGrouped]; 59 | 60 | [parameterTableViewController setModalPresentationStyle:UIModalPresentationPopover]; 61 | 62 | UIPopoverPresentationController* popoverPresentationController = [parameterTableViewController popoverPresentationController]; 63 | 64 | [popoverPresentationController setBarButtonItem:sender]; 65 | [popoverPresentationController setDelegate:self]; 66 | [popoverPresentationController setPassthroughViews:nil]; 67 | 68 | [self presentViewController:parameterTableViewController animated:YES completion:nil]; 69 | } 70 | 71 | -(void) notificationUserDefaultsChanged:(NSNotification*)notification 72 | { 73 | NSUserDefaults* const userDefaults = (NSUserDefaults*)[notification object]; 74 | 75 | 76 | if ([userDefaults doubleForKey:kUserDefaultsKeyDarkening] != [self darkening]) 77 | [self setDarkening:[userDefaults doubleForKey:kUserDefaultsKeyDarkening]]; 78 | if ((FSVRelativePositioning)[userDefaults integerForKey:kUserDefaultsKeyRelativePosition] != [self slidingViewPositioning]) 79 | [self setSlidingViewPositioning:(FSVRelativePositioning)[userDefaults integerForKey:kUserDefaultsKeyRelativePosition]]; 80 | if (([userDefaults boolForKey:kUserDefaultsKeyAbsoluteMaxXDimension] != [[self maxXDimension] absoluteDimension]) || 81 | ([userDefaults doubleForKey:kUserDefaultsKeyMaxXDimension] != [[self maxXDimension] dimension])) 82 | [self setMaxXDimension:[FSVDimension dimensionWithDimension:[userDefaults doubleForKey:kUserDefaultsKeyMaxXDimension] absoluteDimension:[userDefaults boolForKey:kUserDefaultsKeyAbsoluteMaxXDimension]]]; 83 | if (([userDefaults boolForKey:kUserDefaultsKeyAbsoluteMaxYDimension] != [[self maxYDimension] absoluteDimension]) || 84 | ([userDefaults doubleForKey:kUserDefaultsKeyMaxYDimension] != [[self maxYDimension] dimension])) 85 | [self setMaxYDimension:[FSVDimension dimensionWithDimension:[userDefaults doubleForKey:kUserDefaultsKeyMaxYDimension] absoluteDimension:[userDefaults boolForKey:kUserDefaultsKeyAbsoluteMaxYDimension]]]; 86 | if (([userDefaults boolForKey:kUserDefaultsKeyAbsoluteMinXDimension] != [[self minXDimension] absoluteDimension]) || 87 | ([userDefaults doubleForKey:kUserDefaultsKeyMinXDimension] != [[self minXDimension] dimension])) 88 | [self setMinXDimension:[FSVDimension dimensionWithDimension:[userDefaults doubleForKey:kUserDefaultsKeyMinXDimension] absoluteDimension:[userDefaults boolForKey:kUserDefaultsKeyAbsoluteMinXDimension]]]; 89 | if (([userDefaults boolForKey:kUserDefaultsKeyAbsoluteMinYDimension] != [[self minYDimension] absoluteDimension]) || 90 | ([userDefaults doubleForKey:kUserDefaultsKeyMinYDimension] != [[self minYDimension] dimension])) 91 | [self setMinYDimension:[FSVDimension dimensionWithDimension:[userDefaults doubleForKey:kUserDefaultsKeyMinYDimension] absoluteDimension:[userDefaults boolForKey:kUserDefaultsKeyAbsoluteMinYDimension]]]; 92 | if ([userDefaults boolForKey:kUserDefaultsKeyResize] != [self slidingResizes]) 93 | [self setSlidingResizes:[userDefaults boolForKey:kUserDefaultsKeyResize]]; 94 | if ((FSVSlidingStyle)[userDefaults integerForKey:kUserDefaultsKeySlidingStyle] != [self slidingStyle]) 95 | [self setSlidingStyle:(FSVSlidingStyle)[userDefaults integerForKey:kUserDefaultsKeySlidingStyle]]; 96 | if ([userDefaults boolForKey:kUserDefaultsKeySnapToLimits] != [self snapToLimits]) 97 | [self setSnapToLimits:[userDefaults boolForKey:kUserDefaultsKeySnapToLimits]]; 98 | if ([userDefaults doubleForKey:kUserDefaultsKeySnapXBorder] != [self xSnapBorder]) 99 | [self setXSnapBorder:[userDefaults doubleForKey:kUserDefaultsKeySnapXBorder]]; 100 | if ([userDefaults doubleForKey:kUserDefaultsKeySnapYBorder] != [self ySnapBorder]) 101 | [self setYSnapBorder:[userDefaults doubleForKey:kUserDefaultsKeySnapYBorder]]; 102 | if ([userDefaults boolForKey:kUserDefaultsKeyTapMinimization] != [self allowTapMinimization]) 103 | [self setAllowTapMinimization:[userDefaults boolForKey:kUserDefaultsKeyTapMinimization]]; 104 | } 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/ParameterTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ParameterTableViewController.h 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** @name Key definitions for user defaults 12 | * @{ */ 13 | 14 | /// Key for storing the flag indicating an absolute or relative maximum x-dimension 15 | extern NSString* const kUserDefaultsKeyAbsoluteMaxXDimension; 16 | /// Key for storing the flag indicating an absolute or relative maximum y-dimension 17 | extern NSString* const kUserDefaultsKeyAbsoluteMaxYDimension; 18 | /// Key for storing the flag indicating an absolute or relative minimum x-dimension 19 | extern NSString* const kUserDefaultsKeyAbsoluteMinXDimension; 20 | /// Key for storing the flag indicating an absolute or relative minimum y-dimension 21 | extern NSString* const kUserDefaultsKeyAbsoluteMinYDimension; 22 | /// Key for storing the darkening value 23 | extern NSString* const kUserDefaultsKeyDarkening; 24 | /// Key for storing the minimum x-position's value 25 | extern NSString* const kUserDefaultsKeyMaxXDimension; 26 | /// Key for storing the minimum y-position's value 27 | extern NSString* const kUserDefaultsKeyMaxYDimension; 28 | /// Key for storing the minimum x-position's value 29 | extern NSString* const kUserDefaultsKeyMinXDimension; 30 | /// Key for storing the minimum y-position's value 31 | extern NSString* const kUserDefaultsKeyMinYDimension; 32 | /// Key for storing the sliding view's relative dimension 33 | extern NSString* const kUserDefaultsKeyRelativePosition; 34 | /// Key for storing the flag indicating if view are sized or keep their sizes 35 | extern NSString* const kUserDefaultsKeyResize; 36 | /// Key for storing the sliding style 37 | extern NSString* const kUserDefaultsKeySlidingStyle; 38 | /// Key for storing the snap flag 39 | extern NSString* const kUserDefaultsKeySnapToLimits; 40 | /// Key for storing the snap border for the x-direction 41 | extern NSString* const kUserDefaultsKeySnapXBorder; 42 | /// Key for storing the snap border for the y-direction 43 | extern NSString* const kUserDefaultsKeySnapYBorder; 44 | /// Key for storing the flag indicating if tapping minimizes the sliding view 45 | extern NSString* const kUserDefaultsKeyTapMinimization; 46 | 47 | /** @} */ 48 | 49 | @interface ParameterTableViewController : UITableViewController 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/ParameterTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ParameterTableViewController.m 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "ParameterTableViewController.h" 10 | #import "SwitchTableViewCell.h" 11 | #import "TextFieldTableViewCell.h" 12 | 13 | #import "FlexibleSlidingView/FSVSlidingStyle.h" 14 | 15 | #pragma mark Global constant definitions 16 | NSString* const kUserDefaultsKeyAbsoluteMaxXDimension = @"UserDefaultsKeyAbsoluteMaxXDimension"; 17 | NSString* const kUserDefaultsKeyAbsoluteMaxYDimension = @"UserDefaultsKeyAbsoluteMaxYDimension"; 18 | NSString* const kUserDefaultsKeyAbsoluteMinXDimension = @"UserDefaultsKeyAbsoluteMinXDimension"; 19 | NSString* const kUserDefaultsKeyAbsoluteMinYDimension = @"UserDefaultsKeyAbsoluteMinYDimension"; 20 | NSString* const kUserDefaultsKeyDarkening = @"UserDefaultsKeyDarkening"; 21 | NSString* const kUserDefaultsKeyMaxXDimension = @"UserDefaultsKeyMaxXDimension"; 22 | NSString* const kUserDefaultsKeyMaxYDimension = @"UserDefaultsKeyMaxYDimension"; 23 | NSString* const kUserDefaultsKeyMinXDimension = @"UserDefaultsKeyMinXDimension"; 24 | NSString* const kUserDefaultsKeyMinYDimension = @"UserDefaultsKeyMinYDimension"; 25 | NSString* const kUserDefaultsKeyRelativePosition = @"UserDefaultsKeyRelativePosition"; 26 | NSString* const kUserDefaultsKeyResize = @"UserDefaultsKeyResize"; 27 | NSString* const kUserDefaultsKeySlidingStyle = @"UserDefaultsKeySlidingStyle"; 28 | NSString* const kUserDefaultsKeySnapToLimits = @"UserDefaultsKeySnapToLimits"; 29 | NSString* const kUserDefaultsKeySnapXBorder = @"UserDefaultsKeySnapXBorder"; 30 | NSString* const kUserDefaultsKeySnapYBorder = @"UserDefaultsKeySnapYBorder"; 31 | NSString* const kUserDefaultsKeyTapMinimization = @"UserDefaultsKeyTapMinimization"; 32 | 33 | #pragma mark - Local constant definitions 34 | 35 | #define kSectionEffects 3 36 | #define kSectionGeneral 0 37 | #define kSectionSizes 1 38 | #define kSectionSnap 2 39 | 40 | #define kRowEffectsDarkening 0 41 | #define kRowEffectsTapMinimization 1 42 | 43 | #define kRowGeneralMove 1 44 | #define kRowGeneralRelativePosition 0 45 | #define kRowGeneralResize 2 46 | 47 | #define kRowSizesAbsoluteMaxXDimensionFlag 4 48 | #define kRowSizesAbsoluteMaxYDimensionFlag 6 49 | #define kRowSizesAbsoluteMinXDimensionFlag 0 50 | #define kRowSizesAbsoluteMinYDimensionFlag 2 51 | #define kRowSizesMaxXDimensionValue 5 52 | #define kRowSizesMaxYDimensionValue 7 53 | #define kRowSizesMinXDimensionValue 1 54 | #define kRowSizesMinYDimensionValue 3 55 | 56 | #define kRowSnapFlag 0 57 | #define kRowSnapXLimit (kRowSnapFlag+1) 58 | #define kRowSnapYLimit (kRowSnapXLimit+1) 59 | 60 | static NSInteger const kTagAbsoluteMaxXDimension = 1; 61 | static NSInteger const kTagAbsoluteMaxYDimension = kTagAbsoluteMaxXDimension+1; 62 | static NSInteger const kTagAbsoluteMinXDimension = kTagAbsoluteMaxYDimension+1; 63 | static NSInteger const kTagAbsoluteMinYDimension = kTagAbsoluteMinXDimension+1; 64 | static NSInteger const kTagDarkening = kTagAbsoluteMinYDimension+1; 65 | static NSInteger const kTagMaxXDimension = kTagDarkening+1; 66 | static NSInteger const kTagMaxYDimension = kTagMaxXDimension+1; 67 | static NSInteger const kTagMinXDimension = kTagMaxYDimension+1; 68 | static NSInteger const kTagMinYDimension = kTagMinXDimension+1; 69 | static NSInteger const kTagMove = kTagMinYDimension+1; 70 | static NSInteger const kTagRelativePosition = kTagMove+1; 71 | static NSInteger const kTagResize = kTagRelativePosition+1; 72 | static NSInteger const kTagSnapFlag = kTagResize+1; 73 | static NSInteger const kTagSnapXBorder = kTagSnapFlag+1; 74 | static NSInteger const kTagSnapYBorder = kTagSnapXBorder+1; 75 | static NSInteger const kTagTapMinimization = kTagSnapYBorder+1; 76 | 77 | static NSString* kCellIDSwitch = @"CellIDSwitch"; 78 | static NSString* kCellIDTextField = @"CellIDTextField"; 79 | 80 | #pragma mark - Class extensions 81 | @interface ParameterTableViewController () 82 | 83 | /** @name Private methods 84 | * @{ */ 85 | 86 | /// Action handler 87 | -(void) actionAbsoluteMaxXDimension:(UISwitch*)sender; 88 | /// Action handler 89 | -(void) actionAbsoluteMaxYDimension:(UISwitch*)sender; 90 | /// Action handler 91 | -(void) actionAbsoluteMinXDimension:(UISwitch*)sender; 92 | /// Action handler 93 | -(void) actionAbsoluteMinYDimension:(UISwitch*)sender; 94 | /// Action handler 95 | -(void) actionDone:(UIBarButtonItem*)sender; 96 | /// Action handler 97 | -(void) actionMove:(UISwitch*)sender; 98 | /// Action handler 99 | -(void) actionResize:(UISwitch*)sender; 100 | /// Action handler 101 | -(void) actionSnapFlag:(UISwitch*)sender; 102 | /// Action handler 103 | -(void) actionTapMinimization:(UISwitch*)sender; 104 | 105 | /** @} */ 106 | @end 107 | 108 | #pragma mark - Implementation 109 | @implementation ParameterTableViewController 110 | 111 | #pragma mark - Inherited methods from UIViewController 112 | -(void) viewDidLoad 113 | { 114 | [super viewDidLoad]; 115 | 116 | if ([self presentingViewController] != nil) 117 | [[self navigationItem] setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(actionDone:)]]; 118 | } 119 | 120 | #pragma mark - UITableViewDataSource protocol 121 | -(NSInteger) numberOfSectionsInTableView:(UITableView*)tableView 122 | { 123 | return 4; 124 | } 125 | 126 | -(UITableViewCell*) tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath 127 | { 128 | UITableViewCell* cell = nil; 129 | 130 | 131 | switch ([indexPath section]) 132 | { 133 | case kSectionEffects: 134 | switch ([indexPath row]) 135 | { 136 | case kRowEffectsDarkening: 137 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 138 | if (cell != nil) 139 | { 140 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 141 | 142 | UITextField* textFieldView = [textFieldCell textField]; 143 | 144 | [textFieldCell setTextLabelWidth:180.0]; 145 | [[textFieldCell textLabel] setText:@"Darkening [0.0; 1.0]"]; 146 | [textFieldView setDelegate:self]; 147 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 148 | [textFieldView setTag:kTagDarkening]; 149 | [textFieldView setText:[NSString stringWithFormat:@"%.2f",[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyDarkening]]]; 150 | } /* if */ 151 | break; 152 | case kRowEffectsTapMinimization: 153 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 154 | if (cell != nil) 155 | { 156 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 157 | 158 | [switchCell setTag:kTagTapMinimization]; 159 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 160 | [[switchCell switchControl] addTarget:self action:@selector(actionTapMinimization:) forControlEvents:UIControlEventValueChanged]; 161 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyTapMinimization]]; 162 | [[switchCell textLabel] setText:@"Tap minimizes"]; 163 | } /* if */ 164 | break; 165 | } /* switch */ 166 | break; 167 | case kSectionGeneral: 168 | switch ([indexPath row]) 169 | { 170 | case kRowGeneralMove: 171 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 172 | if (cell != nil) 173 | { 174 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 175 | 176 | [switchCell setTag:kTagMove]; 177 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 178 | [[switchCell switchControl] addTarget:self action:@selector(actionMove:) forControlEvents:UIControlEventValueChanged]; 179 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsKeySlidingStyle] == FSVSlidingStyleMove]; 180 | [[switchCell textLabel] setText:@"Move views"]; 181 | } /* if */ 182 | break; 183 | case kRowGeneralRelativePosition: 184 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 185 | if (cell != nil) 186 | { 187 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 188 | 189 | UITextField* textFieldView = [textFieldCell textField]; 190 | 191 | [textFieldCell setTextLabelWidth:250.0]; 192 | [[textFieldCell textLabel] setText:@"Relative dimension (1-15)"]; 193 | [textFieldView setDelegate:self]; 194 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 195 | [textFieldView setTag:kTagRelativePosition]; 196 | [textFieldView setText:[NSString stringWithFormat:@"%d",(int)[[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsKeyRelativePosition]]]; 197 | } /* if */ 198 | break; 199 | case kRowGeneralResize: 200 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 201 | if (cell != nil) 202 | { 203 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 204 | 205 | [switchCell setTag:kTagResize]; 206 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 207 | [[switchCell switchControl] addTarget:self action:@selector(actionResize:) forControlEvents:UIControlEventValueChanged]; 208 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyResize]]; 209 | [[switchCell textLabel] setText:@"Resize views"]; 210 | } /* if */ 211 | break; 212 | } /* switch */ 213 | break; 214 | case kSectionSizes: 215 | switch ([indexPath row]) 216 | { 217 | case kRowSizesAbsoluteMaxXDimensionFlag: 218 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 219 | if (cell != nil) 220 | { 221 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 222 | 223 | [switchCell setTag:kTagAbsoluteMaxXDimension]; 224 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 225 | [[switchCell switchControl] addTarget:self action:@selector(actionAbsoluteMaxXDimension:) forControlEvents:UIControlEventValueChanged]; 226 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMaxXDimension]]; 227 | [[switchCell textLabel] setText:@"Absolute x-dimension (max.)"]; 228 | } /* if */ 229 | break; 230 | case kRowSizesAbsoluteMaxYDimensionFlag: 231 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 232 | if (cell != nil) 233 | { 234 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 235 | 236 | [switchCell setTag:kTagAbsoluteMaxYDimension]; 237 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 238 | [[switchCell switchControl] addTarget:self action:@selector(actionAbsoluteMaxYDimension:) forControlEvents:UIControlEventValueChanged]; 239 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMaxYDimension]]; 240 | [[switchCell textLabel] setText:@"Absolute y-dimension (max.)"]; 241 | } /* if */ 242 | break; 243 | case kRowSizesAbsoluteMinXDimensionFlag: 244 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 245 | if (cell != nil) 246 | { 247 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 248 | 249 | [switchCell setTag:kTagAbsoluteMinXDimension]; 250 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 251 | [[switchCell switchControl] addTarget:self action:@selector(actionAbsoluteMinXDimension:) forControlEvents:UIControlEventValueChanged]; 252 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMinXDimension]]; 253 | [[switchCell textLabel] setText:@"Absolute x-dimension (min.)"]; 254 | } /* if */ 255 | break; 256 | case kRowSizesAbsoluteMinYDimensionFlag: 257 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 258 | if (cell != nil) 259 | { 260 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 261 | 262 | [switchCell setTag:kTagAbsoluteMinYDimension]; 263 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 264 | [[switchCell switchControl] addTarget:self action:@selector(actionAbsoluteMinYDimension:) forControlEvents:UIControlEventValueChanged]; 265 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeyAbsoluteMinYDimension]]; 266 | [[switchCell textLabel] setText:@"Absolute y-dimension (min.)"]; 267 | } /* if */ 268 | break; 269 | case kRowSizesMaxXDimensionValue: 270 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 271 | if (cell != nil) 272 | { 273 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 274 | 275 | UITextField* textFieldView = [textFieldCell textField]; 276 | 277 | [textFieldCell setTextLabelWidth:180.0]; 278 | [[textFieldCell textLabel] setText:@"Max. x-dimension"]; 279 | [textFieldView setDelegate:self]; 280 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 281 | [textFieldView setTag:kTagMaxXDimension]; 282 | [textFieldView setText:[NSString stringWithFormat:@"%.2f",[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMaxXDimension]]]; 283 | } /* if */ 284 | break; 285 | case kRowSizesMaxYDimensionValue: 286 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 287 | if (cell != nil) 288 | { 289 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 290 | 291 | UITextField* textFieldView = [textFieldCell textField]; 292 | 293 | [textFieldCell setTextLabelWidth:180.0]; 294 | [[textFieldCell textLabel] setText:@"Max. y-dimension"]; 295 | [textFieldView setDelegate:self]; 296 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 297 | [textFieldView setTag:kTagMaxYDimension]; 298 | [textFieldView setText:[NSString stringWithFormat:@"%.2f",[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMaxYDimension]]]; 299 | } /* if */ 300 | break; 301 | case kRowSizesMinXDimensionValue: 302 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 303 | if (cell != nil) 304 | { 305 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 306 | 307 | UITextField* textFieldView = [textFieldCell textField]; 308 | 309 | [textFieldCell setTextLabelWidth:180.0]; 310 | [[textFieldCell textLabel] setText:@"Min. x-dimension"]; 311 | [textFieldView setDelegate:self]; 312 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 313 | [textFieldView setTag:kTagMinXDimension]; 314 | [textFieldView setText:[NSString stringWithFormat:@"%.2f",[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMinXDimension]]]; 315 | } /* if */ 316 | break; 317 | case kRowSizesMinYDimensionValue: 318 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 319 | if (cell != nil) 320 | { 321 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 322 | 323 | UITextField* textFieldView = [textFieldCell textField]; 324 | 325 | [textFieldCell setTextLabelWidth:180.0]; 326 | [[textFieldCell textLabel] setText:@"Min. y-dimension"]; 327 | [textFieldView setDelegate:self]; 328 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 329 | [textFieldView setTag:kTagMinYDimension]; 330 | [textFieldView setText:[NSString stringWithFormat:@"%.2f",[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeyMinYDimension]]]; 331 | } /* if */ 332 | break; 333 | } /* switch */ 334 | break; 335 | case kSectionSnap: 336 | switch ([indexPath row]) 337 | { 338 | case kRowSnapFlag: 339 | cell = [SwitchTableViewCell cellForTable:tableView style:UITableViewCellStyleValue1 withIdentifier:kCellIDSwitch]; 340 | if (cell != nil) 341 | { 342 | SwitchTableViewCell* const switchCell = (SwitchTableViewCell*)cell; 343 | 344 | [switchCell setTag:kTagSnapFlag]; 345 | [[switchCell switchControl] removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged]; 346 | [[switchCell switchControl] addTarget:self action:@selector(actionSnapFlag:) forControlEvents:UIControlEventValueChanged]; 347 | [[switchCell switchControl] setOn:[[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsKeySnapToLimits]]; 348 | [[switchCell textLabel] setText:@"Snap to limits"]; 349 | } /* if */ 350 | break; 351 | case kRowSnapXLimit: 352 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 353 | if (cell != nil) 354 | { 355 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 356 | 357 | UITextField* textFieldView = [textFieldCell textField]; 358 | 359 | [textFieldCell setTextLabelWidth:180.0]; 360 | [[textFieldCell textLabel] setText:@"x-border"]; 361 | [textFieldView setDelegate:self]; 362 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 363 | [textFieldView setTag:kTagSnapXBorder]; 364 | [textFieldView setText:[NSString stringWithFormat:@"%.2f",[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeySnapXBorder]]]; 365 | } /* if */ 366 | break; 367 | case kRowSnapYLimit: 368 | cell = [TextFieldTableViewCell cellForTable:tableView withStyle:UITableViewCellStyleValue1 withIdentifier:kCellIDTextField]; 369 | if (cell != nil) 370 | { 371 | TextFieldTableViewCell* const textFieldCell = (TextFieldTableViewCell*)cell; 372 | 373 | UITextField* textFieldView = [textFieldCell textField]; 374 | 375 | [textFieldCell setTextLabelWidth:180.0]; 376 | [[textFieldCell textLabel] setText:@"y-border"]; 377 | [textFieldView setDelegate:self]; 378 | [textFieldView setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; 379 | [textFieldView setTag:kTagSnapYBorder]; 380 | [textFieldView setText:[NSString stringWithFormat:@"%.2f",[[NSUserDefaults standardUserDefaults] doubleForKey:kUserDefaultsKeySnapYBorder]]]; 381 | } /* if */ 382 | break; 383 | } /* switch */ 384 | } /* switch */ 385 | return cell; 386 | } 387 | 388 | -(NSInteger) tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section 389 | { 390 | switch (section) 391 | { 392 | case kSectionEffects: 393 | return 2; 394 | case kSectionGeneral: 395 | return 3; 396 | case kSectionSizes: 397 | return 8; 398 | case kSectionSnap: 399 | return 3; 400 | } /* switch */ 401 | return 0; 402 | } 403 | 404 | #pragma mark - UITableViewDelegate protocol 405 | -(NSIndexPath*) tableView:(UITableView*)tableView willSelectRowAtIndexPath:(NSIndexPath*)indexPath 406 | { 407 | return nil; 408 | } 409 | 410 | #pragma mark - UITextFieldDelegate protocol 411 | -(void) textFieldDidEndEditing:(UITextField*)textField 412 | { 413 | switch ([textField tag]) 414 | { 415 | case kTagDarkening: 416 | [[NSUserDefaults standardUserDefaults] setDouble:[[textField text] doubleValue] forKey:kUserDefaultsKeyDarkening]; 417 | break; 418 | case kTagMaxXDimension: 419 | [[NSUserDefaults standardUserDefaults] setDouble:[[textField text] doubleValue] forKey:kUserDefaultsKeyMaxXDimension]; 420 | break; 421 | case kTagMaxYDimension: 422 | [[NSUserDefaults standardUserDefaults] setDouble:[[textField text] doubleValue] forKey:kUserDefaultsKeyMaxYDimension]; 423 | break; 424 | case kTagMinXDimension: 425 | [[NSUserDefaults standardUserDefaults] setDouble:[[textField text] doubleValue] forKey:kUserDefaultsKeyMinXDimension]; 426 | break; 427 | case kTagMinYDimension: 428 | [[NSUserDefaults standardUserDefaults] setDouble:[[textField text] doubleValue] forKey:kUserDefaultsKeyMinYDimension]; 429 | break; 430 | case kTagRelativePosition: 431 | if (([[textField text] integerValue] >= 1) && ([[textField text] integerValue] <= 15)) 432 | [[NSUserDefaults standardUserDefaults] setInteger:[[textField text] integerValue] forKey:kUserDefaultsKeyRelativePosition]; 433 | break; 434 | case kTagSnapXBorder: 435 | [[NSUserDefaults standardUserDefaults] setDouble:[[textField text] doubleValue] forKey:kUserDefaultsKeySnapXBorder]; 436 | break; 437 | case kTagSnapYBorder: 438 | [[NSUserDefaults standardUserDefaults] setDouble:[[textField text] doubleValue] forKey:kUserDefaultsKeySnapYBorder]; 439 | break; 440 | } /* switch */ 441 | } 442 | 443 | -(BOOL) textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string 444 | { 445 | switch ([textField tag]) 446 | { 447 | case kTagRelativePosition: 448 | return (([string length] == 0) || NSEqualRanges(NSMakeRange(0,[string length]),[string rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]])); 449 | } /* switch */ 450 | return YES; 451 | } 452 | 453 | #pragma mark - Private methods 454 | -(void) actionAbsoluteMaxXDimension:(UISwitch*)sender 455 | { 456 | [[NSUserDefaults standardUserDefaults] setBool:[sender isOn] forKey:kUserDefaultsKeyAbsoluteMaxXDimension]; 457 | } 458 | 459 | -(void) actionAbsoluteMaxYDimension:(UISwitch*)sender 460 | { 461 | [[NSUserDefaults standardUserDefaults] setBool:[sender isOn] forKey:kUserDefaultsKeyAbsoluteMaxYDimension]; 462 | } 463 | 464 | -(void) actionAbsoluteMinXDimension:(UISwitch*)sender 465 | { 466 | [[NSUserDefaults standardUserDefaults] setBool:[sender isOn] forKey:kUserDefaultsKeyAbsoluteMinXDimension]; 467 | } 468 | 469 | -(void) actionAbsoluteMinYDimension:(UISwitch*)sender 470 | { 471 | [[NSUserDefaults standardUserDefaults] setBool:[sender isOn] forKey:kUserDefaultsKeyAbsoluteMinYDimension]; 472 | } 473 | 474 | -(void) actionDone:(UIBarButtonItem*)sender 475 | { 476 | [[self tableView] endEditing:YES]; 477 | if ([self presentingViewController] != nil) 478 | [self dismissViewControllerAnimated:YES completion:nil]; 479 | } 480 | 481 | -(void) actionMove:(UISwitch*)sender 482 | { 483 | if ([sender isOn]) 484 | [[NSUserDefaults standardUserDefaults] setInteger:FSVSlidingStyleMove forKey:kUserDefaultsKeySlidingStyle]; 485 | else 486 | [[NSUserDefaults standardUserDefaults] setInteger:FSVSlidingStyleOverlay forKey:kUserDefaultsKeySlidingStyle]; 487 | } 488 | 489 | -(void) actionResize:(UISwitch*)sender 490 | { 491 | [[NSUserDefaults standardUserDefaults] setBool:[sender isOn] forKey:kUserDefaultsKeyResize]; 492 | } 493 | 494 | -(void) actionSnapFlag:(UISwitch*)sender 495 | { 496 | [[NSUserDefaults standardUserDefaults] setBool:[sender isOn] forKey:kUserDefaultsKeySnapToLimits]; 497 | } 498 | 499 | -(void) actionTapMinimization:(UISwitch*)sender 500 | { 501 | [[NSUserDefaults standardUserDefaults] setBool:[sender isOn] forKey:kUserDefaultsKeyTapMinimization]; 502 | } 503 | 504 | @end 505 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/SimpleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleViewController.h 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SimpleViewController : UIViewController 12 | 13 | /** @name Properties 14 | * @{ */ 15 | 16 | @property (nonatomic, strong) NSString* text; ///< Text being centered in the view 17 | @property (nonatomic, strong) UIColor* color; ///< Color for view's background 18 | 19 | /** @} */ 20 | /** @name Initialization and object allocation 21 | * @{ */ 22 | 23 | /// Initializer 24 | -(instancetype) initWithColor:(UIColor*)color text:(NSString*)text; 25 | 26 | /// Object alllocator 27 | +(SimpleViewController*) simpleViewControllerWithColor:(UIColor*)color text:(NSString*)text; 28 | 29 | /** @} */ 30 | @end 31 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/SimpleViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleViewController.m 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "SimpleViewController.h" 10 | 11 | @interface SimpleViewController () 12 | 13 | @end 14 | 15 | #pragma mark Implementation 16 | @implementation SimpleViewController 17 | @synthesize color=_color, text=_text; 18 | 19 | #pragma mark - Initialization, object allocation and deallocation 20 | -(instancetype) initWithColor:(UIColor*)color text:(NSString*)text 21 | { 22 | self = [super init]; 23 | if (self != nil) 24 | { 25 | _color = color; 26 | _text = text; 27 | } /* if */ 28 | return self ; 29 | } 30 | 31 | +(SimpleViewController*) simpleViewControllerWithColor:(UIColor*)color text:(NSString*)text 32 | { 33 | return [[SimpleViewController alloc] initWithColor:color text:text]; 34 | } 35 | 36 | #pragma mark - Methods inherited from UIViewController 37 | -(void) loadView 38 | { 39 | [super loadView]; 40 | 41 | // simple view controller sets the background's colour... 42 | [[self view] setBackgroundColor:[self color]]; 43 | // ...and places a text in the middle of the view 44 | UILabel* label = [UILabel new]; 45 | 46 | [label setTranslatesAutoresizingMaskIntoConstraints:NO]; 47 | [label setText:[self text]]; 48 | [[self view] addSubview:label]; 49 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:[self view] 50 | attribute:NSLayoutAttributeCenterX 51 | relatedBy:NSLayoutRelationEqual 52 | toItem:label 53 | attribute:NSLayoutAttributeCenterX 54 | multiplier:1.0 55 | constant:0.0]]; 56 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:[self view] 57 | attribute:NSLayoutAttributeCenterY 58 | relatedBy:NSLayoutRelationEqual 59 | toItem:label 60 | attribute:NSLayoutAttributeCenterY 61 | multiplier:1.0 62 | constant:0.0]]; 63 | 64 | } 65 | 66 | #pragma mark - Properties 67 | -(void) setColor:(UIColor*)color 68 | { 69 | _color = color; 70 | if ([self isViewLoaded]) 71 | [[self view] setBackgroundColor:_color]; 72 | } 73 | 74 | -(void) setText:(NSString*)text 75 | { 76 | _text = text; 77 | if ([self isViewLoaded]) 78 | [(UILabel*)[[[self view] subviews] firstObject] setText:_text]; 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/SwitchTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwitchTableViewCell.h 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 11.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SwitchTableViewCell : UITableViewCell 12 | 13 | /** @name Properties 14 | * @{ */ 15 | 16 | @property (nonatomic, readonly, retain) UISwitch* switchControl; 17 | 18 | /** @} */ 19 | /** @name Class methods 20 | * @{ */ 21 | 22 | /// Creates an autoreleased title-switch cell 23 | /** @remark This class method also reuses cells if possible. */ 24 | +(SwitchTableViewCell*) cellForTable:(UITableView*)tableView style:(UITableViewCellStyle)initStyle withIdentifier:(NSString*)identifier; 25 | 26 | /** @} */ 27 | @end 28 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/SwitchTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // SwitchTableViewCell.m 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 11.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "SwitchTableViewCell.h" 10 | 11 | #pragma mark Implementation 12 | @implementation SwitchTableViewCell 13 | @synthesize switchControl=_switchControl; 14 | 15 | #pragma mark - Initialization and deallocation 16 | -(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier 17 | { 18 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 19 | if (self != nil) 20 | { 21 | _switchControl = [UISwitch new]; 22 | [self setAccessoryView:_switchControl]; 23 | [self setSelectionStyle:UITableViewCellSelectionStyleNone]; 24 | } /* if */ 25 | return self; 26 | } 27 | 28 | #pragma mark Class methods 29 | +(SwitchTableViewCell*) cellForTable:(UITableView*)tableView style:(UITableViewCellStyle)initStyle withIdentifier:(NSString*)identifier 30 | { 31 | SwitchTableViewCell* cell = (SwitchTableViewCell*)[tableView dequeueReusableCellWithIdentifier:identifier]; 32 | 33 | 34 | if (cell == nil) 35 | cell = [[SwitchTableViewCell alloc] initWithStyle:initStyle reuseIdentifier:identifier]; 36 | return cell; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/TextFieldTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TextFieldTableViewCell.h 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 10.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TextFieldTableViewCell : UITableViewCell 12 | 13 | /** @name Properties 14 | * @{ */ 15 | 16 | @property (nonatomic, assign) CGFloat textLabelWidth; 17 | 18 | @property (nonatomic, readonly) UITableViewCellStyle style; 19 | 20 | @property (nonatomic, readonly, strong) UITextField* textField; 21 | 22 | /** @} */ 23 | /** @name Initialization and object allocation 24 | * @{ */ 25 | 26 | /// Object allocator 27 | +(TextFieldTableViewCell*) textFieldTableViewCellWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier; 28 | 29 | /** @} */ 30 | /** @name Class methods 31 | * @{ */ 32 | 33 | /// Returns either a buffered or newly created cell 34 | +(TextFieldTableViewCell*) cellForTable:(UITableView*)tableView withStyle:(UITableViewCellStyle)style withIdentifier:(NSString*)identifier; 35 | 36 | /** @} */ 37 | @end 38 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/TextFieldTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // TextFieldTableViewCell.m 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 10.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "TextFieldTableViewCell.h" 10 | 11 | #pragma mark Implementation 12 | @implementation TextFieldTableViewCell 13 | @synthesize style=_style, textField=_textField, textLabelWidth=_textLabelWidth; 14 | 15 | #pragma mark - Initialization and deallocation 16 | -(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier 17 | { 18 | if (style == UITableViewCellStyleSubtitle) 19 | style = UITableViewCellStyleDefault; 20 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 21 | if (self != nil) 22 | { 23 | _style = style; 24 | _textLabelWidth = 70.0f; 25 | _textField = [[UITextField alloc] init]; 26 | [_textField setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin]; 27 | [_textField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; 28 | switch (style) 29 | { 30 | case UITableViewCellStyleValue1: 31 | [_textField setFont:[UIFont systemFontOfSize:17.0f]]; 32 | [_textField setTextAlignment:NSTextAlignmentRight]; 33 | [_textField setTextColor:[UIColor colorWithRed:0.22f green:0.33f blue:0.53f alpha:1.0f]]; 34 | break; 35 | case UITableViewCellStyleValue2: 36 | [_textField setFont:[UIFont boldSystemFontOfSize:15.0f]]; 37 | [_textField setTextAlignment:NSTextAlignmentLeft]; 38 | [_textField setTextColor:[UIColor colorWithWhite:0.0f alpha:1.0f]]; 39 | break; 40 | default: 41 | [_textField setFont:[UIFont boldSystemFontOfSize:17.0f]]; 42 | [_textField setTextAlignment:NSTextAlignmentLeft]; 43 | [_textField setTextColor:[UIColor colorWithWhite:0.0f alpha:1.0f]]; 44 | } /* switch */ 45 | [[self contentView] addSubview:_textField]; 46 | [[self detailTextLabel] setHidden:YES]; 47 | if (_style == UITableViewCellStyleDefault) 48 | [[self textLabel] setHidden:YES]; 49 | } /* if */ 50 | return self; 51 | } 52 | 53 | +(TextFieldTableViewCell*) textFieldTableViewCellWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier 54 | { 55 | return [[TextFieldTableViewCell alloc] initWithStyle:style reuseIdentifier:reuseIdentifier]; 56 | } 57 | 58 | #pragma mark - Inherited methods from UIView 59 | -(void) layoutSubviews 60 | { 61 | [super layoutSubviews]; 62 | 63 | if ([self style] == UITableViewCellStyleDefault) 64 | { 65 | CGRect contentBounds = [[self contentView] bounds]; 66 | CGRect textFieldFrame; 67 | 68 | textFieldFrame = CGRectInset(contentBounds,10.0f,6.0f); 69 | [[self textField] setFrame:textFieldFrame]; 70 | } /* if */ 71 | else 72 | { 73 | CGRect contentBounds = [[self contentView] bounds]; 74 | CGRect labelFrame = [[self textLabel] frame]; 75 | CGRect textFieldFrame; 76 | 77 | 78 | // make sure that the label has the specified width 79 | labelFrame.size.width = _textLabelWidth; 80 | // the origin and width of the text field depends on the available remaining space (the label's frame remains untouched in this direction) 81 | textFieldFrame.origin.x = CGRectGetMaxX(labelFrame)+6.0f; // +6.0f originates from an unmodified cell of style UITableViewCellStyleValue2 82 | textFieldFrame.size.width = MAX(0.0f,contentBounds.size.width-textFieldFrame.origin.x-10.0f); // -10.0f originates from an unmodified cell 83 | // the origin of the text field depends on the font's size; in case the font size of the text field is larger or equal to the one of the label 84 | // the text field is centered and the baseline of the label is put to the same value as the textfield, if the label's font size is larger than the label 85 | // is centered first and the text field is aligned afterwards; 86 | // the text field's height is determined by the required space for the text (so, it depends on the font size) 87 | textFieldFrame.size.height = [[[self textField] font] lineHeight]; 88 | if ([[[self textField] font] pointSize] >= [[[self textLabel] font] pointSize]) 89 | { 90 | textFieldFrame.origin.y = 0.5f*(contentBounds.size.height-[[[self textField] font] lineHeight]); 91 | // the origin of the label is the baseline of the text field minus the ascender of the label 92 | labelFrame.origin.y = textFieldFrame.origin.y+[[[self textField] font] ascender]-[[[self textLabel] font] ascender]; 93 | } /* if */ 94 | else 95 | { 96 | labelFrame.origin.y = 0.5f*(contentBounds.size.height-labelFrame.size.height); 97 | // the origin of the text field is the baseline of the label minus the ascender of the text field (as the ascender and line height are given in points and not pixels 98 | // a unit conversion has to take place; here line height is assumed to be equal to the frame's height) 99 | textFieldFrame.origin.y = labelFrame.origin.y+[[[self textLabel] font] ascender]-[[[self textField] font] ascender]; 100 | } /* if */ 101 | [[self textLabel] setFrame:labelFrame]; 102 | [[self textField] setFrame:textFieldFrame]; 103 | } /* if */ 104 | } 105 | 106 | #pragma mark - Class methods 107 | +(TextFieldTableViewCell*) cellForTable:(UITableView*)tableView withStyle:(UITableViewCellStyle)style withIdentifier:(NSString*)identifier 108 | { 109 | id cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 110 | 111 | 112 | if (cell == nil) 113 | cell = [TextFieldTableViewCell textFieldTableViewCellWithStyle:style reuseIdentifier:identifier]; 114 | return cell; 115 | } 116 | 117 | #pragma mark - Properties 118 | -(void) setTextLabelWidth:(CGFloat)textLabelWidth 119 | { 120 | _textLabelWidth = textLabelWidth; 121 | [self setNeedsLayout]; 122 | } 123 | 124 | @end 125 | -------------------------------------------------------------------------------- /Demo/FlexibleSlidingViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FlexibleSlidingViewControllerDemo 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char* argv[]) 14 | { 15 | @autoreleasepool 16 | { 17 | return UIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegate class])); 18 | } /* @autoreleasepool */ 19 | } 20 | -------------------------------------------------------------------------------- /FSV Demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hwiesmann/FlexSlidingView/4adeb4f1b5d61c36e6136f4c50d8f232bf2548f2/FSV Demo.gif -------------------------------------------------------------------------------- /FSV Demo.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hwiesmann/FlexSlidingView/4adeb4f1b5d61c36e6136f4c50d8f232bf2548f2/FSV Demo.mov -------------------------------------------------------------------------------- /FlexibleSlidingView.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Hartwig Wiesmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3A031D201B7F1FE400B8DDF0 /* FSVContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D161B7F1FE400B8DDF0 /* FSVContainerViewController.m */; }; 11 | 3A031D211B7F1FE400B8DDF0 /* FSVDimension.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D181B7F1FE400B8DDF0 /* FSVDimension.m */; }; 12 | 3A031D221B7F1FE400B8DDF0 /* FSVSandwichView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A031D1B1B7F1FE400B8DDF0 /* FSVSandwichView.m */; }; 13 | 3A2F3F3A1B753FB300FF3FE9 /* libFlexibleSlidingView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A2F3F2E1B753FB300FF3FE9 /* libFlexibleSlidingView.a */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXContainerItemProxy section */ 17 | 3A2F3F3B1B753FB300FF3FE9 /* PBXContainerItemProxy */ = { 18 | isa = PBXContainerItemProxy; 19 | containerPortal = 3A2F3F261B753FB300FF3FE9 /* Project object */; 20 | proxyType = 1; 21 | remoteGlobalIDString = 3A2F3F2D1B753FB300FF3FE9; 22 | remoteInfo = SWSlidingViewController; 23 | }; 24 | /* End PBXContainerItemProxy section */ 25 | 26 | /* Begin PBXCopyFilesBuildPhase section */ 27 | 3A2F3F2C1B753FB300FF3FE9 /* CopyFiles */ = { 28 | isa = PBXCopyFilesBuildPhase; 29 | buildActionMask = 2147483647; 30 | dstPath = "include/$(PRODUCT_NAME)"; 31 | dstSubfolderSpec = 16; 32 | files = ( 33 | ); 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 3A031D151B7F1FE400B8DDF0 /* FSVContainerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSVContainerViewController.h; sourceTree = ""; }; 40 | 3A031D161B7F1FE400B8DDF0 /* FSVContainerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSVContainerViewController.m; sourceTree = ""; }; 41 | 3A031D171B7F1FE400B8DDF0 /* FSVDimension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSVDimension.h; sourceTree = ""; }; 42 | 3A031D181B7F1FE400B8DDF0 /* FSVDimension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSVDimension.m; sourceTree = ""; }; 43 | 3A031D191B7F1FE400B8DDF0 /* FSVRelativePositioning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSVRelativePositioning.h; sourceTree = ""; }; 44 | 3A031D1A1B7F1FE400B8DDF0 /* FSVSandwichView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSVSandwichView.h; sourceTree = ""; }; 45 | 3A031D1B1B7F1FE400B8DDF0 /* FSVSandwichView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSVSandwichView.m; sourceTree = ""; }; 46 | 3A031D1C1B7F1FE400B8DDF0 /* FSVSlidingStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSVSlidingStyle.h; sourceTree = ""; }; 47 | 3A031D1D1B7F1FE400B8DDF0 /* FSVSlidingViewState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSVSlidingViewState.h; sourceTree = ""; }; 48 | 3A031D261B7F22F300B8DDF0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = FlexibleSlidingViewTests/Info.plist; sourceTree = SOURCE_ROOT; }; 49 | 3A2F3F2E1B753FB300FF3FE9 /* libFlexibleSlidingView.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFlexibleSlidingView.a; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 3A2F3F391B753FB300FF3FE9 /* FlexibleSlidingViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FlexibleSlidingViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 3A2F3F2B1B753FB300FF3FE9 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | 3A2F3F361B753FB300FF3FE9 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 3A2F3F3A1B753FB300FF3FE9 /* libFlexibleSlidingView.a in Frameworks */, 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | /* End PBXFrameworksBuildPhase section */ 70 | 71 | /* Begin PBXGroup section */ 72 | 3A031D141B7F1FE400B8DDF0 /* FlexibleSlidingView */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 3A031D241B7F200600B8DDF0 /* Private */, 76 | 3A031D231B7F1FFF00B8DDF0 /* Public */, 77 | ); 78 | path = FlexibleSlidingView; 79 | sourceTree = ""; 80 | }; 81 | 3A031D1E1B7F1FE400B8DDF0 /* FlexibleSlidingViewTests */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | ); 85 | path = FlexibleSlidingViewTests; 86 | sourceTree = ""; 87 | }; 88 | 3A031D231B7F1FFF00B8DDF0 /* Public */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 3A031D151B7F1FE400B8DDF0 /* FSVContainerViewController.h */, 92 | 3A031D161B7F1FE400B8DDF0 /* FSVContainerViewController.m */, 93 | 3A031D171B7F1FE400B8DDF0 /* FSVDimension.h */, 94 | 3A031D181B7F1FE400B8DDF0 /* FSVDimension.m */, 95 | 3A031D191B7F1FE400B8DDF0 /* FSVRelativePositioning.h */, 96 | 3A031D1C1B7F1FE400B8DDF0 /* FSVSlidingStyle.h */, 97 | 3A031D1D1B7F1FE400B8DDF0 /* FSVSlidingViewState.h */, 98 | ); 99 | name = Public; 100 | sourceTree = ""; 101 | }; 102 | 3A031D241B7F200600B8DDF0 /* Private */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 3A031D1A1B7F1FE400B8DDF0 /* FSVSandwichView.h */, 106 | 3A031D1B1B7F1FE400B8DDF0 /* FSVSandwichView.m */, 107 | ); 108 | name = Private; 109 | sourceTree = ""; 110 | }; 111 | 3A2F3F251B753FB300FF3FE9 = { 112 | isa = PBXGroup; 113 | children = ( 114 | 3A031D141B7F1FE400B8DDF0 /* FlexibleSlidingView */, 115 | 3A031D1E1B7F1FE400B8DDF0 /* FlexibleSlidingViewTests */, 116 | 3A2F3F3D1B753FB300FF3FE9 /* FSWTests */, 117 | 3A2F3F2F1B753FB300FF3FE9 /* Products */, 118 | ); 119 | sourceTree = ""; 120 | }; 121 | 3A2F3F2F1B753FB300FF3FE9 /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 3A2F3F2E1B753FB300FF3FE9 /* libFlexibleSlidingView.a */, 125 | 3A2F3F391B753FB300FF3FE9 /* FlexibleSlidingViewTests.xctest */, 126 | ); 127 | name = Products; 128 | sourceTree = ""; 129 | }; 130 | 3A2F3F3D1B753FB300FF3FE9 /* FSWTests */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 3A2F3F3E1B753FB300FF3FE9 /* Supporting Files */, 134 | ); 135 | name = FSWTests; 136 | path = SWSlidingViewControllerTests; 137 | sourceTree = ""; 138 | }; 139 | 3A2F3F3E1B753FB300FF3FE9 /* Supporting Files */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 3A031D261B7F22F300B8DDF0 /* Info.plist */, 143 | ); 144 | name = "Supporting Files"; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 3A2F3F2D1B753FB300FF3FE9 /* FlexibleSlidingView */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 3A2F3F421B753FB300FF3FE9 /* Build configuration list for PBXNativeTarget "FlexibleSlidingView" */; 153 | buildPhases = ( 154 | 3A2F3F2A1B753FB300FF3FE9 /* Sources */, 155 | 3A2F3F2B1B753FB300FF3FE9 /* Frameworks */, 156 | 3A2F3F2C1B753FB300FF3FE9 /* CopyFiles */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | ); 162 | name = FlexibleSlidingView; 163 | productName = SWSlidingViewController; 164 | productReference = 3A2F3F2E1B753FB300FF3FE9 /* libFlexibleSlidingView.a */; 165 | productType = "com.apple.product-type.library.static"; 166 | }; 167 | 3A2F3F381B753FB300FF3FE9 /* FlexibleSlidingViewTests */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = 3A2F3F451B753FB300FF3FE9 /* Build configuration list for PBXNativeTarget "FlexibleSlidingViewTests" */; 170 | buildPhases = ( 171 | 3A2F3F351B753FB300FF3FE9 /* Sources */, 172 | 3A2F3F361B753FB300FF3FE9 /* Frameworks */, 173 | 3A2F3F371B753FB300FF3FE9 /* Resources */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | 3A2F3F3C1B753FB300FF3FE9 /* PBXTargetDependency */, 179 | ); 180 | name = FlexibleSlidingViewTests; 181 | productName = SWSlidingViewControllerTests; 182 | productReference = 3A2F3F391B753FB300FF3FE9 /* FlexibleSlidingViewTests.xctest */; 183 | productType = "com.apple.product-type.bundle.unit-test"; 184 | }; 185 | /* End PBXNativeTarget section */ 186 | 187 | /* Begin PBXProject section */ 188 | 3A2F3F261B753FB300FF3FE9 /* Project object */ = { 189 | isa = PBXProject; 190 | attributes = { 191 | CLASSPREFIX = SW; 192 | LastUpgradeCheck = 0640; 193 | ORGANIZATIONNAME = skywind; 194 | TargetAttributes = { 195 | 3A2F3F2D1B753FB300FF3FE9 = { 196 | CreatedOnToolsVersion = 6.4; 197 | }; 198 | 3A2F3F381B753FB300FF3FE9 = { 199 | CreatedOnToolsVersion = 6.4; 200 | }; 201 | }; 202 | }; 203 | buildConfigurationList = 3A2F3F291B753FB300FF3FE9 /* Build configuration list for PBXProject "FlexibleSlidingView" */; 204 | compatibilityVersion = "Xcode 3.2"; 205 | developmentRegion = English; 206 | hasScannedForEncodings = 0; 207 | knownRegions = ( 208 | en, 209 | ); 210 | mainGroup = 3A2F3F251B753FB300FF3FE9; 211 | productRefGroup = 3A2F3F2F1B753FB300FF3FE9 /* Products */; 212 | projectDirPath = ""; 213 | projectRoot = ""; 214 | targets = ( 215 | 3A2F3F2D1B753FB300FF3FE9 /* FlexibleSlidingView */, 216 | 3A2F3F381B753FB300FF3FE9 /* FlexibleSlidingViewTests */, 217 | ); 218 | }; 219 | /* End PBXProject section */ 220 | 221 | /* Begin PBXResourcesBuildPhase section */ 222 | 3A2F3F371B753FB300FF3FE9 /* Resources */ = { 223 | isa = PBXResourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | /* End PBXResourcesBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 3A2F3F2A1B753FB300FF3FE9 /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 3A031D211B7F1FE400B8DDF0 /* FSVDimension.m in Sources */, 237 | 3A031D221B7F1FE400B8DDF0 /* FSVSandwichView.m in Sources */, 238 | 3A031D201B7F1FE400B8DDF0 /* FSVContainerViewController.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | 3A2F3F351B753FB300FF3FE9 /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | /* End PBXSourcesBuildPhase section */ 250 | 251 | /* Begin PBXTargetDependency section */ 252 | 3A2F3F3C1B753FB300FF3FE9 /* PBXTargetDependency */ = { 253 | isa = PBXTargetDependency; 254 | target = 3A2F3F2D1B753FB300FF3FE9 /* FlexibleSlidingView */; 255 | targetProxy = 3A2F3F3B1B753FB300FF3FE9 /* PBXContainerItemProxy */; 256 | }; 257 | /* End PBXTargetDependency section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 3A2F3F401B753FB300FF3FE9 /* Debug */ = { 261 | isa = XCBuildConfiguration; 262 | buildSettings = { 263 | ALWAYS_SEARCH_USER_PATHS = NO; 264 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 265 | CLANG_CXX_LIBRARY = "libc++"; 266 | CLANG_ENABLE_MODULES = YES; 267 | CLANG_ENABLE_OBJC_ARC = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_EMPTY_BODY = YES; 272 | CLANG_WARN_ENUM_CONVERSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; 275 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 276 | CLANG_WARN_UNREACHABLE_CODE = YES; 277 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 278 | COPY_PHASE_STRIP = NO; 279 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 280 | ENABLE_STRICT_OBJC_MSGSEND = YES; 281 | GCC_C_LANGUAGE_STANDARD = gnu99; 282 | GCC_DYNAMIC_NO_PIC = NO; 283 | GCC_NO_COMMON_BLOCKS = YES; 284 | GCC_OPTIMIZATION_LEVEL = 0; 285 | GCC_PREPROCESSOR_DEFINITIONS = ( 286 | "DEBUG=1", 287 | "$(inherited)", 288 | ); 289 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_MISSING_PARENTHESES = NO; 293 | GCC_WARN_UNDECLARED_SELECTOR = YES; 294 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 295 | GCC_WARN_UNUSED_FUNCTION = YES; 296 | GCC_WARN_UNUSED_VARIABLE = YES; 297 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 298 | MTL_ENABLE_DEBUG_INFO = YES; 299 | ONLY_ACTIVE_ARCH = YES; 300 | SDKROOT = iphoneos; 301 | USER_HEADER_SEARCH_PATHS = .; 302 | }; 303 | name = Debug; 304 | }; 305 | 3A2F3F411B753FB300FF3FE9 /* Release */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 310 | CLANG_CXX_LIBRARY = "libc++"; 311 | CLANG_ENABLE_MODULES = YES; 312 | CLANG_ENABLE_OBJC_ARC = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INT_CONVERSION = YES; 319 | CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; 320 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 321 | CLANG_WARN_UNREACHABLE_CODE = YES; 322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 323 | COPY_PHASE_STRIP = NO; 324 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 325 | ENABLE_NS_ASSERTIONS = NO; 326 | ENABLE_STRICT_OBJC_MSGSEND = YES; 327 | GCC_C_LANGUAGE_STANDARD = gnu99; 328 | GCC_NO_COMMON_BLOCKS = YES; 329 | GCC_OPTIMIZATION_LEVEL = 3; 330 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 331 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 332 | GCC_WARN_MISSING_PARENTHESES = NO; 333 | GCC_WARN_UNDECLARED_SELECTOR = YES; 334 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 335 | GCC_WARN_UNUSED_FUNCTION = YES; 336 | GCC_WARN_UNUSED_VARIABLE = YES; 337 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 338 | MTL_ENABLE_DEBUG_INFO = NO; 339 | SDKROOT = iphoneos; 340 | USER_HEADER_SEARCH_PATHS = .; 341 | VALIDATE_PRODUCT = YES; 342 | }; 343 | name = Release; 344 | }; 345 | 3A2F3F431B753FB300FF3FE9 /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | OTHER_LDFLAGS = "-ObjC"; 349 | PRODUCT_NAME = FlexibleSlidingView; 350 | SKIP_INSTALL = YES; 351 | }; 352 | name = Debug; 353 | }; 354 | 3A2F3F441B753FB300FF3FE9 /* Release */ = { 355 | isa = XCBuildConfiguration; 356 | buildSettings = { 357 | OTHER_LDFLAGS = "-ObjC"; 358 | PRODUCT_NAME = FlexibleSlidingView; 359 | SKIP_INSTALL = YES; 360 | }; 361 | name = Release; 362 | }; 363 | 3A2F3F461B753FB300FF3FE9 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 367 | FRAMEWORK_SEARCH_PATHS = ( 368 | "$(SDKROOT)/Developer/Library/Frameworks", 369 | "$(inherited)", 370 | ); 371 | GCC_PREPROCESSOR_DEFINITIONS = ( 372 | "DEBUG=1", 373 | "$(inherited)", 374 | ); 375 | INFOPLIST_FILE = FlexibleSlidingViewTests/Info.plist; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 377 | PRODUCT_NAME = FlexibleSlidingViewTests; 378 | }; 379 | name = Debug; 380 | }; 381 | 3A2F3F471B753FB300FF3FE9 /* Release */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 385 | FRAMEWORK_SEARCH_PATHS = ( 386 | "$(SDKROOT)/Developer/Library/Frameworks", 387 | "$(inherited)", 388 | ); 389 | INFOPLIST_FILE = FlexibleSlidingViewTests/Info.plist; 390 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 391 | PRODUCT_NAME = FlexibleSlidingViewTests; 392 | }; 393 | name = Release; 394 | }; 395 | 3A2F3F481B7541D500FF3FE9 /* AdHocDistribution */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ALWAYS_SEARCH_USER_PATHS = NO; 399 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 400 | CLANG_CXX_LIBRARY = "libc++"; 401 | CLANG_ENABLE_MODULES = YES; 402 | CLANG_ENABLE_OBJC_ARC = YES; 403 | CLANG_WARN_BOOL_CONVERSION = YES; 404 | CLANG_WARN_CONSTANT_CONVERSION = YES; 405 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | COPY_PHASE_STRIP = NO; 414 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 415 | ENABLE_NS_ASSERTIONS = NO; 416 | ENABLE_STRICT_OBJC_MSGSEND = YES; 417 | GCC_C_LANGUAGE_STANDARD = gnu99; 418 | GCC_NO_COMMON_BLOCKS = YES; 419 | GCC_OPTIMIZATION_LEVEL = 3; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_MISSING_PARENTHESES = NO; 423 | GCC_WARN_UNDECLARED_SELECTOR = YES; 424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 425 | GCC_WARN_UNUSED_FUNCTION = YES; 426 | GCC_WARN_UNUSED_VARIABLE = YES; 427 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 428 | MTL_ENABLE_DEBUG_INFO = NO; 429 | SDKROOT = iphoneos; 430 | USER_HEADER_SEARCH_PATHS = .; 431 | VALIDATE_PRODUCT = YES; 432 | }; 433 | name = AdHocDistribution; 434 | }; 435 | 3A2F3F491B7541D500FF3FE9 /* AdHocDistribution */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | OTHER_LDFLAGS = "-ObjC"; 439 | PRODUCT_NAME = FlexibleSlidingView; 440 | SKIP_INSTALL = YES; 441 | }; 442 | name = AdHocDistribution; 443 | }; 444 | 3A2F3F4A1B7541D500FF3FE9 /* AdHocDistribution */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 448 | FRAMEWORK_SEARCH_PATHS = ( 449 | "$(SDKROOT)/Developer/Library/Frameworks", 450 | "$(inherited)", 451 | ); 452 | INFOPLIST_FILE = FlexibleSlidingViewTests/Info.plist; 453 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 454 | PRODUCT_NAME = FlexibleSlidingViewTests; 455 | }; 456 | name = AdHocDistribution; 457 | }; 458 | 3A2F3F9C1B75423000FF3FE9 /* Distribution */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | ALWAYS_SEARCH_USER_PATHS = NO; 462 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 463 | CLANG_CXX_LIBRARY = "libc++"; 464 | CLANG_ENABLE_MODULES = YES; 465 | CLANG_ENABLE_OBJC_ARC = YES; 466 | CLANG_WARN_BOOL_CONVERSION = YES; 467 | CLANG_WARN_CONSTANT_CONVERSION = YES; 468 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 469 | CLANG_WARN_EMPTY_BODY = YES; 470 | CLANG_WARN_ENUM_CONVERSION = YES; 471 | CLANG_WARN_INT_CONVERSION = YES; 472 | CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES; 473 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 474 | CLANG_WARN_UNREACHABLE_CODE = YES; 475 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 476 | COPY_PHASE_STRIP = NO; 477 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 478 | ENABLE_NS_ASSERTIONS = NO; 479 | ENABLE_STRICT_OBJC_MSGSEND = YES; 480 | GCC_C_LANGUAGE_STANDARD = gnu99; 481 | GCC_NO_COMMON_BLOCKS = YES; 482 | GCC_OPTIMIZATION_LEVEL = 3; 483 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 484 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 485 | GCC_WARN_MISSING_PARENTHESES = NO; 486 | GCC_WARN_UNDECLARED_SELECTOR = YES; 487 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 488 | GCC_WARN_UNUSED_FUNCTION = YES; 489 | GCC_WARN_UNUSED_VARIABLE = YES; 490 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 491 | MTL_ENABLE_DEBUG_INFO = NO; 492 | SDKROOT = iphoneos; 493 | USER_HEADER_SEARCH_PATHS = .; 494 | VALIDATE_PRODUCT = YES; 495 | }; 496 | name = Distribution; 497 | }; 498 | 3A2F3F9D1B75423000FF3FE9 /* Distribution */ = { 499 | isa = XCBuildConfiguration; 500 | buildSettings = { 501 | OTHER_LDFLAGS = "-ObjC"; 502 | PRODUCT_NAME = FlexibleSlidingView; 503 | SKIP_INSTALL = YES; 504 | }; 505 | name = Distribution; 506 | }; 507 | 3A2F3F9E1B75423000FF3FE9 /* Distribution */ = { 508 | isa = XCBuildConfiguration; 509 | buildSettings = { 510 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 511 | FRAMEWORK_SEARCH_PATHS = ( 512 | "$(SDKROOT)/Developer/Library/Frameworks", 513 | "$(inherited)", 514 | ); 515 | INFOPLIST_FILE = FlexibleSlidingViewTests/Info.plist; 516 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 517 | PRODUCT_NAME = FlexibleSlidingViewTests; 518 | }; 519 | name = Distribution; 520 | }; 521 | /* End XCBuildConfiguration section */ 522 | 523 | /* Begin XCConfigurationList section */ 524 | 3A2F3F291B753FB300FF3FE9 /* Build configuration list for PBXProject "FlexibleSlidingView" */ = { 525 | isa = XCConfigurationList; 526 | buildConfigurations = ( 527 | 3A2F3F401B753FB300FF3FE9 /* Debug */, 528 | 3A2F3F411B753FB300FF3FE9 /* Release */, 529 | 3A2F3F481B7541D500FF3FE9 /* AdHocDistribution */, 530 | 3A2F3F9C1B75423000FF3FE9 /* Distribution */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | defaultConfigurationName = Release; 534 | }; 535 | 3A2F3F421B753FB300FF3FE9 /* Build configuration list for PBXNativeTarget "FlexibleSlidingView" */ = { 536 | isa = XCConfigurationList; 537 | buildConfigurations = ( 538 | 3A2F3F431B753FB300FF3FE9 /* Debug */, 539 | 3A2F3F441B753FB300FF3FE9 /* Release */, 540 | 3A2F3F491B7541D500FF3FE9 /* AdHocDistribution */, 541 | 3A2F3F9D1B75423000FF3FE9 /* Distribution */, 542 | ); 543 | defaultConfigurationIsVisible = 0; 544 | defaultConfigurationName = Release; 545 | }; 546 | 3A2F3F451B753FB300FF3FE9 /* Build configuration list for PBXNativeTarget "FlexibleSlidingViewTests" */ = { 547 | isa = XCConfigurationList; 548 | buildConfigurations = ( 549 | 3A2F3F461B753FB300FF3FE9 /* Debug */, 550 | 3A2F3F471B753FB300FF3FE9 /* Release */, 551 | 3A2F3F4A1B7541D500FF3FE9 /* AdHocDistribution */, 552 | 3A2F3F9E1B75423000FF3FE9 /* Distribution */, 553 | ); 554 | defaultConfigurationIsVisible = 0; 555 | defaultConfigurationName = Release; 556 | }; 557 | /* End XCConfigurationList section */ 558 | }; 559 | rootObject = 3A2F3F261B753FB300FF3FE9 /* Project object */; 560 | } 561 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVContainerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSVContainerViewController.h 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "FlexibleSlidingView/FSVSlidingStyle.h" 12 | 13 | @class FSVDimension; 14 | 15 | @interface FSVContainerViewController : UIViewController 16 | 17 | /** @name Properties 18 | * @{ */ 19 | 20 | @property (nonatomic, assign) BOOL allowDragging; ///< Flag indicating if dragging by the user of the sliding view is allowed; default setting is YES 21 | @property (nonatomic, assign) BOOL allowTapMinimization; ///< Flag indicating if a tap outside the sliding view leads to a minimization of the sliding view; default value is NO 22 | @property (nonatomic, assign) BOOL slidingResizes; ///< This flag indicates if sliding the view resizes or keeps the views' sizes; default setting is NO 23 | @property (nonatomic, assign) BOOL snapToLimits; ///< Flag indicating if the sliding view should move to its limits (min. or max. dimensions) when dragging stops; default setting is NO 24 | @property (nonatomic, assign) CGFloat darkening; ///< Value within [0; 1] that dims the main window when being in overlay mode and the sliding view has not its minimum dimension; default value is zero (no darkening) 25 | @property (nonatomic, assign) CGFloat xSnapBorder; ///< If the current sliding view's x-dimension is larger than xSnapBorder*maxAbsoluteXDimension+(1-xSnapBorder)*minAbsoluteXDimension the sliding view will snap to the maximum otherwise to the minimum x-limit; the default setting is 0.5 26 | @property (nonatomic, assign) CGFloat ySnapBorder; ///< If the current sliding view's y-dimension is larger than ySnapBorder*maxAbsoluteYDimension+(1-ySnapBorder)*minAbsoluteYDimension the sliding view will snap to the maximum otherwise to the minimum y-limit; the default setting is 0.5 27 | @property (nonatomic, assign) NSInteger slidingViewPositioning; ///< Position of the sliding view relative to the container's view 28 | @property (nonatomic, assign) NSTimeInterval animationDuration; ///< Duration of the maximization, minimization or snapping operation in seconds; default value is 0.25 29 | @property (nonatomic, assign) FSVSlidingStyle slidingStyle; ///< Sliding style; default value is FSVSlidingStyleMove 30 | 31 | @property (nonatomic, strong) FSVDimension* maxXDimension; ///< Maximum x-dimension of the sliding view relative to the container's view; default value is a relative dimension of 1.0 32 | @property (nonatomic, strong) FSVDimension* maxYDimension; ///< Maximum y-dimension of the sliding view relative to the container's view; default value is a relative dimension of 1.0 33 | @property (nonatomic, strong) FSVDimension* minXDimension; ///< Maximum x-dimension of the sliding view relative to the container's view; default value is a relative dimension of 0.0 34 | @property (nonatomic, strong) FSVDimension* minYDimension; ///< Maximum y-dimension of the sliding view relative to the container's view; default value is a relative dimension of 0.0 35 | @property (nonatomic, strong) UIViewController* mainViewController; ///< Main view controller 36 | @property (nonatomic, strong) UIViewController* slidingViewController; ///< View controller that can slide onto or that can push the main view controller 37 | 38 | /** @} */ 39 | /** @name View handling 40 | * @{ */ 41 | 42 | /// Returns the x-dimension of the sliding view 43 | /** @param absoluteDimension Flag indicating if an absolute or relative dimension should be returned. 44 | * @return The dimension of the sliding view is returned. 45 | * @note If the container view's width is zero a relative dimension should be returned a relative 46 | * dimension of zero is returned. */ 47 | -(FSVDimension*) xDimensionOfSlidingViewWithAbsoluteValue:(BOOL)absoluteDimension; 48 | /// Returns the y-dimension of the sliding view 49 | /** @param absoluteDimension Flag indicating if an absolute or relative dimension should be returned. 50 | * @return The dimension of the sliding view is returned. 51 | * @note If the container view's height is zero a relative dimension should be returned a relative 52 | * dimension of zero is returned. */ 53 | -(FSVDimension*) yDimensionOfSlidingViewWithAbsoluteValue:(BOOL)absoluteDimension; 54 | 55 | /// Maximizes the sliding view 56 | /** @param animated Flag indicating if the maximization is animated. The time for the animation is determined by animationDuration. */ 57 | -(void) maximizeSlidingViewAnimated:(BOOL)animated; 58 | 59 | /// Minimizes sliding view 60 | /** @param animated Flag indicating if the minimization is animated. The time for the animation is determined by animationDuration. */ 61 | -(void) minimizeSlidingViewAnimated:(BOOL)animated; 62 | 63 | /// Sets the dimensions of the sliding view 64 | /** @param x Dimension for x-coordinate. 65 | * @param y Dimension for y-coordinate. 66 | * @param animated Flag indicating if the setting has to be animated. The duration of the animation is determined by animationDuration. 67 | * @note The dimensions can only be freely set if snapToLimits contains the value NO. Otherwise, the sliding view will snap to its limits. */ 68 | -(void) setDimensionForX:(FSVDimension*)x y:(FSVDimension*)y animated:(BOOL)animated; 69 | 70 | /** @} */ 71 | @end 72 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVContainerViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSVContainerViewController.m 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "FlexibleSlidingView/FSVDimension.h" 10 | #import "FlexibleSlidingView/FSVRelativePositioning.h" 11 | #import "FlexibleSlidingView/FSVSandwichView.h" 12 | #import "FlexibleSlidingView/FSVContainerViewController.h" 13 | 14 | #pragma mark Class extensions 15 | @interface FSVContainerViewController () 16 | 17 | /** @name Private properties 18 | * @{ */ 19 | 20 | @property (nonatomic, strong) NSMutableArray* mainViewConstraints; ///< Contains the four constraints for the main view; the first are related to the x-, the last to the y-direction 21 | @property (nonatomic, strong) NSMutableArray* slidingViewConstraints; ///< Contains the four constraints for the sliding view; the first are related to the x-, the last to the y-direction 22 | @property (nonatomic, strong) NSMutableArray* stretchViewConstraints; ///< Contains the four constraints for the stretch view; the first are related to the x-, the last to the y-direction 23 | @property (nonatomic, strong) FSVSandwichView* sandwichView; ///< Sandwich view 24 | @property (nonatomic, strong) UIPanGestureRecognizer* draggingGestureRecognizer; ///< Gesture recognizer for dragging the sliding view 25 | @property (nonatomic, strong) UITapGestureRecognizer* minimizingGestureRecognizer; ///< Gesture recognizer for minimizing the sliding view when tapping outside the sliding view 26 | @property (nonatomic, strong) UIView* stretchView; ///< View only needed when relative positioning of the sliding view is specified; it is needed to simulate constraints of the view [slidingView] [view dimension]+multiplier*[view dimension]+constant 27 | 28 | /** @} */ 29 | /** @name Private methods 30 | * @{ */ 31 | 32 | /// Action handler 33 | -(void) actionDragging:(UIPanGestureRecognizer*)sender; 34 | /// Action handler 35 | -(void) actionTapping:(UITapGestureRecognizer*)sender; 36 | 37 | /// Cuts the links of the passed controller to another controller 38 | /** @param controller Controller whose links are to be cut. */ 39 | -(void) cutLinksForController:(UIViewController*)controller; 40 | 41 | /// Determines the maximum x-dimension of the stretch view as an absolute value 42 | -(CGFloat) determineAbsoluteMaxXDimension; 43 | /// Determines the maximum y-dimension of the stretch view as an absolute value 44 | -(CGFloat) determineAbsoluteMaxYDimension; 45 | /// Determines the minimum x-dimension of the stretch view as an absolute value 46 | -(CGFloat) determineAbsoluteMinXDimension; 47 | /// Determines the minimum y-dimension of the stretch view as an absolute value 48 | -(CGFloat) determineAbsoluteMinYDimension; 49 | /// Determines the x-dimension of the stretch view as an absolute value 50 | -(CGFloat) determineAbsoluteXDimension; 51 | /// Determines the y-dimension of the stretch view as an absolute value 52 | -(CGFloat) determineAbsoluteYDimension; 53 | 54 | /// Creates links for the controller itself and its view to the specified controller 55 | /** @param controller The controller (and its view) that is linked to the container controller. */ 56 | -(void) establishLinksForMainViewController:(UIViewController*)controller; 57 | /// Creates links for the controller itself and its view to the specified controller 58 | /** @param controller The controller (and its view) that is linked to the container controller. */ 59 | -(void) establishLinksForSlidingViewController:(UIViewController*)controller; 60 | 61 | /// Initializes the constraints for the main view 62 | -(void) initializeConstraintsForMainView; 63 | /// Initializes the constraints for the sliding view 64 | -(void) initializeConstraintsForSlidingView; 65 | /// Initializes the constraints for the stretch view 66 | -(void) initializeConstraintsForStretchView; 67 | 68 | /// Sets up constraints for stretch slider when minimum x-dimension settings changed 69 | /** @param dimension New x-position's value. 70 | * @param absoluteValue Flag indicating if the passed x-position's value is an absolute or relative value. */ 71 | -(void) modifyStretchViewConstraintsForXDimension:(double)dimension absoluteValue:(BOOL)absoluteValue; 72 | /// Sets up constraints for stretch slider when minimum x-dimension settings changed 73 | /** @param dimension New y-position's value. 74 | * @param absoluteValue Flag indicating if the passed y-position's value is an absolute or relative value. */ 75 | -(void) modifyStretchViewConstraintsForYDimension:(double)dimension absoluteValue:(BOOL)absoluteValue; 76 | 77 | /// Sets up the darkening of the sandwich view 78 | /** This method darkens the sandwich view if 79 | * - a sliding view exists and 80 | * - one of the parameters is larger than its minimum absolute dimension. 81 | * @param absoluteXDimension Absolute x-dimension of the sliding view. 82 | * @param absoluteYDimension Absolute y-dimension of the sliding view. */ 83 | -(void) setUpDarkeningForAbsoluteXDimension:(CGFloat)absoluteXDimension absoluteYDimension:(CGFloat)absoluteYDimension; 84 | /// Sets up user interaction possibility for the sandwich view 85 | /** This method enables user interaction with the sandwich view if 86 | * - a sliding view exists and 87 | * - one of the parameters is larger than its minimum absolute dimension. 88 | * @param absoluteXDimension Absolute x-dimension of the sliding view. 89 | * @param absoluteYDimension Absolute y-dimension of the sliding view. */ 90 | -(void) setUpUserInteractionFeasibilityForAbsoluteXDimension:(CGFloat)absoluteXDimension absoluteYDimension:(CGFloat)absoluteYDimension; 91 | 92 | /** @} */ 93 | @end 94 | 95 | #pragma mark - Implementation 96 | @implementation FSVContainerViewController 97 | @synthesize allowDragging=_allowDragging, allowTapMinimization=_allowTapMinimization, darkening=_darkening, draggingGestureRecognizer=_draggingGestureRecognizer, 98 | mainViewConstraints=_mainViewConstraints, mainViewController=_mainViewController, 99 | maxXDimension=_maxXDimension, maxYDimension=_maxYDimension, minimizingGestureRecognizer=_minimizingGestureRecognizer, minXDimension=_minXDimension, minYDimension=_minYDimension, 100 | sandwichView=_sandwichView, slidingStyle=_slidingStyle, slidingViewConstraints=_slidingViewConstraints, slidingViewController=_slidingViewController, 101 | slidingViewPositioning=_slidingViewPositioning, slidingResizes=_slidingResizes, 102 | animationDuration=_animationDuration, snapToLimits=_snapToLimits, stretchView=_stretchView, stretchViewConstraints=_stretchViewConstraints, 103 | xSnapBorder=_xSnapBorder, ySnapBorder=_ySnapBorder; 104 | 105 | #pragma mark - Initialization, object allocation and deallocation 106 | -(instancetype) init 107 | { 108 | self = [super init]; 109 | if (self != nil) 110 | { 111 | _allowDragging = YES; 112 | _darkening = 0.0; 113 | _maxXDimension = [FSVDimension dimensionWithDimension:1.0 absoluteDimension:NO]; 114 | _maxYDimension = [FSVDimension dimensionWithDimension:1.0 absoluteDimension:NO]; 115 | _minXDimension = [FSVDimension dimensionWithDimension:0.0 absoluteDimension:NO]; 116 | _minYDimension = [FSVDimension dimensionWithDimension:0.0 absoluteDimension:NO]; 117 | _slidingViewPositioning = FSVRelativePositioningBottom; 118 | _animationDuration = 0.25; 119 | _xSnapBorder = 0.5; 120 | _ySnapBorder = 0.5; 121 | } /* if */ 122 | return self; 123 | } 124 | 125 | #pragma mark - Methods inhertied from UIViewController 126 | -(void) loadView 127 | { 128 | [super loadView]; 129 | 130 | [self setSandwichView:[FSVSandwichView new]]; 131 | [[self sandwichView] setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:[self darkening]]]; 132 | [[self sandwichView] setTranslatesAutoresizingMaskIntoConstraints:NO]; 133 | [[self sandwichView] setUserInteractionEnabled:NO]; 134 | if ([self allowTapMinimization]) 135 | { 136 | [self setMinimizingGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionTapping:)]]; 137 | [[self minimizingGestureRecognizer] setDelegate:self]; 138 | [[self sandwichView] addGestureRecognizer:[self minimizingGestureRecognizer]]; 139 | } /* if */ 140 | [[self view] addSubview:[self sandwichView]]; 141 | 142 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:[self view] 143 | attribute:NSLayoutAttributeCenterX 144 | relatedBy:NSLayoutRelationEqual 145 | toItem:[self sandwichView] 146 | attribute:NSLayoutAttributeCenterX 147 | multiplier:1.0 148 | constant:0.0]]; 149 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:[self view] 150 | attribute:NSLayoutAttributeCenterY 151 | relatedBy:NSLayoutRelationEqual 152 | toItem:[self sandwichView] 153 | attribute:NSLayoutAttributeCenterY 154 | multiplier:1.0 155 | constant:0.0]]; 156 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:[self view] 157 | attribute:NSLayoutAttributeHeight 158 | relatedBy:NSLayoutRelationEqual 159 | toItem:[self sandwichView] 160 | attribute:NSLayoutAttributeHeight 161 | multiplier:1.0 162 | constant:0.0]]; 163 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:[self view] 164 | attribute:NSLayoutAttributeWidth 165 | relatedBy:NSLayoutRelationEqual 166 | toItem:[self sandwichView] 167 | attribute:NSLayoutAttributeWidth 168 | multiplier:1.0 169 | constant:0.0]]; 170 | 171 | [self setStretchView:[UIView new]]; 172 | [[self stretchView] setBackgroundColor:[UIColor clearColor]]; 173 | [[self view] insertSubview:[self stretchView] atIndex:0]; 174 | [self initializeConstraintsForStretchView]; 175 | } 176 | 177 | #pragma mark - UIGestureRecognizerDelegate protocol 178 | -(BOOL) gestureRecognizerShouldBegin:(UIGestureRecognizer*)gestureRecognizer 179 | { 180 | if (gestureRecognizer == [self minimizingGestureRecognizer]) 181 | return (([self slidingViewController] != nil) && (([self determineAbsoluteXDimension] > [self determineAbsoluteMinXDimension]+0.5) || ([self determineAbsoluteYDimension] > [self determineAbsoluteMinYDimension]+0.5))); // +0.5: a rounding error and for high-res screens a max. pixel alignment difference (equal to 1/(2*)) have to be taken into account 182 | else 183 | return YES; 184 | } 185 | 186 | #pragma mark - Properties 187 | -(void) setAllowDragging:(BOOL)allowDragging 188 | { 189 | if (_allowDragging != allowDragging) 190 | { 191 | _allowDragging = allowDragging; 192 | if ([self slidingViewController] != nil) 193 | if (_allowDragging) 194 | { 195 | [self setDraggingGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(actionDragging:)]]; 196 | [[self draggingGestureRecognizer] setMaximumNumberOfTouches:1]; 197 | [[[self slidingViewController] view] addGestureRecognizer:[self draggingGestureRecognizer]]; 198 | } /* if */ 199 | else 200 | { 201 | [[[self slidingViewController] view] removeGestureRecognizer:[self draggingGestureRecognizer]]; 202 | [self setDraggingGestureRecognizer:nil]; 203 | } /* if */ 204 | } /* if */ 205 | } 206 | 207 | -(void) setAllowTapMinimization:(BOOL)allowTapMinimization 208 | { 209 | if (_allowTapMinimization != allowTapMinimization) 210 | { 211 | _allowTapMinimization = allowTapMinimization; 212 | if (_allowTapMinimization) 213 | { 214 | [self setMinimizingGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionTapping:)]]; 215 | [[self minimizingGestureRecognizer] setDelegate:self]; 216 | [[self sandwichView] addGestureRecognizer:[self minimizingGestureRecognizer]]; 217 | } /* if */ 218 | else 219 | { 220 | [[self sandwichView] removeGestureRecognizer:[self minimizingGestureRecognizer]]; 221 | [self setMinimizingGestureRecognizer:nil]; 222 | } /* if */ 223 | } /* if */ 224 | } 225 | 226 | -(void) setMainViewController:(UIViewController*)mainViewController 227 | { 228 | [self cutLinksForController:_mainViewController]; 229 | _mainViewController = mainViewController; 230 | [[_mainViewController view] setTranslatesAutoresizingMaskIntoConstraints:NO]; 231 | [self establishLinksForMainViewController:_mainViewController]; 232 | [self initializeConstraintsForMainView]; 233 | } 234 | 235 | -(void) setMaxXDimension:(FSVDimension*)maxXDimension 236 | { 237 | _maxXDimension = maxXDimension; 238 | if ([self determineAbsoluteXDimension] > [self determineAbsoluteMaxXDimension]) 239 | [self modifyStretchViewConstraintsForXDimension:[_maxXDimension dimension] absoluteValue:[_maxXDimension absoluteDimension]]; 240 | } 241 | 242 | -(void) setMaxYDimension:(FSVDimension*)maxYDimension 243 | { 244 | _maxYDimension = maxYDimension; 245 | if ([self determineAbsoluteYDimension] > [self determineAbsoluteMaxYDimension]) 246 | [self modifyStretchViewConstraintsForYDimension:[_maxYDimension dimension] absoluteValue:[_maxYDimension absoluteDimension]]; 247 | } 248 | 249 | -(void) setMinXDimension:(FSVDimension*)minXDimension 250 | { 251 | _minXDimension = minXDimension; 252 | if ([self determineAbsoluteXDimension] < [self determineAbsoluteMinXDimension]) 253 | [self modifyStretchViewConstraintsForXDimension:[_minXDimension dimension] absoluteValue:[_minXDimension absoluteDimension]]; 254 | [self setUpDarkeningForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 255 | [self setUpUserInteractionFeasibilityForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 256 | } 257 | 258 | -(void) setMinYDimension:(FSVDimension*)minYDimension 259 | { 260 | _minYDimension = minYDimension; 261 | if ([self determineAbsoluteYDimension] < [self determineAbsoluteMinYDimension]) 262 | [self modifyStretchViewConstraintsForYDimension:[_minYDimension dimension] absoluteValue:[_minYDimension absoluteDimension]]; 263 | [self setUpDarkeningForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 264 | [self setUpUserInteractionFeasibilityForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 265 | } 266 | 267 | -(void) setSlidingResizes:(BOOL)slidingResizes 268 | { 269 | if (_slidingResizes != slidingResizes) 270 | { 271 | _slidingResizes = slidingResizes; 272 | [self initializeConstraintsForMainView]; 273 | [self initializeConstraintsForSlidingView]; 274 | [self initializeConstraintsForStretchView]; 275 | [[self sandwichView] setBackgroundColor:[UIColor clearColor]]; 276 | } /* if */ 277 | } 278 | 279 | -(void) setSlidingStyle:(FSVSlidingStyle)slidingStyle 280 | { 281 | if (_slidingStyle != slidingStyle) 282 | { 283 | _slidingStyle = slidingStyle; 284 | [self initializeConstraintsForMainView]; 285 | [self initializeConstraintsForSlidingView]; 286 | [self initializeConstraintsForStretchView]; 287 | [[self sandwichView] setBackgroundColor:[UIColor clearColor]]; 288 | } /* if */ 289 | } 290 | 291 | -(void) setSlidingViewController:(UIViewController*)slidingViewController 292 | { 293 | [self cutLinksForController:_slidingViewController]; 294 | [[_slidingViewController view] removeGestureRecognizer:[self draggingGestureRecognizer]]; 295 | _slidingViewController = slidingViewController; 296 | [[_slidingViewController view] setTranslatesAutoresizingMaskIntoConstraints:NO]; 297 | if ([self allowDragging]) 298 | { 299 | [self setDraggingGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(actionDragging:)]]; 300 | [[self draggingGestureRecognizer] setMaximumNumberOfTouches:1]; 301 | [[_slidingViewController view] addGestureRecognizer:[self draggingGestureRecognizer]]; 302 | } /* if */ 303 | else 304 | [self setDraggingGestureRecognizer:nil]; 305 | [self establishLinksForSlidingViewController:_slidingViewController]; 306 | [self initializeConstraintsForSlidingView]; 307 | [[self sandwichView] setBackgroundColor:[UIColor clearColor]]; 308 | } 309 | 310 | -(void) setSlidingViewPositioning:(NSInteger)slidingViewPositioning 311 | { 312 | if (_slidingViewPositioning != slidingViewPositioning) 313 | { 314 | _slidingViewPositioning = slidingViewPositioning; 315 | [self initializeConstraintsForMainView]; 316 | [self initializeConstraintsForSlidingView]; 317 | [self initializeConstraintsForStretchView]; 318 | [[self sandwichView] setBackgroundColor:[UIColor clearColor]]; 319 | } /* if */ 320 | } 321 | 322 | #pragma mark - View handling 323 | -(FSVDimension*) xDimensionOfSlidingViewWithAbsoluteValue:(BOOL)absoluteDimension 324 | { 325 | // finalize all remaining layouting before setting dimensions (this is necessary to get the up-to-date absolute dimensions) 326 | [[self view] layoutIfNeeded]; 327 | /// returns the x-dimension of the sliding view 328 | if (absoluteDimension) 329 | return [FSVDimension dimensionWithDimension:[self determineAbsoluteXDimension] absoluteDimension:YES]; 330 | else if ([[self view] bounds].size.width == 0.0) 331 | return [FSVDimension dimensionWithDimension:0.0 absoluteDimension:NO]; 332 | else 333 | return [FSVDimension dimensionWithDimension:[self determineAbsoluteXDimension]/[[self view] bounds].size.width absoluteDimension:NO]; 334 | } 335 | 336 | -(FSVDimension*) yDimensionOfSlidingViewWithAbsoluteValue:(BOOL)absoluteDimension 337 | { 338 | // finalize all remaining layouting before setting dimensions (this is necessary to get the up-to-date absolute dimensions) 339 | [[self view] layoutIfNeeded]; 340 | /// returns the y-dimension of the sliding view 341 | if (absoluteDimension) 342 | return [FSVDimension dimensionWithDimension:[self determineAbsoluteYDimension] absoluteDimension:YES]; 343 | else if ([[self view] bounds].size.height == 0.0) 344 | return [FSVDimension dimensionWithDimension:0.0 absoluteDimension:NO]; 345 | else 346 | return [FSVDimension dimensionWithDimension:[self determineAbsoluteYDimension]/[[self view] bounds].size.height absoluteDimension:NO]; 347 | } 348 | 349 | -(void) maximizeSlidingViewAnimated:(BOOL)animated 350 | { 351 | // finalize all remaining layouting before setting dimensions (this is necessary to get the up-to-date absolute dimensions) 352 | [[self view] layoutIfNeeded]; 353 | // start setting the dimensions 354 | CGFloat const newAbsoluteXDimension = [self determineAbsoluteMaxXDimension]; 355 | CGFloat const newAbsoluteYDimension = [self determineAbsoluteMaxYDimension]; 356 | 357 | [self modifyStretchViewConstraintsForXDimension:newAbsoluteXDimension absoluteValue:YES]; 358 | [self modifyStretchViewConstraintsForYDimension:newAbsoluteYDimension absoluteValue:YES]; 359 | [UIView animateWithDuration:animated ? [self animationDuration] : 0.0 360 | animations: 361 | ^{ 362 | [[self view] layoutIfNeeded]; 363 | [self setUpDarkeningForAbsoluteXDimension:newAbsoluteXDimension absoluteYDimension:newAbsoluteYDimension]; 364 | [self setUpUserInteractionFeasibilityForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 365 | }]; 366 | } 367 | 368 | -(void) minimizeSlidingViewAnimated:(BOOL)animated 369 | { 370 | // finalize all remaining layouting before setting dimensions (this is necessary to get the up-to-date absolute dimensions) 371 | [[self view] layoutIfNeeded]; 372 | // start setting the dimensions 373 | CGFloat const newAbsoluteXDimension = [self determineAbsoluteMinXDimension]; 374 | CGFloat const newAbsoluteYDimension = [self determineAbsoluteMinYDimension]; 375 | 376 | [self modifyStretchViewConstraintsForXDimension:newAbsoluteXDimension absoluteValue:YES]; 377 | [self modifyStretchViewConstraintsForYDimension:newAbsoluteYDimension absoluteValue:YES]; 378 | [UIView animateWithDuration:animated ? [self animationDuration] : 0.0 379 | animations: 380 | ^{ 381 | [[self view] layoutIfNeeded]; 382 | [self setUpDarkeningForAbsoluteXDimension:newAbsoluteXDimension absoluteYDimension:newAbsoluteYDimension]; 383 | [self setUpUserInteractionFeasibilityForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 384 | }]; 385 | } 386 | 387 | -(void) setDimensionForX:(FSVDimension*)x y:(FSVDimension*)y animated:(BOOL)animated 388 | { 389 | // finalize all remaining layouting before setting dimensions (this is necessary to get the up-to-date absolute dimensions) 390 | [[self view] layoutIfNeeded]; 391 | // start setting the dimensions 392 | CGFloat const requestedAbsoluteXDimension = [x absoluteDimension] ? [x dimension] : [x dimension]*[[self view] bounds].size.width; 393 | CGFloat const requestedAbsoluteYDimension = [y absoluteDimension] ? [y dimension] : [y dimension]*[[self view] bounds].size.height; 394 | 395 | CGFloat newAbsoluteXDimension, newAbsoluteYDimension; 396 | 397 | if ([self snapToLimits]) 398 | { 399 | if (requestedAbsoluteXDimension > [self xSnapBorder]*[self determineAbsoluteMaxXDimension]+(1.0-[self xSnapBorder])*[self determineAbsoluteMinXDimension]) 400 | newAbsoluteXDimension = [self determineAbsoluteMaxXDimension]; 401 | else 402 | newAbsoluteXDimension = [self determineAbsoluteMinXDimension]; 403 | if (requestedAbsoluteYDimension > [self ySnapBorder]*[self determineAbsoluteMaxYDimension]+(1.0-[self ySnapBorder])*[self determineAbsoluteMinYDimension]) 404 | newAbsoluteYDimension = [self determineAbsoluteMaxYDimension]; 405 | else 406 | newAbsoluteYDimension = [self determineAbsoluteMinYDimension]; 407 | } /* if */ 408 | else 409 | { 410 | newAbsoluteXDimension = MAX([self determineAbsoluteMinXDimension],MIN([self determineAbsoluteMaxXDimension],requestedAbsoluteXDimension)); 411 | newAbsoluteYDimension = MAX([self determineAbsoluteMinYDimension],MIN([self determineAbsoluteMaxYDimension],requestedAbsoluteYDimension)); 412 | } /* if */ 413 | if (animated) 414 | [UIView animateWithDuration:[self animationDuration] 415 | animations: 416 | ^{ 417 | [[self view] layoutIfNeeded]; 418 | [self setUpDarkeningForAbsoluteXDimension:newAbsoluteXDimension absoluteYDimension:newAbsoluteYDimension]; 419 | [self setUpUserInteractionFeasibilityForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 420 | }]; 421 | } 422 | 423 | #pragma mark - Private methods 424 | -(void) actionDragging:(UIPanGestureRecognizer*)sender 425 | { 426 | static CGPoint beginDimension; // dimension of sliding view at the beginning of the dragging operation 427 | static CGPoint beginLocation; // location in container view's coordinates of the gesture at the beginning of the dragging operation 428 | 429 | 430 | if (sender == [self draggingGestureRecognizer]) 431 | { 432 | switch ([sender state]) 433 | { 434 | case UIGestureRecognizerStateBegan: 435 | beginDimension = CGPointMake([self determineAbsoluteXDimension],[self determineAbsoluteYDimension]); 436 | beginLocation = [sender locationInView:[self view]]; 437 | break; 438 | case UIGestureRecognizerStateCancelled: 439 | case UIGestureRecognizerStateEnded: 440 | if ([self snapToLimits]) 441 | { 442 | // make sure that all layouting has finished before animated new layouting starts 443 | [[self view] layoutIfNeeded]; 444 | // set constraints for new layout; the animated layouting is only done by calling on the topmost view layoutIfNeeded 445 | CGFloat newAbsoluteXDimension, newAbsoluteYDimension; 446 | 447 | if ([self determineAbsoluteXDimension] > [self xSnapBorder]*[self determineAbsoluteMaxXDimension]+(1.0-[self xSnapBorder])*[self determineAbsoluteMinXDimension]) 448 | newAbsoluteXDimension = [self determineAbsoluteMaxXDimension]; 449 | else 450 | newAbsoluteXDimension = [self determineAbsoluteMinXDimension]; 451 | if ([self determineAbsoluteYDimension] > [self ySnapBorder]*[self determineAbsoluteMaxYDimension]+(1.0-[self ySnapBorder])*[self determineAbsoluteMinYDimension]) 452 | newAbsoluteYDimension = [self determineAbsoluteMaxYDimension]; 453 | else 454 | newAbsoluteYDimension = [self determineAbsoluteMinYDimension]; 455 | [self modifyStretchViewConstraintsForXDimension:newAbsoluteXDimension absoluteValue:YES]; 456 | [self modifyStretchViewConstraintsForYDimension:newAbsoluteYDimension absoluteValue:YES]; 457 | [UIView animateWithDuration:[self animationDuration] 458 | animations: 459 | ^{ 460 | [[self view] layoutIfNeeded]; 461 | [self setUpDarkeningForAbsoluteXDimension:newAbsoluteXDimension absoluteYDimension:newAbsoluteYDimension]; 462 | [self setUpUserInteractionFeasibilityForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 463 | }]; 464 | } /* if */ 465 | break; 466 | case UIGestureRecognizerStateChanged: 467 | { 468 | CGPoint const location = [sender locationInView:[self view]]; 469 | 470 | CGFloat newAbsoluteXDimension, newAbsoluteYDimension; 471 | CGFloat xDimensionDifference, yDimensionDifference; 472 | 473 | if (([self slidingViewPositioning]&FSVRelativePositioningRight) != 0) 474 | xDimensionDifference = beginLocation.x-location.x; 475 | else if (([self slidingViewPositioning]&FSVRelativePositioningLeft) != 0) 476 | xDimensionDifference = location.x-beginLocation.x; 477 | else 478 | xDimensionDifference = 0.0; 479 | if (([self slidingViewPositioning]&FSVRelativePositioningBottom) != 0) 480 | yDimensionDifference = beginLocation.y-location.y; 481 | else if (([self slidingViewPositioning]&FSVRelativePositioningTop) != 0) 482 | yDimensionDifference = location.y-beginLocation.y; 483 | else 484 | yDimensionDifference = 0.0; 485 | newAbsoluteXDimension = MAX([self determineAbsoluteMinXDimension],MIN([self determineAbsoluteMaxXDimension],beginDimension.x+xDimensionDifference)); 486 | newAbsoluteYDimension = MAX([self determineAbsoluteMinYDimension],MIN([self determineAbsoluteMaxYDimension],beginDimension.y+yDimensionDifference)); 487 | [self modifyStretchViewConstraintsForXDimension:newAbsoluteXDimension absoluteValue:YES]; 488 | [self modifyStretchViewConstraintsForYDimension:newAbsoluteYDimension absoluteValue:YES]; 489 | [self setUpDarkeningForAbsoluteXDimension:newAbsoluteXDimension absoluteYDimension:newAbsoluteYDimension]; 490 | [self setUpUserInteractionFeasibilityForAbsoluteXDimension:[self determineAbsoluteXDimension] absoluteYDimension:[self determineAbsoluteYDimension]]; 491 | } /* block */ 492 | break; 493 | default: 494 | break; 495 | } /* switch */ 496 | } /* if */ 497 | } 498 | 499 | -(void) actionTapping:(UITapGestureRecognizer*)sender 500 | { 501 | if (sender == [self minimizingGestureRecognizer]) 502 | if ([sender state] == UIGestureRecognizerStateEnded) 503 | [self minimizeSlidingViewAnimated:YES]; 504 | } 505 | 506 | -(void) cutLinksForController:(UIViewController*)controller 507 | { 508 | if (controller != nil) 509 | { 510 | if ([self isViewLoaded]) 511 | [[controller view] removeFromSuperview]; 512 | [controller removeFromParentViewController]; 513 | } /* if */ 514 | } 515 | 516 | -(CGFloat) determineAbsoluteMaxXDimension 517 | { 518 | if ([[self maxXDimension] absoluteDimension]) 519 | return [[self maxXDimension] dimension]; 520 | else if (([self slidingViewPositioning]&(FSVRelativePositioningRight | FSVRelativePositioningLeft)) != 0) 521 | return [[self maxXDimension] dimension]*[[self view] bounds].size.width; 522 | else 523 | return [[self view] bounds].size.width; 524 | } 525 | 526 | -(CGFloat) determineAbsoluteMaxYDimension 527 | { 528 | if ([[self maxYDimension] absoluteDimension]) 529 | return [[self maxYDimension] dimension]; 530 | else if (([self slidingViewPositioning]&(FSVRelativePositioningBottom | FSVRelativePositioningTop)) != 0) 531 | return [[self maxYDimension] dimension]*[[self view] bounds].size.height; 532 | else 533 | return [[self view] bounds].size.height; 534 | } 535 | 536 | -(CGFloat) determineAbsoluteMinXDimension 537 | { 538 | if ([[self minXDimension] absoluteDimension]) 539 | return [[self minXDimension] dimension]; 540 | else if (([self slidingViewPositioning]&(FSVRelativePositioningRight | FSVRelativePositioningLeft)) != 0) 541 | return [[self minXDimension] dimension]*[[self view] bounds].size.width; 542 | else 543 | return [[self view] bounds].size.width; 544 | } 545 | 546 | -(CGFloat) determineAbsoluteMinYDimension 547 | { 548 | if ([[self minYDimension] absoluteDimension]) 549 | return [[self minYDimension] dimension]; 550 | else if (([self slidingViewPositioning]&(FSVRelativePositioningBottom | FSVRelativePositioningTop)) != 0) 551 | return [[self minYDimension] dimension]*[[self view] bounds].size.height; 552 | else 553 | return [[self view] bounds].size.height; 554 | } 555 | 556 | -(CGFloat) determineAbsoluteXDimension 557 | { 558 | if (([self slidingViewPositioning]&FSVRelativePositioningRight) != 0) 559 | return [[self view] bounds].size.width-[[self stretchView] bounds].size.width; 560 | else 561 | return [[self stretchView] bounds].size.width; 562 | } 563 | 564 | -(CGFloat) determineAbsoluteYDimension 565 | { 566 | if (([self slidingViewPositioning]&FSVRelativePositioningBottom) != 0) 567 | return [[self view] bounds].size.height-[[self stretchView] bounds].size.height; 568 | else 569 | return [[self stretchView] bounds].size.height; 570 | } 571 | 572 | -(void) establishLinksForMainViewController:(UIViewController*)controller 573 | { 574 | if (controller != nil) 575 | { 576 | [self addChildViewController:controller]; 577 | if ([controller view] != nil) 578 | [[self view] insertSubview:[controller view] belowSubview:[self sandwichView]]; 579 | } /* if */ 580 | } 581 | 582 | -(void) establishLinksForSlidingViewController:(UIViewController*)controller 583 | { 584 | if (controller != nil) 585 | { 586 | [self addChildViewController:controller]; 587 | if ([controller view] != nil) 588 | [[self view] insertSubview:[controller view] aboveSubview:[self sandwichView]]; 589 | } /* if */ 590 | } 591 | 592 | -(void) initializeConstraintsForMainView 593 | { 594 | UIView* const mainView = [[self mainViewController] view]; 595 | 596 | 597 | if (mainView != nil) 598 | { 599 | [mainView setTranslatesAutoresizingMaskIntoConstraints:NO]; 600 | [[self view] removeConstraints:[self mainViewConstraints]]; 601 | [self setMainViewConstraints:[NSMutableArray arrayWithCapacity:4]]; 602 | switch ([self slidingStyle]) 603 | { 604 | case FSVSlidingStyleMove: 605 | if ([self slidingResizes]) 606 | { 607 | if (HasSetRelativePositioning([self slidingViewPositioning],FSVRelativePositioningLeft)) 608 | { 609 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 610 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 611 | } /* if */ 612 | else 613 | { 614 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0]]; 615 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 616 | } /* if */ 617 | if (HasSetRelativePositioning([self slidingViewPositioning],FSVRelativePositioningTop)) 618 | { 619 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 620 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 621 | } /* if */ 622 | else 623 | { 624 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]]; 625 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 626 | } /* if */ 627 | } /* if */ 628 | else 629 | { 630 | if (HasSetRelativePositioning([self slidingViewPositioning],FSVRelativePositioningRight)) 631 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 632 | else if (HasSetRelativePositioning([self slidingViewPositioning],FSVRelativePositioningLeft)) 633 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 634 | else 635 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0]]; 636 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]]; 637 | if (HasSetRelativePositioning([self slidingViewPositioning],FSVRelativePositioningBottom)) 638 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 639 | else if (HasSetRelativePositioning([self slidingViewPositioning],FSVRelativePositioningTop)) 640 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 641 | else 642 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]]; 643 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0.0]]; 644 | } /* if */ 645 | break; 646 | case FSVSlidingStyleOverlay: 647 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView 648 | attribute:NSLayoutAttributeLeft 649 | relatedBy:NSLayoutRelationEqual 650 | toItem:[self view] 651 | attribute:NSLayoutAttributeLeft 652 | multiplier:1.0 653 | constant:0.0]]; 654 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView 655 | attribute:NSLayoutAttributeWidth 656 | relatedBy:NSLayoutRelationEqual 657 | toItem:[self view] 658 | attribute:NSLayoutAttributeWidth 659 | multiplier:1.0 660 | constant:0.0]]; 661 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView 662 | attribute:NSLayoutAttributeTop 663 | relatedBy:NSLayoutRelationEqual 664 | toItem:[self view] 665 | attribute:NSLayoutAttributeTop 666 | multiplier:1.0 667 | constant:0.0]]; 668 | [[self mainViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:mainView 669 | attribute:NSLayoutAttributeHeight 670 | relatedBy:NSLayoutRelationEqual 671 | toItem:[self view] 672 | attribute:NSLayoutAttributeHeight 673 | multiplier:1.0 674 | constant:0.0]]; 675 | break; 676 | default: 677 | @throw [NSException exceptionWithName:@"UnsupportedSwitchCase" reason:@"Unsupported switch case" userInfo:nil]; 678 | } /* switch */ 679 | [[self view] addConstraints:[self mainViewConstraints]]; 680 | [mainView layoutIfNeeded]; 681 | } /* if */ 682 | } 683 | 684 | -(void) initializeConstraintsForSlidingView 685 | { 686 | UIView* const slidingView = [[self slidingViewController] view]; 687 | 688 | 689 | if (slidingView != nil) 690 | { 691 | [slidingView setTranslatesAutoresizingMaskIntoConstraints:NO]; 692 | [[self view] removeConstraints:[self slidingViewConstraints]]; 693 | [self setSlidingViewConstraints:[NSMutableArray arrayWithCapacity:4]]; 694 | if (([self slidingViewPositioning]&FSVRelativePositioningRight) != 0) 695 | { 696 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 697 | if ([self slidingResizes]) 698 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 699 | else 700 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]]; 701 | } /* if */ 702 | else 703 | { 704 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeRight multiplier:1.0 constant:0.0]]; 705 | if ([self slidingResizes]) 706 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0]]; 707 | else 708 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]]; 709 | } /* if */ 710 | if (([self slidingViewPositioning]&FSVRelativePositioningBottom) != 0) 711 | { 712 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 713 | if ([self slidingResizes]) 714 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 715 | else 716 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0.0]]; 717 | } /* if */ 718 | else 719 | { 720 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0]]; 721 | if ([self slidingResizes]) 722 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:[self stretchView] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]]; 723 | else 724 | [[self slidingViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:slidingView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0.0]]; 725 | } /* if */ 726 | [[self view] addConstraints:[self slidingViewConstraints]]; 727 | [slidingView layoutIfNeeded]; 728 | } /* if */ 729 | } 730 | 731 | -(void) initializeConstraintsForStretchView 732 | { 733 | UIView* const stretchView = [self stretchView]; 734 | 735 | 736 | if (stretchView != nil) 737 | { 738 | [stretchView setTranslatesAutoresizingMaskIntoConstraints:NO]; 739 | [[self view] removeConstraints:[self stretchViewConstraints]]; 740 | [self setStretchViewConstraints:[NSMutableArray arrayWithCapacity:4]]; 741 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 742 | attribute:NSLayoutAttributeLeft 743 | relatedBy:NSLayoutRelationEqual 744 | toItem:[self view] 745 | attribute:NSLayoutAttributeLeft 746 | multiplier:1.0 747 | constant:0.0]]; 748 | if (([self slidingViewPositioning]&FSVRelativePositioningRight) != 0) 749 | if ([[self minXDimension] absoluteDimension]) 750 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 751 | attribute:NSLayoutAttributeWidth 752 | relatedBy:NSLayoutRelationEqual 753 | toItem:[self view] 754 | attribute:NSLayoutAttributeWidth 755 | multiplier:1.0 756 | constant:-[[self minXDimension] dimension]]]; 757 | else 758 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 759 | attribute:NSLayoutAttributeWidth 760 | relatedBy:NSLayoutRelationEqual 761 | toItem:[self view] 762 | attribute:NSLayoutAttributeWidth 763 | multiplier:1.0-[[self minXDimension] dimension] 764 | constant:0.0]]; 765 | else if (([self slidingViewPositioning]&FSVRelativePositioningLeft) != 0) 766 | if ([[self minXDimension] absoluteDimension]) 767 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 768 | attribute:NSLayoutAttributeWidth 769 | relatedBy:NSLayoutRelationEqual 770 | toItem:nil 771 | attribute:NSLayoutAttributeNotAnAttribute 772 | multiplier:0.0 773 | constant:[[self minXDimension] dimension]]]; 774 | else 775 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 776 | attribute:NSLayoutAttributeWidth 777 | relatedBy:NSLayoutRelationEqual 778 | toItem:[self view] 779 | attribute:NSLayoutAttributeWidth 780 | multiplier:[[self minXDimension] dimension] 781 | constant:0.0]]; 782 | else 783 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]]; 784 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 785 | attribute:NSLayoutAttributeTop 786 | relatedBy:NSLayoutRelationEqual 787 | toItem:[self view] 788 | attribute:NSLayoutAttributeTop 789 | multiplier:1.0 790 | constant:0.0]]; 791 | if (([self slidingViewPositioning]&FSVRelativePositioningBottom) != 0) 792 | if ([[self minYDimension] absoluteDimension]) 793 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 794 | attribute:NSLayoutAttributeHeight 795 | relatedBy:NSLayoutRelationEqual 796 | toItem:[self view] 797 | attribute:NSLayoutAttributeHeight 798 | multiplier:1.0 799 | constant:-[[self minYDimension] dimension]]]; 800 | else 801 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 802 | attribute:NSLayoutAttributeHeight 803 | relatedBy:NSLayoutRelationEqual 804 | toItem:[self view] 805 | attribute:NSLayoutAttributeHeight 806 | multiplier:1.0-[[self minYDimension] dimension] 807 | constant:0.0]]; 808 | else if (([self slidingViewPositioning]&FSVRelativePositioningTop) != 0) 809 | if ([[self minYDimension] absoluteDimension]) 810 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 811 | attribute:NSLayoutAttributeHeight 812 | relatedBy:NSLayoutRelationEqual 813 | toItem:nil 814 | attribute:NSLayoutAttributeNotAnAttribute 815 | multiplier:0.0 816 | constant:[[self minYDimension] dimension]]]; 817 | else 818 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView 819 | attribute:NSLayoutAttributeHeight 820 | relatedBy:NSLayoutRelationEqual 821 | toItem:[self view] 822 | attribute:NSLayoutAttributeHeight 823 | multiplier:[[self minYDimension] dimension] 824 | constant:0.0]]; 825 | else 826 | [[self stretchViewConstraints] addObject:[NSLayoutConstraint constraintWithItem:stretchView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0.0]]; 827 | [[self view] addConstraints:[self stretchViewConstraints]]; 828 | [stretchView layoutIfNeeded]; // all layouting depends on stretchView -> determine correct size of stretchView immediately 829 | } /* if */ 830 | } 831 | 832 | -(void) modifyStretchViewConstraintsForXDimension:(double)dimension absoluteValue:(BOOL)absoluteValue 833 | { 834 | UIView* const stretchView = [self stretchView]; 835 | 836 | 837 | if (stretchView != nil) 838 | { 839 | [[self view] removeConstraint:[[self stretchViewConstraints] objectAtIndex:1]]; 840 | if (([self slidingViewPositioning]&FSVRelativePositioningRight) != 0) 841 | if (absoluteValue) 842 | [[self stretchViewConstraints] replaceObjectAtIndex:1 843 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 844 | attribute:NSLayoutAttributeWidth 845 | relatedBy:NSLayoutRelationEqual 846 | toItem:[self view] 847 | attribute:NSLayoutAttributeWidth 848 | multiplier:1.0 849 | constant:-dimension]]; 850 | else 851 | [[self stretchViewConstraints] replaceObjectAtIndex:1 852 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 853 | attribute:NSLayoutAttributeWidth 854 | relatedBy:NSLayoutRelationEqual 855 | toItem:[self view] 856 | attribute:NSLayoutAttributeWidth 857 | multiplier:1.0-dimension 858 | constant:0.0]]; 859 | else if (([self slidingViewPositioning]&FSVRelativePositioningLeft) != 0) 860 | if (absoluteValue) 861 | [[self stretchViewConstraints] replaceObjectAtIndex:1 862 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 863 | attribute:NSLayoutAttributeWidth 864 | relatedBy:NSLayoutRelationEqual 865 | toItem:nil 866 | attribute:NSLayoutAttributeNotAnAttribute 867 | multiplier:0.0 868 | constant:dimension]]; 869 | else 870 | [[self stretchViewConstraints] replaceObjectAtIndex:1 871 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 872 | attribute:NSLayoutAttributeWidth 873 | relatedBy:NSLayoutRelationEqual 874 | toItem:[self view] 875 | attribute:NSLayoutAttributeWidth 876 | multiplier:dimension 877 | constant:0.0]]; 878 | else 879 | [[self stretchViewConstraints] replaceObjectAtIndex:1 880 | withObject:[NSLayoutConstraint constraintWithItem:stretchView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0.0]]; 881 | [[self view] addConstraint:[[self stretchViewConstraints] objectAtIndex:1]]; 882 | [stretchView setNeedsLayout]; 883 | } /* if */ 884 | } 885 | 886 | -(void) modifyStretchViewConstraintsForYDimension:(double)dimension absoluteValue:(BOOL)absoluteValue 887 | { 888 | UIView* const stretchView = [self stretchView]; 889 | 890 | 891 | if (stretchView != nil) 892 | { 893 | [[self view] removeConstraint:[[self stretchViewConstraints] objectAtIndex:3]]; 894 | if (([self slidingViewPositioning]&FSVRelativePositioningBottom) != 0) 895 | if (absoluteValue) 896 | [[self stretchViewConstraints] replaceObjectAtIndex:3 897 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 898 | attribute:NSLayoutAttributeHeight 899 | relatedBy:NSLayoutRelationEqual 900 | toItem:[self view] 901 | attribute:NSLayoutAttributeHeight 902 | multiplier:1.0 903 | constant:-dimension]]; 904 | else 905 | [[self stretchViewConstraints] replaceObjectAtIndex:3 906 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 907 | attribute:NSLayoutAttributeHeight 908 | relatedBy:NSLayoutRelationEqual 909 | toItem:[self view] 910 | attribute:NSLayoutAttributeHeight 911 | multiplier:1.0-dimension 912 | constant:0.0]]; 913 | else if (([self slidingViewPositioning]&FSVRelativePositioningTop) != 0) 914 | if (absoluteValue) 915 | [[self stretchViewConstraints] replaceObjectAtIndex:3 916 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 917 | attribute:NSLayoutAttributeHeight 918 | relatedBy:NSLayoutRelationEqual 919 | toItem:nil 920 | attribute:NSLayoutAttributeNotAnAttribute 921 | multiplier:0.0 922 | constant:dimension]]; 923 | else 924 | [[self stretchViewConstraints] replaceObjectAtIndex:3 925 | withObject:[NSLayoutConstraint constraintWithItem:stretchView 926 | attribute:NSLayoutAttributeHeight 927 | relatedBy:NSLayoutRelationEqual 928 | toItem:[self view] 929 | attribute:NSLayoutAttributeHeight 930 | multiplier:dimension 931 | constant:0.0]]; 932 | else 933 | [[self stretchViewConstraints] replaceObjectAtIndex:3 934 | withObject:[NSLayoutConstraint constraintWithItem:stretchView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0.0]]; 935 | [[self view] addConstraint:[[self stretchViewConstraints] objectAtIndex:3]]; 936 | [stretchView setNeedsLayout]; 937 | } /* if */ 938 | } 939 | 940 | -(void) setUpDarkeningForAbsoluteXDimension:(CGFloat)absoluteXDimension absoluteYDimension:(CGFloat)absoluteYDimension 941 | { 942 | UIColor* targetColor; 943 | 944 | 945 | if (([[self slidingViewController] view] != nil) && ([self slidingStyle] == FSVSlidingStyleOverlay) && 946 | ((absoluteXDimension- [self determineAbsoluteMinXDimension] > 1.0) || (absoluteYDimension-[self determineAbsoluteMinYDimension] > 1.0))) // comparison against 1 takes rounding errors and rounding to pixels into account 947 | targetColor = [UIColor colorWithWhite:0.0 alpha:[self darkening]]; 948 | else 949 | targetColor = [UIColor clearColor]; 950 | if (![[[self sandwichView] backgroundColor] isEqual:targetColor]) 951 | [[self sandwichView] setBackgroundColor:targetColor]; 952 | } 953 | 954 | -(void) setUpUserInteractionFeasibilityForAbsoluteXDimension:(CGFloat)absoluteXDimension absoluteYDimension:(CGFloat)absoluteYDimension 955 | { 956 | [[self sandwichView] setUserInteractionEnabled:(([[self slidingViewController] view] != nil) && 957 | ((absoluteXDimension-[self determineAbsoluteMinXDimension] > 1.0) || (absoluteYDimension-[self determineAbsoluteMinYDimension] > 1.0)))]; // comparison against 1 takes rounding errors and rounding to pixels into account 958 | } 959 | 960 | @end 961 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVDimension.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSVDimension.h 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface FSVDimension : NSObject 13 | 14 | /** @name Properties 15 | * @{ */ 16 | 17 | @property (nonatomic, assign, readonly) BOOL absoluteDimension; ///< Flag indicating if dimension indicates an absolute or relative dimension; default value is NO 18 | @property (nonatomic, assign, readonly) CGFloat dimension; ///< Dimension value itself; relative dimension values must be within [0; 1] 19 | 20 | /** @} */ 21 | /** @name Initialization and object allocation 22 | * @{ */ 23 | 24 | /// Initializer 25 | /** @param dimension Dimension value. If a relative dimension is specified the value will be clamped within [0; 1]. 26 | * @param absoluteDimension Flag indicating if dimension contains an absolute or relative dimension value. 27 | * @return An initialized object is returned. */ 28 | -(instancetype) initWithDimension:(CGFloat)dimension absoluteDimension:(BOOL)absoluteDimension; 29 | 30 | /// Object allocator 31 | /** @param dimension Dimension value. If a relative dimension is specified the value will be clamped within [0; 1]. 32 | * @param absoluteDimension Flag indicating if dimension contains an absolute or relative dimension value. 33 | * @return An allocated and initialized object is returned. */ 34 | +(FSVDimension*) dimensionWithDimension:(CGFloat)dimension absoluteDimension:(BOOL)absoluteDimension; 35 | 36 | /** @} */ 37 | @end 38 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVDimension.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSVDimension.m 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "FlexibleSlidingView/FSVDimension.h" 10 | 11 | #pragma mark Implementation 12 | @implementation FSVDimension 13 | @synthesize absoluteDimension=_absoluteDimension, dimension=_dimension; 14 | 15 | #pragma mark - Initialization, object allocation and deallocation 16 | -(instancetype) initWithDimension:(CGFloat)dimension absoluteDimension:(BOOL)absoluteDimension 17 | { 18 | self = [super init]; 19 | if (self != nil) 20 | { 21 | _absoluteDimension = absoluteDimension; 22 | if (_absoluteDimension) 23 | _dimension = dimension; 24 | else 25 | _dimension = MAX(0.0,MIN(1.0,dimension)); 26 | } /* if */ 27 | return self; 28 | } 29 | 30 | +(FSVDimension*) dimensionWithDimension:(CGFloat)dimension absoluteDimension:(BOOL)absoluteDimension 31 | { 32 | return [[FSVDimension alloc] initWithDimension:dimension absoluteDimension:absoluteDimension]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVRelativePositioning.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSVRelativePositioning.h 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #ifndef FlexibleSlidingViewController_SWRelativePositioning_h 10 | #define FlexibleSlidingViewController_SWRelativePositioning_h 11 | 12 | #include 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /** @name Types 19 | * @{ */ 20 | 21 | /// Defines a type for relative positioning 22 | typedef enum 23 | { 24 | FSVRelativePositioningBottom = 1 << 0, 25 | FSVRelativePositioningLeft = 1 << 1, 26 | FSVRelativePositioningRight = 1 << 2, 27 | FSVRelativePositioningTop = 1 << 3 28 | } FSVRelativePositioning; 29 | 30 | /** @} */ 31 | /** @name Functions 32 | * @{ */ 33 | 34 | /// Checks if a specific relative positioning is part of a set of positionings 35 | static inline BOOL HasSetRelativePositioning(NSInteger positioningSet, FSVRelativePositioning positioning) 36 | { 37 | return ((positioningSet&positioning) != 0); 38 | } 39 | 40 | /** @} */ 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | #endif 45 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVSandwichView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSVSandwichView.h 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /// 12 | /// @class FSVSandwichView 13 | /// @brief The sandwich view is placed between the main view controller's and the sliding view controller's views. 14 | /// 15 | /// The sandwich view has the same size as the container controller's view. It is used to for 16 | /// - darkening the main's view by changing its transparency; 17 | /// - detecting tap gestures for minimizing the sliding view. 18 | /// 19 | /// @remark The default setting is a completely transparent and does not have any darkening nor tap gesture functionality. 20 | /// 21 | @interface FSVSandwichView : UIView 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVSandwichView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FSVSandwichView.m 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 07.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #import "FlexibleSlidingView/FSVSandwichView.h" 10 | 11 | #pragma mark - Implementation 12 | @implementation FSVSandwichView 13 | 14 | #pragma mark - Initialization, object allocation and deallocation 15 | -(instancetype) initWithFrame:(CGRect)frame 16 | { 17 | self = [super initWithFrame:frame]; 18 | if (self != nil) 19 | { 20 | [self setBackgroundColor:[UIColor clearColor]]; 21 | } /* if */ 22 | return self; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVSlidingStyle.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSVSlidingStyle.h 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 09.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #ifndef FlexibleSlidingViewController_SWSlidingStyle_h 10 | #define FlexibleSlidingViewController_SWSlidingStyle_h 11 | 12 | /// Defines a type indicating the style when sliding 13 | typedef enum 14 | { 15 | FSVSlidingStyleMove, ///< Default style; moves view without changig its size 16 | FSVSlidingStyleOverlay ///< Places sliding view above other view (only relevant for main view) 17 | } FSVSlidingStyle; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingView/FSVSlidingViewState.h: -------------------------------------------------------------------------------- 1 | // 2 | // FSVSlidingViewState.h 3 | // FlexibleSlidingViewController 4 | // 5 | // Created by Hartwig Wiesmann on 11.08.15. 6 | // Copyright (c) 2015 skywind. All rights reserved. 7 | // 8 | 9 | #ifndef FlexibleSlidingViewController_SWSlidingViewState_h 10 | #define FlexibleSlidingViewController_SWSlidingViewState_h 11 | 12 | /// Defines a type describing the state of the sliding view 13 | typedef enum 14 | { 15 | FSVSlidingViewStateMinimized, ///< Sliding view is minimized 16 | FSVSLidingViewStateMinimizing, ///< Sliding view is being animated to move to its minimum state 17 | FSVSlidingViewStateDragging, ///< User is dragging sliding view 18 | FSVSlidingViewStateMaximizing, ///< Sliding view is being animated to move to its maximum state 19 | FSVSlidingViewStateMaximized ///< Sliding view is maximized 20 | } FSVSlidingViewState; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Library/FlexibleSlidingViewTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | eu.skywind.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Flexible Sliding View iOS SDK 2 | FlexibleSlidingView (FSV) iOS SDK is an open source library using the MIT license that runs natively on iOS 7.1 or greater. 3 | 4 | The library implements a container view controller class that manages two UIViewController objects. The main view controller manages the main view. The sliding view controller manages a view that slides on top of the main view. Though it has also the capability to push the main view. 5 | 6 | [![FSV demo video](FSV Demo.gif)]() 7 | 8 | ## Main Features 9 | * sliding view can slide in from bottom, left, right and top 10 | * sliding view can slide above main view or may push main view 11 | * when in "push mode" views can keep their sizes or are resized to fit into the container view controller's view 12 | * a sliding view that slides above the main view can optionally darken the main view when the sliding view's size is larger than its minimum size 13 | * sliding view can be positioned by the user between programmatically specified limits or can snap to the limits 14 | 15 | ## Installation 16 | Clone from GitHub and integrate the project "FlexibleSlidingView.xcodeproj" found in the "Library" folder into your project and link its library to your project. 17 | 18 | To access the source header files you have to include in your projects header path the path to the "Library" directory. Add 19 | 20 | * `#import "FlexibleSlidingView/FSVContainerViewController.h"`, 21 | * `#import "FlexibleSlidingView/FSVDimension.h"` 22 | * `#import "FlexibleSlidingView/FSVRelativePositioning.h"` and/or 23 | * `#import "FlexibleSlidingView/FSVSlidingStyle.h"` 24 | 25 | to your files. 26 | 27 | The FSV SDK makes no use of any other libraries than the ones found in the iOS SDK. 28 | 29 | ## Demo 30 | An app is integrated in the repository that shows the usage and features of the FSV SDK. Open the file "FlexibleSlidingView.xcworkspace" with Xcode, build and run the app either on an iPhone, iPad or a simulator. 31 | 32 | The app's action button opens a view that lets you manipulate the behaviour of the managed views. 33 | 34 | --------------------------------------------------------------------------------