├── .DS_Store ├── .github └── FUNDING.yml ├── HBStickerViewOrResizableView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ ├── avtar-mac-pro.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── sergiomusolestornador.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── avtar-mac-pro.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── avtarsingh.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ └── sergiomusolestornador.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── HBStickerViewOrResizableView ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── Flip.imageset │ │ ├── Contents.json │ │ └── Flip.png │ ├── bicycle.imageset │ │ ├── Contents.json │ │ └── bicycle.png │ ├── cross.imageset │ │ ├── Contents.json │ │ └── close-circular-button-of-a-cross.png │ ├── dance_girl.imageset │ │ ├── Contents.json │ │ └── dance_girl.png │ ├── dance_text.imageset │ │ ├── Contents.json │ │ └── dance_text.png │ ├── expand.imageset │ │ ├── Contents.json │ │ └── expand.png │ ├── girl.imageset │ │ ├── Contents.json │ │ └── girl.png │ ├── main_sticker.imageset │ │ ├── Contents.json │ │ └── main@2x.png │ ├── pineapple.imageset │ │ ├── Contents.json │ │ └── pineapple.png │ ├── reload.imageset │ │ ├── Contents.json │ │ └── reload.png │ └── wifi.imageset │ │ ├── Contents.json │ │ └── wifi.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Core │ ├── HBButton.swift │ ├── HBView.swift │ └── HBXib.swift ├── Info.plist ├── Sticker │ ├── HBStickerView.swift │ └── HBStickerView.xib └── ViewController.swift ├── README.md └── screenshots ├── Shot_1.png ├── Shot_2.png └── Shot_3.png /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/.DS_Store -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: AvtMob # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | thanks_dev: # Replace with a single thanks.dev username 15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 16 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 57B3914720FE488E0026C294 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B3914620FE488E0026C294 /* AppDelegate.swift */; }; 11 | 57B3914920FE488E0026C294 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B3914820FE488E0026C294 /* ViewController.swift */; }; 12 | 57B3914C20FE488E0026C294 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57B3914A20FE488E0026C294 /* Main.storyboard */; }; 13 | 57B3914E20FE488E0026C294 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 57B3914D20FE488E0026C294 /* Assets.xcassets */; }; 14 | 57B3915120FE488E0026C294 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 57B3914F20FE488E0026C294 /* LaunchScreen.storyboard */; }; 15 | 57B3915A20FE48D10026C294 /* HBXib.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B3915920FE48D10026C294 /* HBXib.swift */; }; 16 | 57B3915D20FE492E0026C294 /* HBView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B3915B20FE492D0026C294 /* HBView.swift */; }; 17 | 57B3915E20FE492E0026C294 /* HBButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B3915C20FE492D0026C294 /* HBButton.swift */; }; 18 | 57B3916620FE4A920026C294 /* HBStickerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 57B3916420FE4A920026C294 /* HBStickerView.xib */; }; 19 | 57B3916720FE4A920026C294 /* HBStickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B3916520FE4A920026C294 /* HBStickerView.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 57B3914320FE488E0026C294 /* HBStickerViewOrResizableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HBStickerViewOrResizableView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 57B3914620FE488E0026C294 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | 57B3914820FE488E0026C294 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | 57B3914B20FE488E0026C294 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 57B3914D20FE488E0026C294 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 57B3915020FE488E0026C294 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 57B3915220FE488E0026C294 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 57B3915920FE48D10026C294 /* HBXib.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HBXib.swift; sourceTree = ""; }; 31 | 57B3915B20FE492D0026C294 /* HBView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HBView.swift; sourceTree = ""; }; 32 | 57B3915C20FE492D0026C294 /* HBButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HBButton.swift; sourceTree = ""; }; 33 | 57B3916420FE4A920026C294 /* HBStickerView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HBStickerView.xib; sourceTree = ""; }; 34 | 57B3916520FE4A920026C294 /* HBStickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HBStickerView.swift; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 57B3914020FE488E0026C294 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 57B3913A20FE488E0026C294 = { 49 | isa = PBXGroup; 50 | children = ( 51 | 57B3914520FE488E0026C294 /* HBStickerViewOrResizableView */, 52 | 57B3914420FE488E0026C294 /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | 57B3914420FE488E0026C294 /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 57B3914320FE488E0026C294 /* HBStickerViewOrResizableView.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | 57B3914520FE488E0026C294 /* HBStickerViewOrResizableView */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 57B3915F20FE49E70026C294 /* Sticker */, 68 | 57B3915820FE48990026C294 /* Core */, 69 | 57B3914620FE488E0026C294 /* AppDelegate.swift */, 70 | 57B3914820FE488E0026C294 /* ViewController.swift */, 71 | 57B3914A20FE488E0026C294 /* Main.storyboard */, 72 | 57B3914D20FE488E0026C294 /* Assets.xcassets */, 73 | 57B3914F20FE488E0026C294 /* LaunchScreen.storyboard */, 74 | 57B3915220FE488E0026C294 /* Info.plist */, 75 | ); 76 | path = HBStickerViewOrResizableView; 77 | sourceTree = ""; 78 | }; 79 | 57B3915820FE48990026C294 /* Core */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 57B3915C20FE492D0026C294 /* HBButton.swift */, 83 | 57B3915B20FE492D0026C294 /* HBView.swift */, 84 | 57B3915920FE48D10026C294 /* HBXib.swift */, 85 | ); 86 | path = Core; 87 | sourceTree = ""; 88 | }; 89 | 57B3915F20FE49E70026C294 /* Sticker */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 57B3916520FE4A920026C294 /* HBStickerView.swift */, 93 | 57B3916420FE4A920026C294 /* HBStickerView.xib */, 94 | ); 95 | path = Sticker; 96 | sourceTree = ""; 97 | }; 98 | /* End PBXGroup section */ 99 | 100 | /* Begin PBXNativeTarget section */ 101 | 57B3914220FE488E0026C294 /* HBStickerViewOrResizableView */ = { 102 | isa = PBXNativeTarget; 103 | buildConfigurationList = 57B3915520FE488E0026C294 /* Build configuration list for PBXNativeTarget "HBStickerViewOrResizableView" */; 104 | buildPhases = ( 105 | 57B3913F20FE488E0026C294 /* Sources */, 106 | 57B3914020FE488E0026C294 /* Frameworks */, 107 | 57B3914120FE488E0026C294 /* Resources */, 108 | ); 109 | buildRules = ( 110 | ); 111 | dependencies = ( 112 | ); 113 | name = HBStickerViewOrResizableView; 114 | productName = HBStickerViewOrResizableView; 115 | productReference = 57B3914320FE488E0026C294 /* HBStickerViewOrResizableView.app */; 116 | productType = "com.apple.product-type.application"; 117 | }; 118 | /* End PBXNativeTarget section */ 119 | 120 | /* Begin PBXProject section */ 121 | 57B3913B20FE488E0026C294 /* Project object */ = { 122 | isa = PBXProject; 123 | attributes = { 124 | BuildIndependentTargetsInParallel = YES; 125 | CLASSPREFIX = HB; 126 | LastSwiftUpdateCheck = 0920; 127 | LastUpgradeCheck = 1540; 128 | ORGANIZATIONNAME = "Avtar Singh"; 129 | TargetAttributes = { 130 | 57B3914220FE488E0026C294 = { 131 | CreatedOnToolsVersion = 9.2; 132 | LastSwiftMigration = 1540; 133 | ProvisioningStyle = Automatic; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = 57B3913E20FE488E0026C294 /* Build configuration list for PBXProject "HBStickerViewOrResizableView" */; 138 | compatibilityVersion = "Xcode 8.0"; 139 | developmentRegion = en; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = 57B3913A20FE488E0026C294; 146 | productRefGroup = 57B3914420FE488E0026C294 /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | 57B3914220FE488E0026C294 /* HBStickerViewOrResizableView */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXResourcesBuildPhase section */ 156 | 57B3914120FE488E0026C294 /* Resources */ = { 157 | isa = PBXResourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 57B3916620FE4A920026C294 /* HBStickerView.xib in Resources */, 161 | 57B3915120FE488E0026C294 /* LaunchScreen.storyboard in Resources */, 162 | 57B3914E20FE488E0026C294 /* Assets.xcassets in Resources */, 163 | 57B3914C20FE488E0026C294 /* Main.storyboard in Resources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXResourcesBuildPhase section */ 168 | 169 | /* Begin PBXSourcesBuildPhase section */ 170 | 57B3913F20FE488E0026C294 /* Sources */ = { 171 | isa = PBXSourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | 57B3915A20FE48D10026C294 /* HBXib.swift in Sources */, 175 | 57B3915E20FE492E0026C294 /* HBButton.swift in Sources */, 176 | 57B3915D20FE492E0026C294 /* HBView.swift in Sources */, 177 | 57B3914920FE488E0026C294 /* ViewController.swift in Sources */, 178 | 57B3916720FE4A920026C294 /* HBStickerView.swift in Sources */, 179 | 57B3914720FE488E0026C294 /* AppDelegate.swift in Sources */, 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | }; 183 | /* End PBXSourcesBuildPhase section */ 184 | 185 | /* Begin PBXVariantGroup section */ 186 | 57B3914A20FE488E0026C294 /* Main.storyboard */ = { 187 | isa = PBXVariantGroup; 188 | children = ( 189 | 57B3914B20FE488E0026C294 /* Base */, 190 | ); 191 | name = Main.storyboard; 192 | sourceTree = ""; 193 | }; 194 | 57B3914F20FE488E0026C294 /* LaunchScreen.storyboard */ = { 195 | isa = PBXVariantGroup; 196 | children = ( 197 | 57B3915020FE488E0026C294 /* Base */, 198 | ); 199 | name = LaunchScreen.storyboard; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXVariantGroup section */ 203 | 204 | /* Begin XCBuildConfiguration section */ 205 | 57B3915320FE488E0026C294 /* Debug */ = { 206 | isa = XCBuildConfiguration; 207 | buildSettings = { 208 | ALWAYS_SEARCH_USER_PATHS = NO; 209 | CLANG_ANALYZER_NONNULL = YES; 210 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 211 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 212 | CLANG_CXX_LIBRARY = "libc++"; 213 | CLANG_ENABLE_MODULES = YES; 214 | CLANG_ENABLE_OBJC_ARC = YES; 215 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 216 | CLANG_WARN_BOOL_CONVERSION = YES; 217 | CLANG_WARN_COMMA = YES; 218 | CLANG_WARN_CONSTANT_CONVERSION = YES; 219 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 220 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 221 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 222 | CLANG_WARN_EMPTY_BODY = YES; 223 | CLANG_WARN_ENUM_CONVERSION = YES; 224 | CLANG_WARN_INFINITE_RECURSION = YES; 225 | CLANG_WARN_INT_CONVERSION = YES; 226 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 227 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 228 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 229 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 230 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 231 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 232 | CLANG_WARN_STRICT_PROTOTYPES = YES; 233 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 234 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 235 | CLANG_WARN_UNREACHABLE_CODE = YES; 236 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 237 | CODE_SIGN_IDENTITY = "iPhone Developer"; 238 | COPY_PHASE_STRIP = NO; 239 | DEBUG_INFORMATION_FORMAT = dwarf; 240 | ENABLE_STRICT_OBJC_MSGSEND = YES; 241 | ENABLE_TESTABILITY = YES; 242 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 243 | GCC_C_LANGUAGE_STANDARD = gnu11; 244 | GCC_DYNAMIC_NO_PIC = NO; 245 | GCC_NO_COMMON_BLOCKS = YES; 246 | GCC_OPTIMIZATION_LEVEL = 0; 247 | GCC_PREPROCESSOR_DEFINITIONS = ( 248 | "DEBUG=1", 249 | "$(inherited)", 250 | ); 251 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 253 | GCC_WARN_UNDECLARED_SELECTOR = YES; 254 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 255 | GCC_WARN_UNUSED_FUNCTION = YES; 256 | GCC_WARN_UNUSED_VARIABLE = YES; 257 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 258 | MTL_ENABLE_DEBUG_INFO = YES; 259 | ONLY_ACTIVE_ARCH = YES; 260 | SDKROOT = iphoneos; 261 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 262 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 263 | }; 264 | name = Debug; 265 | }; 266 | 57B3915420FE488E0026C294 /* Release */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_ANALYZER_NONNULL = YES; 271 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INFINITE_RECURSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 288 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 289 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 290 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 291 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 292 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 293 | CLANG_WARN_STRICT_PROTOTYPES = YES; 294 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 295 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 296 | CLANG_WARN_UNREACHABLE_CODE = YES; 297 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 298 | CODE_SIGN_IDENTITY = "iPhone Developer"; 299 | COPY_PHASE_STRIP = NO; 300 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 301 | ENABLE_NS_ASSERTIONS = NO; 302 | ENABLE_STRICT_OBJC_MSGSEND = YES; 303 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 304 | GCC_C_LANGUAGE_STANDARD = gnu11; 305 | GCC_NO_COMMON_BLOCKS = YES; 306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 308 | GCC_WARN_UNDECLARED_SELECTOR = YES; 309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 310 | GCC_WARN_UNUSED_FUNCTION = YES; 311 | GCC_WARN_UNUSED_VARIABLE = YES; 312 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 313 | MTL_ENABLE_DEBUG_INFO = NO; 314 | SDKROOT = iphoneos; 315 | SWIFT_COMPILATION_MODE = wholemodule; 316 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 317 | VALIDATE_PRODUCT = YES; 318 | }; 319 | name = Release; 320 | }; 321 | 57B3915620FE488E0026C294 /* Debug */ = { 322 | isa = XCBuildConfiguration; 323 | buildSettings = { 324 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 325 | CODE_SIGN_STYLE = Automatic; 326 | DEVELOPMENT_TEAM = X7DT3RL9W7; 327 | INFOPLIST_FILE = HBStickerViewOrResizableView/Info.plist; 328 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 329 | LD_RUNPATH_SEARCH_PATHS = ( 330 | "$(inherited)", 331 | "@executable_path/Frameworks", 332 | ); 333 | PRODUCT_BUNDLE_IDENTIFIER = HBDevelopers.HBStickerViewOrResizableView; 334 | PRODUCT_NAME = "$(TARGET_NAME)"; 335 | SWIFT_VERSION = 5.0; 336 | TARGETED_DEVICE_FAMILY = "1,2"; 337 | }; 338 | name = Debug; 339 | }; 340 | 57B3915720FE488E0026C294 /* Release */ = { 341 | isa = XCBuildConfiguration; 342 | buildSettings = { 343 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 344 | CODE_SIGN_STYLE = Automatic; 345 | DEVELOPMENT_TEAM = X7DT3RL9W7; 346 | INFOPLIST_FILE = HBStickerViewOrResizableView/Info.plist; 347 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 348 | LD_RUNPATH_SEARCH_PATHS = ( 349 | "$(inherited)", 350 | "@executable_path/Frameworks", 351 | ); 352 | PRODUCT_BUNDLE_IDENTIFIER = HBDevelopers.HBStickerViewOrResizableView; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | SWIFT_VERSION = 5.0; 355 | TARGETED_DEVICE_FAMILY = "1,2"; 356 | }; 357 | name = Release; 358 | }; 359 | /* End XCBuildConfiguration section */ 360 | 361 | /* Begin XCConfigurationList section */ 362 | 57B3913E20FE488E0026C294 /* Build configuration list for PBXProject "HBStickerViewOrResizableView" */ = { 363 | isa = XCConfigurationList; 364 | buildConfigurations = ( 365 | 57B3915320FE488E0026C294 /* Debug */, 366 | 57B3915420FE488E0026C294 /* Release */, 367 | ); 368 | defaultConfigurationIsVisible = 0; 369 | defaultConfigurationName = Release; 370 | }; 371 | 57B3915520FE488E0026C294 /* Build configuration list for PBXNativeTarget "HBStickerViewOrResizableView" */ = { 372 | isa = XCConfigurationList; 373 | buildConfigurations = ( 374 | 57B3915620FE488E0026C294 /* Debug */, 375 | 57B3915720FE488E0026C294 /* Release */, 376 | ); 377 | defaultConfigurationIsVisible = 0; 378 | defaultConfigurationName = Release; 379 | }; 380 | /* End XCConfigurationList section */ 381 | }; 382 | rootObject = 57B3913B20FE488E0026C294 /* Project object */; 383 | } 384 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/project.xcworkspace/xcuserdata/avtar-mac-pro.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView.xcodeproj/project.xcworkspace/xcuserdata/avtar-mac-pro.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/project.xcworkspace/xcuserdata/sergiomusolestornador.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView.xcodeproj/project.xcworkspace/xcuserdata/sergiomusolestornador.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/xcuserdata/avtar-mac-pro.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HBStickerViewOrResizableView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/xcuserdata/avtarsingh.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HBStickerViewOrResizableView.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView.xcodeproj/xcuserdata/sergiomusolestornador.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | HBStickerViewOrResizableView.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // HBStickerViewOrResizableView 4 | // 5 | // Created by Avtar Singh on 17/07/18. 6 | // Copyright © 2018 Avtar Singh. All rights reserved. 7 | // Developer Email: hbdevelopers.helpdesk@gmail.com 8 | 9 | 10 | import UIKit 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 19 | // Override point for customization after application launch. 20 | return true 21 | } 22 | 23 | func applicationWillResignActive(_ application: UIApplication) { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 26 | } 27 | 28 | func applicationDidEnterBackground(_ application: UIApplication) { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | func applicationWillEnterForeground(_ application: UIApplication) { 34 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | func applicationDidBecomeActive(_ application: UIApplication) { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | func applicationWillTerminate(_ application: UIApplication) { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | 46 | } 47 | 48 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/Flip.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Flip.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/Flip.imageset/Flip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/Flip.imageset/Flip.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/bicycle.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "bicycle.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/bicycle.imageset/bicycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/bicycle.imageset/bicycle.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/cross.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "close-circular-button-of-a-cross.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/cross.imageset/close-circular-button-of-a-cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/cross.imageset/close-circular-button-of-a-cross.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/dance_girl.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "dance_girl.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/dance_girl.imageset/dance_girl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/dance_girl.imageset/dance_girl.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/dance_text.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "dance_text.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/dance_text.imageset/dance_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/dance_text.imageset/dance_text.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/expand.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "expand.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/expand.imageset/expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/expand.imageset/expand.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/girl.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "girl.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/girl.imageset/girl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/girl.imageset/girl.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/main_sticker.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "main@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/main_sticker.imageset/main@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/main_sticker.imageset/main@2x.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/pineapple.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "pineapple.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/pineapple.imageset/pineapple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/pineapple.imageset/pineapple.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/reload.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "reload.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/reload.imageset/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/reload.imageset/reload.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/wifi.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "wifi.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Assets.xcassets/wifi.imageset/wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/HBStickerViewOrResizableView/Assets.xcassets/wifi.imageset/wifi.png -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 34 | 73 | 112 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Core/HBButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2018 Avtar Singh. All rights reserved. 3 | // Developer Email: hbdevelopers.helpdesk@gmail.com 4 | 5 | 6 | import UIKit 7 | 8 | @IBDesignable 9 | class HBButton: UIButton { 10 | 11 | enum FromDirection:Int { 12 | case Top = 0 13 | case Right = 1 14 | case Bottom = 2 15 | case Left = 3 16 | } 17 | 18 | var shadowView: UIView! 19 | var direction: FromDirection = .Left 20 | var alphaBefore: CGFloat = 1 21 | 22 | @IBInspectable var animate: Bool = false 23 | @IBInspectable var animateDelay: Double = 0.2 24 | @IBInspectable var animateFrom: Int { 25 | get { 26 | return direction.rawValue 27 | } 28 | set (directionIndex) { 29 | direction = FromDirection(rawValue: directionIndex) ?? .Left 30 | } 31 | } 32 | 33 | @IBInspectable var popIn: Bool = false 34 | @IBInspectable var popInDelay: Double = 0.4 35 | 36 | override func draw(_ rect: CGRect) { 37 | self.clipsToBounds = true 38 | 39 | if animate { 40 | let originalFrame = frame 41 | 42 | if direction == .Bottom { 43 | frame = CGRect(x: frame.origin.x, y: frame.origin.y + 200, width: frame.width, height: frame.height) 44 | } 45 | 46 | UIView.animate(withDuration: 0.3, delay: animateDelay, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: .allowUserInteraction, animations: { 47 | self.frame = originalFrame 48 | }, completion: nil) 49 | } 50 | 51 | if popIn { 52 | transform = CGAffineTransform(scaleX: 0.1, y: 0.1) 53 | UIView.animate(withDuration: 0.8, delay: popInDelay, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: .allowUserInteraction, animations: { 54 | self.transform = CGAffineTransform.identity 55 | }, completion: nil) 56 | } 57 | 58 | if shadowView == nil && shadowOpacity > 0 { 59 | shadowView = UIView(frame: self.frame) 60 | shadowView.backgroundColor = UIColor.clear 61 | shadowView.layer.shadowColor = shadowColor.cgColor 62 | shadowView.layer.shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: self.cornerRadius).cgPath 63 | shadowView.layer.shadowOffset = shadowOffset 64 | shadowView.layer.shadowOpacity = Float(shadowOpacity) 65 | shadowView.layer.shadowRadius = shadowRadius 66 | shadowView.layer.masksToBounds = true 67 | shadowView.clipsToBounds = false 68 | 69 | self.superview?.addSubview(shadowView) 70 | self.superview?.bringSubviewToFront(self) 71 | } 72 | } 73 | 74 | override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { 75 | alphaBefore = alpha 76 | 77 | UIView.animate(withDuration: 0.2, animations: { 78 | self.alpha = 0.4 79 | }) 80 | 81 | return true 82 | } 83 | 84 | override func endTracking(_ touch: UITouch?, with event: UIEvent?) { 85 | UIView.animate(withDuration: 0.35, animations: { 86 | self.alpha = self.alphaBefore 87 | }) 88 | } 89 | 90 | // MARK: - Borders 91 | 92 | @IBInspectable var cornerRadius: CGFloat = 0 { 93 | didSet { 94 | layer.cornerRadius = cornerRadius 95 | layer.masksToBounds = cornerRadius > 0 96 | } 97 | } 98 | 99 | @IBInspectable var borderWidth: CGFloat = 0.0 { 100 | didSet { 101 | layer.borderWidth = borderWidth 102 | } 103 | } 104 | 105 | @IBInspectable var borderColor: UIColor = UIColor.clear { 106 | didSet { 107 | layer.borderColor = borderColor.cgColor 108 | } 109 | } 110 | 111 | // MARK: - Shadow 112 | 113 | @IBInspectable public var shadowOpacity: CGFloat = 0 114 | @IBInspectable public var shadowColor: UIColor = UIColor.clear 115 | @IBInspectable public var shadowRadius: CGFloat = 0 116 | @IBInspectable public var shadowOffset: CGSize = CGSize(width: 0, height: 0) 117 | } 118 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Core/HBView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright © 2018 Avtar Singh. All rights reserved. 3 | // Developer Email: hbdevelopers.helpdesk@gmail.com 4 | 5 | 6 | import UIKit 7 | 8 | @IBDesignable 9 | class HBView: UIView { 10 | 11 | // MARK: - Gradient 12 | 13 | @IBInspectable var firstColor: UIColor = UIColor.white { 14 | didSet { 15 | updateView() 16 | } 17 | } 18 | 19 | @IBInspectable var secondColor: UIColor = UIColor.white { 20 | didSet { 21 | updateView() 22 | } 23 | } 24 | 25 | @IBInspectable var horizontalGradient: Bool = false { 26 | didSet { 27 | updateView() 28 | } 29 | } 30 | 31 | override class var layerClass: AnyClass { 32 | get { 33 | return CAGradientLayer.self 34 | } 35 | } 36 | 37 | func updateView() { 38 | let layer = self.layer as! CAGradientLayer 39 | layer.colors = [ firstColor.cgColor, secondColor.cgColor ] 40 | 41 | if (horizontalGradient) { 42 | layer.startPoint = CGPoint(x: 0.0, y: 0.5) 43 | layer.endPoint = CGPoint(x: 1.0, y: 0.5) 44 | } else { 45 | layer.startPoint = CGPoint(x: 0, y: 0) 46 | layer.endPoint = CGPoint(x: 0, y: 1) 47 | } 48 | } 49 | 50 | // MARK: - Border 51 | 52 | @IBInspectable public var borderColor: UIColor = UIColor.clear { 53 | didSet { 54 | layer.borderColor = borderColor.cgColor 55 | } 56 | } 57 | 58 | @IBInspectable public var borderWidth: CGFloat = 0 { 59 | didSet { 60 | layer.borderWidth = borderWidth 61 | } 62 | } 63 | 64 | @IBInspectable public var cornerRadius: CGFloat = 0 { 65 | didSet { 66 | layer.cornerRadius = cornerRadius 67 | } 68 | } 69 | 70 | // MARK: - Shadow 71 | 72 | @IBInspectable public var shadowOpacity: CGFloat = 0 { 73 | didSet { 74 | layer.shadowOpacity = Float(shadowOpacity) 75 | } 76 | } 77 | 78 | @IBInspectable public var shadowColor: UIColor = UIColor.clear { 79 | didSet { 80 | layer.shadowColor = shadowColor.cgColor 81 | } 82 | } 83 | 84 | @IBInspectable public var shadowRadius: CGFloat = 0 { 85 | didSet { 86 | layer.shadowRadius = shadowRadius 87 | } 88 | } 89 | 90 | @IBInspectable public var shadowOffsetY: CGFloat = 0 { 91 | didSet { 92 | layer.shadowOffset.height = shadowOffsetY 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Core/HBXib.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Xib.swift 3 | // HBStickerViewOrResizableView 4 | // 5 | // Created by Avtar Singh on 17/07/18. 6 | // Copyright © 2018 Avtar Singh. All rights reserved. 7 | // Developer Email: hbdevelopers.helpdesk@gmail.com 8 | 9 | 10 | import UIKit 11 | class HBXib: UIView { 12 | var contentView:UIView? 13 | var nibName:String? 14 | 15 | override init(frame: CGRect) { 16 | super.init(frame: frame) 17 | xibSetup() 18 | } 19 | 20 | required init?(coder aDecoder: NSCoder) { 21 | super.init(coder: aDecoder) 22 | xibSetup() 23 | } 24 | 25 | 26 | override func awakeFromNib() { 27 | xibSetup() 28 | } 29 | 30 | override func prepareForInterfaceBuilder() { 31 | xibSetup() 32 | contentView?.prepareForInterfaceBuilder() 33 | } 34 | 35 | func xibSetup(){ 36 | 37 | guard let view = loadFromNib() else {return} 38 | view.frame = bounds 39 | view.autoresizingMask = [.flexibleWidth,.flexibleHeight] 40 | addSubview(view) 41 | contentView = view 42 | } 43 | 44 | func loadFromNib()->UIView?{ 45 | 46 | self.nibName = String(describing: type(of: self)) 47 | let bundle = Bundle(for: type(of: self)) 48 | let nib = UINib(nibName: nibName!, bundle: bundle) 49 | return nib.instantiate(withOwner: self, 50 | options: nil).first as? UIView 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 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 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Sticker/HBStickerView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HBStickerView.swift 3 | 4 | // 5 | // Created by Avtar Singh on 17/07/18. 6 | // Copyright © 2018 Avtar Singh. All rights reserved. 7 | // Developer Email: hbdevelopers.helpdesk@gmail.com 8 | 9 | import UIKit 10 | 11 | protocol HBStickerViewDelegate { 12 | func hbStickerView(didRemove hbStickerView:HBStickerView) 13 | } 14 | 15 | class HBStickerView: HBXib,UIGestureRecognizerDelegate { 16 | 17 | //MARK:- IBOutlets 18 | @IBOutlet weak var btnCross:HBButton! 19 | @IBOutlet weak var btnResize:HBButton! 20 | @IBOutlet weak var btnRotate:HBButton! 21 | @IBOutlet weak var btnFlip:HBButton! 22 | @IBOutlet weak var btnLeftBoundry:HBButton! 23 | @IBOutlet weak var btnRightBoundry:HBButton! 24 | @IBOutlet weak var btnTopBoundry:HBButton! 25 | @IBOutlet weak var btnBottomBoundry:HBButton! 26 | @IBOutlet weak var viewControls: HBView! 27 | @IBOutlet weak var imageView: UIImageView! 28 | 29 | @IBInspectable var stickIcon : UIImage?{ 30 | didSet{ 31 | imageView?.image = stickIcon 32 | } 33 | } 34 | 35 | 36 | //MARK:- Variables and Constants 37 | var delegate:HBStickerViewDelegate? 38 | 39 | var isControlsHidden = false{ 40 | didSet{ 41 | if isControlsHidden{ 42 | hideControls() 43 | }else{ 44 | showControls() 45 | } 46 | } 47 | } 48 | 49 | var isBringToFront = true 50 | 51 | override init(frame: CGRect) { 52 | super.init(frame: frame) 53 | self.setup() 54 | } 55 | 56 | required init?(coder aDecoder: NSCoder) { 57 | super.init(coder: aDecoder) 58 | 59 | } 60 | 61 | override func awakeFromNib() { 62 | super.awakeFromNib() 63 | self.setup() 64 | } 65 | 66 | //MARK:- Button Actions 67 | @IBAction func btnCrossAction(_ sender: HBButton) { 68 | self.removeFromSuperview() 69 | delegate?.hbStickerView(didRemove: self) 70 | } 71 | @IBAction func btnResizeAction(_ sender: HBButton) { 72 | 73 | } 74 | @IBAction func btnRotateAction(_ sender: HBButton) { 75 | enableMoveRestriction = false 76 | } 77 | @IBAction func btnFlipAction(_ sender: HBButton) { 78 | UIView.animate(withDuration: 0.3) { 79 | self.imageView.transform = self.imageView!.transform.scaledBy(x: -1, y: 1) 80 | } 81 | } 82 | @IBAction func btnLeftBoundryAction(_ sender: HBButton) { 83 | 84 | } 85 | @IBAction func btnRightBoundryAction(_ sender: HBButton) { 86 | 87 | } 88 | @IBAction func btnTopBoundryAction(_ sender: HBButton) { 89 | 90 | } 91 | @IBAction func btnBottomBoundryAction(_ sender: HBButton) { 92 | 93 | } 94 | 95 | //MARK:- Initial stuff 96 | func setup(){ 97 | addGestureRecognizer(moveGestureRecognizer) 98 | 99 | //Enable multiple touch and user interaction for textfield 100 | self.isUserInteractionEnabled = true 101 | self.isMultipleTouchEnabled = true 102 | self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tapRecognized(tap:)))) 103 | 104 | //add pinch gesture 105 | let pinchGesture = UIPinchGestureRecognizer(target: self, action:#selector(pinchRecognized(pinch:))) 106 | pinchGesture.delegate = self 107 | self.addGestureRecognizer(pinchGesture) 108 | 109 | //add rotate gesture. 110 | let rotate = UIRotationGestureRecognizer.init(target: self, action: #selector(handleRotate(recognizer:))) 111 | rotate.delegate = self 112 | self.addGestureRecognizer(rotate) 113 | 114 | self.btnRotate.addGestureRecognizer(panRotateGesture) 115 | self.btnResize.addGestureRecognizer(scaleGestureRecognizer) 116 | self.btnLeftBoundry.addGestureRecognizer(leftBoundryGestureRecognizer) 117 | self.btnRightBoundry.addGestureRecognizer(rightBoundryGestureRecognizer) 118 | self.btnTopBoundry.addGestureRecognizer(topBoundryGestureRecognizer) 119 | self.btnBottomBoundry.addGestureRecognizer(bottomBoundryGestureRecognizer) 120 | } 121 | 122 | func hideControls(){ 123 | self.viewControls.isHidden = true 124 | self.btnRotate.isHidden = true 125 | self.btnResize.isHidden = true 126 | self.btnCross.isHidden = true 127 | self.btnFlip.isHidden = true 128 | self.btnLeftBoundry.isHidden = true 129 | self.btnRightBoundry.isHidden = true 130 | self.btnTopBoundry.isHidden = true 131 | self.btnBottomBoundry.isHidden = true 132 | } 133 | func showControls(){ 134 | if !isControlsHidden{ 135 | self.viewControls.isHidden = false 136 | self.btnRotate.isHidden = false 137 | self.btnResize.isHidden = false 138 | self.btnCross.isHidden = false 139 | self.btnFlip.isHidden = false 140 | self.btnLeftBoundry.isHidden = false 141 | self.btnRightBoundry.isHidden = false 142 | self.btnTopBoundry.isHidden = false 143 | self.btnBottomBoundry.isHidden = false 144 | } 145 | } 146 | 147 | @objc func tapRecognized(tap:UITapGestureRecognizer){ 148 | showControls() 149 | if isBringToFront{ 150 | self.superview?.bringSubviewToFront(self) 151 | } 152 | } 153 | 154 | @objc func pinchRecognized(pinch: UIPinchGestureRecognizer) { 155 | 156 | if let view = pinch.view { 157 | view.transform = view.transform.scaledBy(x: pinch.scale, y: pinch.scale) 158 | pinch.scale = 1 159 | } 160 | } 161 | 162 | @objc func handleRotate(recognizer : UIRotationGestureRecognizer) { 163 | if let view = recognizer.view { 164 | view.transform = view.transform.rotated(by: recognizer.rotation) 165 | recognizer.rotation = 0 166 | } 167 | } 168 | 169 | //MARK:- UIGestureRecognizerDelegate Methods 170 | func gestureRecognizer(_: UIGestureRecognizer, 171 | shouldRecognizeSimultaneouslyWith shouldRecognizeSimultaneouslyWithGestureRecognizer:UIGestureRecognizer) -> Bool { 172 | return true 173 | } 174 | 175 | fileprivate var touchLocation: CGPoint? 176 | fileprivate var deltaAngle: CGFloat? 177 | fileprivate var initialBounds: CGRect? 178 | fileprivate var initialDistance: CGFloat? 179 | fileprivate var beginningPoint: CGPoint? 180 | fileprivate var beginningCenter: CGPoint? 181 | fileprivate var beginBounds: CGRect? 182 | public var enableMoveRestriction: Bool = true 183 | public var enableScaleRestriction: Bool = true 184 | public var enableRotateRestriction: Bool = true 185 | 186 | private lazy var panRotateGesture: UIPanGestureRecognizer! = { 187 | let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(rotateViewPanGesture(_:))) 188 | panRecognizer.delegate = self 189 | return panRecognizer 190 | }() 191 | private lazy var moveGestureRecognizer: UIPanGestureRecognizer! = { 192 | let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(moveGesture(_:))) 193 | panRecognizer.delegate = self 194 | return panRecognizer 195 | }() 196 | 197 | private lazy var scaleGestureRecognizer: UIPanGestureRecognizer! = { 198 | let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(scaleGesture(_:))) 199 | panRecognizer.delegate = self 200 | return panRecognizer 201 | }() 202 | 203 | private lazy var leftBoundryGestureRecognizer: UIPanGestureRecognizer! = { 204 | let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(leftBoundryGesture(recognizer:))) 205 | panRecognizer.delegate = self 206 | return panRecognizer 207 | }() 208 | private lazy var rightBoundryGestureRecognizer: UIPanGestureRecognizer! = { 209 | let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(leftBoundryGesture(recognizer:))) 210 | panRecognizer.delegate = self 211 | return panRecognizer 212 | }() 213 | private lazy var topBoundryGestureRecognizer: UIPanGestureRecognizer! = { 214 | let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(topBoundryGesture(recognizer:))) 215 | panRecognizer.delegate = self 216 | return panRecognizer 217 | }() 218 | private lazy var bottomBoundryGestureRecognizer: UIPanGestureRecognizer! = { 219 | let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(topBoundryGesture(recognizer:))) 220 | panRecognizer.delegate = self 221 | return panRecognizer 222 | }() 223 | 224 | @objc func rotateViewPanGesture(_ recognizer: UIPanGestureRecognizer) { 225 | btnRotate.isEnabled = true 226 | touchLocation = recognizer.location(in: superview) 227 | let center = CGRectGetCenter(frame) 228 | 229 | if !enableRotateRestriction { 230 | return 231 | } 232 | 233 | switch recognizer.state { 234 | case .began: 235 | enableMoveRestriction = false 236 | enableScaleRestriction = false 237 | deltaAngle = atan2(touchLocation!.y - center.y, touchLocation!.x - center.x) - CGAffineTrasformGetAngle(transform) 238 | initialBounds = bounds 239 | initialDistance = CGpointGetDistance(center, point2: touchLocation!) 240 | 241 | case .changed: 242 | let ang = atan2(touchLocation!.y - center.y, touchLocation!.x - center.x) 243 | 244 | let angleDiff = deltaAngle! - ang 245 | transform = CGAffineTransform(rotationAngle: -angleDiff) 246 | layoutIfNeeded() 247 | case .ended: 248 | enableMoveRestriction = true 249 | enableScaleRestriction = true 250 | default:break 251 | 252 | } 253 | } 254 | 255 | @objc func moveGesture(_ recognizer: UIPanGestureRecognizer) { 256 | 257 | if !enableMoveRestriction{ 258 | return 259 | } 260 | 261 | touchLocation = recognizer.location(in: superview) 262 | 263 | switch recognizer.state { 264 | case .began: 265 | 266 | beginningPoint = touchLocation 267 | beginningCenter = center 268 | 269 | center = estimatedCenter() 270 | beginBounds = bounds 271 | 272 | case .changed: 273 | enableMoveRestriction = false 274 | center = estimatedCenter() 275 | enableMoveRestriction = true 276 | case .ended: 277 | center = estimatedCenter() 278 | break 279 | default:break 280 | 281 | } 282 | } 283 | 284 | @objc func scaleGesture(_ recognizer: UIPanGestureRecognizer){ 285 | 286 | if !enableScaleRestriction{ 287 | return 288 | } 289 | 290 | touchLocation = recognizer.location(in: superview) 291 | 292 | switch recognizer.state { 293 | case .began: 294 | enableMoveRestriction = false 295 | initialBounds = bounds 296 | initialDistance = CGpointGetDistance(center, point2: touchLocation!) 297 | case .changed: 298 | let scale = sqrtf(Float(CGpointGetDistance(center, point2: touchLocation!)) / Float(initialDistance!)) 299 | let scaleRect = CGRectScale(initialBounds!, wScale: CGFloat(scale), hScale: CGFloat(scale)) 300 | bounds = scaleRect 301 | case .ended: 302 | enableMoveRestriction = true 303 | break 304 | default:break 305 | 306 | } 307 | } 308 | 309 | 310 | @objc func leftBoundryGesture(recognizer:UIPanGestureRecognizer){ 311 | touchLocation = recognizer.location(in: superview) 312 | switch recognizer.state { 313 | case .began: 314 | enableMoveRestriction = false 315 | initialBounds = bounds 316 | initialDistance = CGpointGetDistance(center, point2: touchLocation!) 317 | break 318 | case .changed: 319 | let s = sqrtf(Float(CGpointGetDistance(center, point2: touchLocation!)) / Float(initialDistance!)) 320 | let scale = CGFloat(s) 321 | let rect = CGRect(x: initialBounds!.origin.x * scale , y: initialBounds!.origin.y, width: initialBounds!.size.width * scale, height: initialBounds!.size.height ) 322 | bounds = rect 323 | break 324 | case .ended: 325 | enableMoveRestriction = true 326 | break 327 | default: 328 | break 329 | } 330 | } 331 | @objc func rightBoundryGesture(recognizer:UIPanGestureRecognizer){ 332 | switch recognizer.state { 333 | case .began: 334 | break 335 | case .changed: 336 | break 337 | case .ended: 338 | break 339 | default: 340 | break 341 | } 342 | } 343 | @objc func topBoundryGesture(recognizer:UIPanGestureRecognizer){ 344 | touchLocation = recognizer.location(in: superview) 345 | switch recognizer.state { 346 | case .began: 347 | enableMoveRestriction = false 348 | initialBounds = bounds 349 | initialDistance = CGpointGetDistance(center, point2: touchLocation!) 350 | break 351 | case .changed: 352 | let s = sqrtf(Float(CGpointGetDistance(center, point2: touchLocation!)) / Float(initialDistance!)) 353 | let scale = CGFloat(s) 354 | let rect = CGRect(x: initialBounds!.origin.x , y: initialBounds!.origin.y * scale, width: initialBounds!.size.width, height: initialBounds!.size.height * scale ) 355 | bounds = rect 356 | break 357 | case .ended: 358 | enableMoveRestriction = true 359 | break 360 | default: 361 | break 362 | } 363 | } 364 | @objc func bottomBoundryGesture(recognizer:UIPanGestureRecognizer){ 365 | switch recognizer.state { 366 | case .began: 367 | break 368 | case .changed: 369 | break 370 | case .ended: 371 | break 372 | default: 373 | break 374 | } 375 | } 376 | 377 | func CGRectGetCenter(_ rect: CGRect) -> CGPoint{ 378 | return CGPoint(x: rect.midX, y: rect.midY) 379 | } 380 | 381 | func CGAffineTrasformGetAngle(_ t: CGAffineTransform) -> CGFloat{ 382 | return atan2(t.b, t.a) 383 | } 384 | 385 | func CGpointGetDistance(_ point1: CGPoint, point2: CGPoint) -> CGFloat { 386 | let fx = point2.x - point1.x 387 | let fy = point2.y - point1.y 388 | return sqrt((fx * fx + fy * fy)) 389 | } 390 | 391 | func CGRectScale(_ rect: CGRect, wScale: CGFloat, hScale: CGFloat) -> CGRect { 392 | return CGRect(x: rect.origin.x * wScale, y: rect.origin.y * hScale, width: rect.size.width * wScale, height: rect.size.height * hScale) 393 | } 394 | 395 | fileprivate func estimatedCenter() -> CGPoint{ 396 | let newCenter: CGPoint! 397 | var newCenterX = beginningCenter!.x + (touchLocation!.x - beginningPoint!.x) 398 | var newCenterY = beginningCenter!.y + (touchLocation!.y - beginningPoint!.y) 399 | 400 | if (enableMoveRestriction) { 401 | if (!(newCenterX - 0.5 * frame.width > 0 && 402 | newCenterX + 0.5 * frame.width < superview!.bounds.width)) { 403 | newCenterX = center.x; 404 | } 405 | if (!(newCenterY - 0.5 * frame.height > 0 && 406 | newCenterY + 0.5 * frame.height < superview!.bounds.height)) { 407 | newCenterY = center.y; 408 | } 409 | newCenter = CGPoint(x: newCenterX, y: newCenterY) 410 | }else { 411 | newCenter = CGPoint(x: newCenterX, y: newCenterY) 412 | } 413 | return newCenter 414 | } 415 | } 416 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/Sticker/HBStickerView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 60 | 72 | 84 | 94 | 105 | 115 | 125 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /HBStickerViewOrResizableView/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // HBStickerViewOrResizableView 4 | // 5 | // Created by Avtar Singh on 17/07/18. 6 | // Copyright © 2018 Avtar Singh. All rights reserved. 7 | // Developer Email: hbdevelopers.helpdesk@gmail.com 8 | 9 | 10 | import UIKit 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var addSticketButton : HBButton! 15 | 16 | private let stickerIcons = ["bicycle","girl","dance_text","pineapple","dance_girl","wifi","main_sticker"] 17 | 18 | private var toggleControlBtns = false 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | // Do any additional setup after loading the view, typically from a nib. 23 | addSticker() 24 | } 25 | 26 | override func didReceiveMemoryWarning() { 27 | super.didReceiveMemoryWarning() 28 | // Dispose of any resources that can be recreated. 29 | } 30 | 31 | 32 | @IBAction func addStickerButtonAction(_ button:HBButton?){ 33 | addSticker() 34 | } 35 | 36 | @IBAction func clearButtonAction(_ button:HBButton?){ 37 | removeAllStickers() 38 | } 39 | 40 | @IBAction func toggleControlsButtonAction(_ button:HBButton?){ 41 | toggleControls() 42 | } 43 | 44 | private func addSticker(){ 45 | let x = CGFloat(Int.random(in: 100 ..< 200)) 46 | let y = CGFloat(Int.random(in: 100 ..< 600)) 47 | let sticketIndex = Int.random(in: 0 ..< stickerIcons.count) 48 | let sticker = HBStickerView(frame: CGRect(x: x,y:y ,width: x,height: x)) 49 | sticker.stickIcon = UIImage(named: stickerIcons[sticketIndex]) 50 | self.view.addSubview(sticker) 51 | } 52 | 53 | private func removeAllStickers(){ 54 | self.view.subviews.forEach { view in 55 | if view is HBStickerView{ 56 | view.removeFromSuperview() 57 | } 58 | } 59 | } 60 | 61 | private func toggleControls(){ 62 | toggleControlBtns = !toggleControlBtns 63 | self.view.subviews.forEach { view in 64 | if view is HBStickerView{ 65 | (view as! HBStickerView).isControlsHidden = toggleControlBtns 66 | } 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HBStickerViewOrResizableView 2 | Use HBStickerView for photo editing and sticker decorations in applications of ios swift 3 | 4 | # You can watch a demo video [here](https://youtube.com/shorts/Y1SlVdGY50c) 5 | 6 | # Project preview 7 | 8 |

9 | 10 | 11 | 12 |

13 | 14 | # How to Use 15 | 16 | ## First case 17 | Step 1: Add a view to your storyboard. 18 | 19 | Step 2: Set the custom class of the view to HBStickerView. 20 | 21 | Step 3: Build and run the project. 22 | 23 | ## Second case 24 | 25 | ```swift 26 | let stickerview = HBStickerView(frame: CGRect(x: 0, y: 0, width: 200, height: 200)) 27 | 28 | stickerview.stickIcon = UIImage(named: "main") 29 | 30 | self.view.addSubview(stickerview) 31 | ``` 32 | 33 | ## Controls 34 | Call to showControls() function for show controls like cross, rotate and resize. 35 | 36 | **stickerview.showControls()** 37 | 38 | Call to hideControls() function for hide controls like cross, rotate and resize. 39 | 40 | **stickerview.hideControls()** 41 | 42 | ### Check controls state with 43 | ```swift 44 | let stickerview = HBStickerView(frame: CGRect(x: 0, y: 0, width: 200, height: 200)) 45 | stickerview.isControlsHidden 46 | ``` 47 | 48 | ## How to remove 49 | ```swift 50 | private func removeAllStickers(){ 51 | self.view.subviews.forEach { view in 52 | if view is HBStickerView{ 53 | view.removeFromSuperview() 54 | } 55 | } 56 | } 57 | ``` 58 | 59 | ## If you appreciate my work, consider [buying me](https://www.paypal.com/paypalme/hbdev/5usd) a cup of ☕️ to keep me recharged 🤘🏼 60 | [[PayPal](https://www.paypal.com/paypalme/hbdev/5usd)] 61 | 62 | -------------------------------------------------------------------------------- /screenshots/Shot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/screenshots/Shot_1.png -------------------------------------------------------------------------------- /screenshots/Shot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/screenshots/Shot_2.png -------------------------------------------------------------------------------- /screenshots/Shot_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AvtMob/HBStickerViewOrResizableView/b9891d5f19c73cde6d4d88acd66523f8e435585d/screenshots/Shot_3.png --------------------------------------------------------------------------------