├── .gitignore ├── Default-568h@2x.png ├── Examples └── examples │ ├── 1.png │ ├── 2.png │ └── 3.png ├── LICENSE ├── README.markdown ├── Smooth Line View.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── nunnikl.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── nunnikl.xcuserdatad │ └── xcschemes │ ├── Smooth Line View.xcscheme │ └── xcschememanagement.plist └── Smooth Line View ├── Smooth Line View-Info.plist ├── Smooth Line View-Prefix.pch ├── SmoothLineView.h ├── SmoothLineView.m ├── Smooth_Line_ViewAppDelegate.h ├── Smooth_Line_ViewAppDelegate.m ├── Smooth_Line_ViewViewController.h ├── Smooth_Line_ViewViewController.m ├── Smooth_Line_ViewViewController.xib ├── en.lproj ├── InfoPlist.strings ├── MainWindow.xib └── Smooth_Line_ViewViewController.xib └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | -------------------------------------------------------------------------------- /Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/levinunnink/Smooth-Line-View/8371f138e38b144cde40c5f23eeafcce9a1e6d4b/Default-568h@2x.png -------------------------------------------------------------------------------- /Examples/examples/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/levinunnink/Smooth-Line-View/8371f138e38b144cde40c5f23eeafcce9a1e6d4b/Examples/examples/1.png -------------------------------------------------------------------------------- /Examples/examples/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/levinunnink/Smooth-Line-View/8371f138e38b144cde40c5f23eeafcce9a1e6d4b/Examples/examples/2.png -------------------------------------------------------------------------------- /Examples/examples/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/levinunnink/Smooth-Line-View/8371f138e38b144cde40c5f23eeafcce9a1e6d4b/Examples/examples/3.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Levi Nunnink 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Smooth line UIView 2 | ==================== 3 | 4 | The goal of this project is to create a UIView that can generate smooth lines from touch input in a reasonably fast manner without moving to a more complex framework like OpenGL. 5 | 6 | *Update:* Completely re-written smooth line algorithm to use native CGContext quadratic curves. The result is much faster and smoother drawing. There's no more need for switching between agorithms. 7 | 8 | Many thanks to [Ginamin](http://stackoverflow.com/users/431480/ginamin) for his elegant solution. 9 | 10 | The Smooth Line View code is licensed under the MIT License: [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT) 11 | -------------------------------------------------------------------------------- /Smooth Line View.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5EF58F54189D8AF40024C782 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5EF58F53189D8AF40024C782 /* Default-568h@2x.png */; }; 11 | 6B250CCD13F9ED20002A5D9D /* SmoothLineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B250CCC13F9ED20002A5D9D /* SmoothLineView.m */; }; 12 | 6B8244E614E0FF67007F2487 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B250CCF13FA2127002A5D9D /* QuartzCore.framework */; }; 13 | 6B93BE6F13F3374200DFAB23 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B93BE6E13F3374200DFAB23 /* UIKit.framework */; }; 14 | 6B93BE7113F3374200DFAB23 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B93BE7013F3374200DFAB23 /* Foundation.framework */; }; 15 | 6B93BE7313F3374200DFAB23 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B93BE7213F3374200DFAB23 /* CoreGraphics.framework */; }; 16 | 6B93BE7913F3374200DFAB23 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6B93BE7713F3374200DFAB23 /* InfoPlist.strings */; }; 17 | 6B93BE7B13F3374200DFAB23 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B93BE7A13F3374200DFAB23 /* main.m */; }; 18 | 6B93BE7F13F3374200DFAB23 /* Smooth_Line_ViewAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B93BE7E13F3374200DFAB23 /* Smooth_Line_ViewAppDelegate.m */; }; 19 | 6B93BE8213F3374200DFAB23 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6B93BE8013F3374200DFAB23 /* MainWindow.xib */; }; 20 | 6B93BE8513F3374200DFAB23 /* Smooth_Line_ViewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B93BE8413F3374200DFAB23 /* Smooth_Line_ViewViewController.m */; }; 21 | 6BA2EACC15E7F21C009779C5 /* Smooth_Line_ViewViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6BA2EACB15E7F21C009779C5 /* Smooth_Line_ViewViewController.xib */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 5EF58F53189D8AF40024C782 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 26 | 6B250CCB13F9ED20002A5D9D /* SmoothLineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmoothLineView.h; sourceTree = ""; }; 27 | 6B250CCC13F9ED20002A5D9D /* SmoothLineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SmoothLineView.m; sourceTree = ""; }; 28 | 6B250CCF13FA2127002A5D9D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 29 | 6B93BE6A13F3374200DFAB23 /* Smooth Line View.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Smooth Line View.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 6B93BE6E13F3374200DFAB23 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 31 | 6B93BE7013F3374200DFAB23 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 32 | 6B93BE7213F3374200DFAB23 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 33 | 6B93BE7613F3374200DFAB23 /* Smooth Line View-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Smooth Line View-Info.plist"; sourceTree = ""; }; 34 | 6B93BE7813F3374200DFAB23 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 35 | 6B93BE7A13F3374200DFAB23 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 6B93BE7C13F3374200DFAB23 /* Smooth Line View-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Smooth Line View-Prefix.pch"; sourceTree = ""; }; 37 | 6B93BE7D13F3374200DFAB23 /* Smooth_Line_ViewAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Smooth_Line_ViewAppDelegate.h; sourceTree = ""; }; 38 | 6B93BE7E13F3374200DFAB23 /* Smooth_Line_ViewAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Smooth_Line_ViewAppDelegate.m; sourceTree = ""; }; 39 | 6B93BE8113F3374200DFAB23 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = ""; }; 40 | 6B93BE8313F3374200DFAB23 /* Smooth_Line_ViewViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Smooth_Line_ViewViewController.h; sourceTree = ""; }; 41 | 6B93BE8413F3374200DFAB23 /* Smooth_Line_ViewViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Smooth_Line_ViewViewController.m; sourceTree = ""; }; 42 | 6BA2EACB15E7F21C009779C5 /* Smooth_Line_ViewViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Smooth_Line_ViewViewController.xib; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 6B93BE6713F3374200DFAB23 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 6B8244E614E0FF67007F2487 /* QuartzCore.framework in Frameworks */, 51 | 6B93BE6F13F3374200DFAB23 /* UIKit.framework in Frameworks */, 52 | 6B93BE7113F3374200DFAB23 /* Foundation.framework in Frameworks */, 53 | 6B93BE7313F3374200DFAB23 /* CoreGraphics.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 6B93BE5F13F3374100DFAB23 = { 61 | isa = PBXGroup; 62 | children = ( 63 | 5EF58F53189D8AF40024C782 /* Default-568h@2x.png */, 64 | 6B93BE7413F3374200DFAB23 /* Smooth Line View */, 65 | 6B93BE6D13F3374200DFAB23 /* Frameworks */, 66 | 6B93BE6B13F3374200DFAB23 /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 6B93BE6B13F3374200DFAB23 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 6B93BE6A13F3374200DFAB23 /* Smooth Line View.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | 6B93BE6D13F3374200DFAB23 /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 6B250CCF13FA2127002A5D9D /* QuartzCore.framework */, 82 | 6B93BE6E13F3374200DFAB23 /* UIKit.framework */, 83 | 6B93BE7013F3374200DFAB23 /* Foundation.framework */, 84 | 6B93BE7213F3374200DFAB23 /* CoreGraphics.framework */, 85 | ); 86 | name = Frameworks; 87 | sourceTree = ""; 88 | }; 89 | 6B93BE7413F3374200DFAB23 /* Smooth Line View */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 6B93BE7D13F3374200DFAB23 /* Smooth_Line_ViewAppDelegate.h */, 93 | 6B93BE7E13F3374200DFAB23 /* Smooth_Line_ViewAppDelegate.m */, 94 | 6B93BE8013F3374200DFAB23 /* MainWindow.xib */, 95 | 6B93BE8313F3374200DFAB23 /* Smooth_Line_ViewViewController.h */, 96 | 6B93BE8413F3374200DFAB23 /* Smooth_Line_ViewViewController.m */, 97 | 6BA2EACB15E7F21C009779C5 /* Smooth_Line_ViewViewController.xib */, 98 | 6B250CCB13F9ED20002A5D9D /* SmoothLineView.h */, 99 | 6B250CCC13F9ED20002A5D9D /* SmoothLineView.m */, 100 | 6B93BE7513F3374200DFAB23 /* Supporting Files */, 101 | ); 102 | path = "Smooth Line View"; 103 | sourceTree = ""; 104 | }; 105 | 6B93BE7513F3374200DFAB23 /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 6B93BE7613F3374200DFAB23 /* Smooth Line View-Info.plist */, 109 | 6B93BE7713F3374200DFAB23 /* InfoPlist.strings */, 110 | 6B93BE7A13F3374200DFAB23 /* main.m */, 111 | 6B93BE7C13F3374200DFAB23 /* Smooth Line View-Prefix.pch */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | /* End PBXGroup section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | 6B93BE6913F3374200DFAB23 /* Smooth Line View */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = 6B93BE8B13F3374200DFAB23 /* Build configuration list for PBXNativeTarget "Smooth Line View" */; 122 | buildPhases = ( 123 | 6B93BE6613F3374200DFAB23 /* Sources */, 124 | 6B93BE6713F3374200DFAB23 /* Frameworks */, 125 | 6B93BE6813F3374200DFAB23 /* Resources */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = "Smooth Line View"; 132 | productName = "Smooth Line View"; 133 | productReference = 6B93BE6A13F3374200DFAB23 /* Smooth Line View.app */; 134 | productType = "com.apple.product-type.application"; 135 | }; 136 | /* End PBXNativeTarget section */ 137 | 138 | /* Begin PBXProject section */ 139 | 6B93BE6113F3374100DFAB23 /* Project object */ = { 140 | isa = PBXProject; 141 | attributes = { 142 | LastUpgradeCheck = 0500; 143 | ORGANIZATIONNAME = culturezoo; 144 | }; 145 | buildConfigurationList = 6B93BE6413F3374100DFAB23 /* Build configuration list for PBXProject "Smooth Line View" */; 146 | compatibilityVersion = "Xcode 3.2"; 147 | developmentRegion = English; 148 | hasScannedForEncodings = 0; 149 | knownRegions = ( 150 | en, 151 | ); 152 | mainGroup = 6B93BE5F13F3374100DFAB23; 153 | productRefGroup = 6B93BE6B13F3374200DFAB23 /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | 6B93BE6913F3374200DFAB23 /* Smooth Line View */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | 6B93BE6813F3374200DFAB23 /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | 6B93BE7913F3374200DFAB23 /* InfoPlist.strings in Resources */, 168 | 5EF58F54189D8AF40024C782 /* Default-568h@2x.png in Resources */, 169 | 6B93BE8213F3374200DFAB23 /* MainWindow.xib in Resources */, 170 | 6BA2EACC15E7F21C009779C5 /* Smooth_Line_ViewViewController.xib in Resources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXResourcesBuildPhase section */ 175 | 176 | /* Begin PBXSourcesBuildPhase section */ 177 | 6B93BE6613F3374200DFAB23 /* Sources */ = { 178 | isa = PBXSourcesBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | 6B93BE7B13F3374200DFAB23 /* main.m in Sources */, 182 | 6B93BE7F13F3374200DFAB23 /* Smooth_Line_ViewAppDelegate.m in Sources */, 183 | 6B93BE8513F3374200DFAB23 /* Smooth_Line_ViewViewController.m in Sources */, 184 | 6B250CCD13F9ED20002A5D9D /* SmoothLineView.m in Sources */, 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | /* End PBXSourcesBuildPhase section */ 189 | 190 | /* Begin PBXVariantGroup section */ 191 | 6B93BE7713F3374200DFAB23 /* InfoPlist.strings */ = { 192 | isa = PBXVariantGroup; 193 | children = ( 194 | 6B93BE7813F3374200DFAB23 /* en */, 195 | ); 196 | name = InfoPlist.strings; 197 | sourceTree = ""; 198 | }; 199 | 6B93BE8013F3374200DFAB23 /* MainWindow.xib */ = { 200 | isa = PBXVariantGroup; 201 | children = ( 202 | 6B93BE8113F3374200DFAB23 /* en */, 203 | ); 204 | name = MainWindow.xib; 205 | sourceTree = ""; 206 | }; 207 | /* End PBXVariantGroup section */ 208 | 209 | /* Begin XCBuildConfiguration section */ 210 | 6B93BE8913F3374200DFAB23 /* Debug */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 215 | COPY_PHASE_STRIP = NO; 216 | GCC_C_LANGUAGE_STANDARD = gnu99; 217 | GCC_DYNAMIC_NO_PIC = NO; 218 | GCC_OPTIMIZATION_LEVEL = 0; 219 | GCC_PREPROCESSOR_DEFINITIONS = ( 220 | "DEBUG=1", 221 | "$(inherited)", 222 | ); 223 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 224 | GCC_VERSION = com.apple.compilers.llvmgcc42; 225 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 226 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 227 | GCC_WARN_UNUSED_VARIABLE = YES; 228 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 229 | ONLY_ACTIVE_ARCH = YES; 230 | SDKROOT = iphoneos; 231 | TARGETED_DEVICE_FAMILY = 2; 232 | }; 233 | name = Debug; 234 | }; 235 | 6B93BE8A13F3374200DFAB23 /* Release */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | ALWAYS_SEARCH_USER_PATHS = NO; 239 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 240 | COPY_PHASE_STRIP = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu99; 242 | GCC_VERSION = com.apple.compilers.llvmgcc42; 243 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 244 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 245 | GCC_WARN_UNUSED_VARIABLE = YES; 246 | IPHONEOS_DEPLOYMENT_TARGET = 4.3; 247 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 248 | SDKROOT = iphoneos; 249 | TARGETED_DEVICE_FAMILY = 2; 250 | VALIDATE_PRODUCT = YES; 251 | }; 252 | name = Release; 253 | }; 254 | 6B93BE8C13F3374200DFAB23 /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CODE_SIGN_IDENTITY = "iPhone Developer"; 259 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 260 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 261 | GCC_PREFIX_HEADER = "Smooth Line View/Smooth Line View-Prefix.pch"; 262 | GCC_VERSION = ""; 263 | INFOPLIST_FILE = "Smooth Line View/Smooth Line View-Info.plist"; 264 | PRODUCT_NAME = "$(TARGET_NAME)"; 265 | PROVISIONING_PROFILE = ""; 266 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = "C4486A19-69DA-4716-9E18-6EB2EB68880F"; 267 | TARGETED_DEVICE_FAMILY = "1,2"; 268 | WRAPPER_EXTENSION = app; 269 | }; 270 | name = Debug; 271 | }; 272 | 6B93BE8D13F3374200DFAB23 /* Release */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 277 | GCC_PREFIX_HEADER = "Smooth Line View/Smooth Line View-Prefix.pch"; 278 | GCC_VERSION = ""; 279 | INFOPLIST_FILE = "Smooth Line View/Smooth Line View-Info.plist"; 280 | PRODUCT_NAME = "$(TARGET_NAME)"; 281 | TARGETED_DEVICE_FAMILY = "1,2"; 282 | WRAPPER_EXTENSION = app; 283 | }; 284 | name = Release; 285 | }; 286 | /* End XCBuildConfiguration section */ 287 | 288 | /* Begin XCConfigurationList section */ 289 | 6B93BE6413F3374100DFAB23 /* Build configuration list for PBXProject "Smooth Line View" */ = { 290 | isa = XCConfigurationList; 291 | buildConfigurations = ( 292 | 6B93BE8913F3374200DFAB23 /* Debug */, 293 | 6B93BE8A13F3374200DFAB23 /* Release */, 294 | ); 295 | defaultConfigurationIsVisible = 0; 296 | defaultConfigurationName = Release; 297 | }; 298 | 6B93BE8B13F3374200DFAB23 /* Build configuration list for PBXNativeTarget "Smooth Line View" */ = { 299 | isa = XCConfigurationList; 300 | buildConfigurations = ( 301 | 6B93BE8C13F3374200DFAB23 /* Debug */, 302 | 6B93BE8D13F3374200DFAB23 /* Release */, 303 | ); 304 | defaultConfigurationIsVisible = 0; 305 | defaultConfigurationName = Release; 306 | }; 307 | /* End XCConfigurationList section */ 308 | }; 309 | rootObject = 6B93BE6113F3374100DFAB23 /* Project object */; 310 | } 311 | -------------------------------------------------------------------------------- /Smooth Line View.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Smooth Line View.xcodeproj/project.xcworkspace/xcuserdata/nunnikl.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/levinunnink/Smooth-Line-View/8371f138e38b144cde40c5f23eeafcce9a1e6d4b/Smooth Line View.xcodeproj/project.xcworkspace/xcuserdata/nunnikl.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Smooth Line View.xcodeproj/xcuserdata/nunnikl.xcuserdatad/xcschemes/Smooth Line View.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 45 | 46 | 47 | 48 | 49 | 50 | 55 | 56 | 62 | 63 | 64 | 65 | 67 | 68 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Smooth Line View.xcodeproj/xcuserdata/nunnikl.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Smooth Line View.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6B93BE6913F3374200DFAB23 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Smooth Line View/Smooth Line View-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.culturezoo.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | NSMainNibFile 30 | MainWindow 31 | UISupportedInterfaceOrientations~ipad 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Smooth Line View/Smooth Line View-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Smooth Line View' target in the 'Smooth Line View' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Smooth Line View/SmoothLineView.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013 Levi Nunnink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // 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, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // 23 | // Created by Levi Nunnink (@a_band) http://culturezoo.com 24 | // Copyright (C) Droplr Inc. All Rights Reserved 25 | // 26 | 27 | #import 28 | 29 | 30 | 31 | @interface SmoothLineView : UIView 32 | 33 | @property (nonatomic, strong) UIColor *lineColor; 34 | @property (nonatomic, assign) CGFloat lineWidth; 35 | @property (nonatomic, assign) BOOL empty; 36 | 37 | -(void)clear; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Smooth Line View/SmoothLineView.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013 Levi Nunnink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // 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, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // 23 | // Created by Levi Nunnink (@a_band) http://culturezoo.com 24 | // Copyright (C) Droplr Inc. All Rights Reserved 25 | // 26 | 27 | #import "SmoothLineView.h" 28 | #import 29 | 30 | #define DEFAULT_COLOR [UIColor blackColor] 31 | #define DEFAULT_WIDTH 5.0f 32 | #define DEFAULT_BACKGROUND_COLOR [UIColor whiteColor] 33 | 34 | static const CGFloat kPointMinDistance = 5.0f; 35 | static const CGFloat kPointMinDistanceSquared = kPointMinDistance * kPointMinDistance; 36 | 37 | @interface SmoothLineView () 38 | @property (nonatomic,assign) CGPoint currentPoint; 39 | @property (nonatomic,assign) CGPoint previousPoint; 40 | @property (nonatomic,assign) CGPoint previousPreviousPoint; 41 | 42 | #pragma mark Private Helper function 43 | CGPoint midPoint(CGPoint p1, CGPoint p2); 44 | @end 45 | 46 | @implementation SmoothLineView { 47 | @private 48 | CGMutablePathRef _path; 49 | } 50 | 51 | #pragma mark UIView lifecycle methods 52 | 53 | - (id)initWithCoder:(NSCoder *)aDecoder { 54 | self = [super initWithCoder:aDecoder]; 55 | 56 | if (self) { 57 | // NOTE: do not change the backgroundColor here, so it can be set in IB. 58 | _path = CGPathCreateMutable(); 59 | _lineWidth = DEFAULT_WIDTH; 60 | _lineColor = DEFAULT_COLOR; 61 | _empty = YES; 62 | } 63 | 64 | return self; 65 | } 66 | 67 | - (id)initWithFrame:(CGRect)frame { 68 | self = [super initWithFrame:frame]; 69 | 70 | if (self) { 71 | self.backgroundColor = DEFAULT_BACKGROUND_COLOR; 72 | _path = CGPathCreateMutable(); 73 | _lineWidth = DEFAULT_WIDTH; 74 | _lineColor = DEFAULT_COLOR; 75 | _empty = YES; 76 | } 77 | 78 | return self; 79 | } 80 | 81 | - (void)drawRect:(CGRect)rect { 82 | // clear rect 83 | [self.backgroundColor set]; 84 | UIRectFill(rect); 85 | 86 | // get the graphics context and draw the path 87 | CGContextRef context = UIGraphicsGetCurrentContext(); 88 | CGContextAddPath(context, _path); 89 | CGContextSetLineCap(context, kCGLineCapRound); 90 | CGContextSetLineWidth(context, self.lineWidth); 91 | CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor); 92 | 93 | CGContextStrokePath(context); 94 | 95 | self.empty = NO; 96 | } 97 | 98 | -(void)dealloc { 99 | CGPathRelease(_path); 100 | } 101 | 102 | #pragma mark private Helper function 103 | 104 | CGPoint midPoint(CGPoint p1, CGPoint p2) { 105 | return CGPointMake((p1.x + p2.x) * 0.5, (p1.y + p2.y) * 0.5); 106 | } 107 | 108 | #pragma mark Touch event handlers 109 | 110 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 111 | UITouch *touch = [touches anyObject]; 112 | 113 | // initializes our point records to current location 114 | self.previousPoint = [touch previousLocationInView:self]; 115 | self.previousPreviousPoint = [touch previousLocationInView:self]; 116 | self.currentPoint = [touch locationInView:self]; 117 | 118 | // call touchesMoved:withEvent:, to possibly draw on zero movement 119 | [self touchesMoved:touches withEvent:event]; 120 | } 121 | 122 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 123 | UITouch *touch = [touches anyObject]; 124 | 125 | CGPoint point = [touch locationInView:self]; 126 | 127 | // if the finger has moved less than the min dist ... 128 | CGFloat dx = point.x - self.currentPoint.x; 129 | CGFloat dy = point.y - self.currentPoint.y; 130 | 131 | if ((dx * dx + dy * dy) < kPointMinDistanceSquared) { 132 | // ... then ignore this movement 133 | return; 134 | } 135 | 136 | // update points: previousPrevious -> mid1 -> previous -> mid2 -> current 137 | self.previousPreviousPoint = self.previousPoint; 138 | self.previousPoint = [touch previousLocationInView:self]; 139 | self.currentPoint = [touch locationInView:self]; 140 | 141 | CGPoint mid1 = midPoint(self.previousPoint, self.previousPreviousPoint); 142 | CGPoint mid2 = midPoint(self.currentPoint, self.previousPoint); 143 | 144 | // to represent the finger movement, create a new path segment, 145 | // a quadratic bezier path from mid1 to mid2, using previous as a control point 146 | CGMutablePathRef subpath = CGPathCreateMutable(); 147 | CGPathMoveToPoint(subpath, NULL, mid1.x, mid1.y); 148 | CGPathAddQuadCurveToPoint(subpath, NULL, 149 | self.previousPoint.x, self.previousPoint.y, 150 | mid2.x, mid2.y); 151 | 152 | // compute the rect containing the new segment plus padding for drawn line 153 | CGRect bounds = CGPathGetBoundingBox(subpath); 154 | CGRect drawBox = CGRectInset(bounds, -2.0 * self.lineWidth, -2.0 * self.lineWidth); 155 | 156 | // append the quad curve to the accumulated path so far. 157 | CGPathAddPath(_path, NULL, subpath); 158 | CGPathRelease(subpath); 159 | 160 | [self setNeedsDisplayInRect:drawBox]; 161 | } 162 | 163 | #pragma mark interface 164 | 165 | -(void)clear { 166 | CGMutablePathRef oldPath = _path; 167 | CFRelease(oldPath); 168 | _path = CGPathCreateMutable(); 169 | [self setNeedsDisplay]; 170 | } 171 | 172 | @end 173 | 174 | -------------------------------------------------------------------------------- /Smooth Line View/Smooth_Line_ViewAppDelegate.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013 Levi Nunnink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // 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, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // 23 | // Created by Levi Nunnink (@a_band) http://culturezoo.com 24 | // Copyright (C) Droplr Inc. All Rights Reserved 25 | // 26 | 27 | #import 28 | 29 | @class Smooth_Line_ViewViewController; 30 | 31 | @interface Smooth_Line_ViewAppDelegate : NSObject 32 | 33 | @property (nonatomic, strong) IBOutlet UIWindow *window; 34 | 35 | @property (nonatomic, strong) IBOutlet Smooth_Line_ViewViewController *viewController; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Smooth Line View/Smooth_Line_ViewAppDelegate.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013 Levi Nunnink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // 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, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // 23 | // Created by Levi Nunnink (@a_band) http://culturezoo.com 24 | // Copyright (C) Droplr Inc. All Rights Reserved 25 | // 26 | 27 | #import "Smooth_Line_ViewAppDelegate.h" 28 | 29 | #import "Smooth_Line_ViewViewController.h" 30 | 31 | @implementation Smooth_Line_ViewAppDelegate 32 | 33 | @synthesize window = _window; 34 | @synthesize viewController = _viewController; 35 | 36 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 37 | { 38 | // Override point for customization after application launch. 39 | NSLog(@"Smooth Line Launched"); 40 | self.window.rootViewController = self.viewController; 41 | [self.window makeKeyAndVisible]; 42 | return YES; 43 | } 44 | 45 | - (void)applicationWillResignActive:(UIApplication *)application 46 | { 47 | /* 48 | 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. 49 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 50 | */ 51 | } 52 | 53 | - (void)applicationDidEnterBackground:(UIApplication *)application 54 | { 55 | /* 56 | 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. 57 | If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 58 | */ 59 | } 60 | 61 | - (void)applicationWillEnterForeground:(UIApplication *)application 62 | { 63 | /* 64 | Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 65 | */ 66 | } 67 | 68 | - (void)applicationDidBecomeActive:(UIApplication *)application 69 | { 70 | /* 71 | 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. 72 | */ 73 | } 74 | 75 | - (void)applicationWillTerminate:(UIApplication *)application 76 | { 77 | /* 78 | Called when the application is about to terminate. 79 | Save data if appropriate. 80 | See also applicationDidEnterBackground:. 81 | */ 82 | } 83 | 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /Smooth Line View/Smooth_Line_ViewViewController.h: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013 Levi Nunnink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // 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, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // 23 | // Created by Levi Nunnink (@a_band) http://culturezoo.com 24 | // Copyright (C) Droplr Inc. All Rights Reserved 25 | // 26 | 27 | 28 | #import 29 | #import "SmoothLineView.h" 30 | 31 | @interface Smooth_Line_ViewViewController : UIViewController @end 32 | -------------------------------------------------------------------------------- /Smooth Line View/Smooth_Line_ViewViewController.m: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013 Levi Nunnink 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // 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, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // 23 | // Created by Levi Nunnink (@a_band) http://culturezoo.com 24 | // Copyright (C) Droplr Inc. All Rights Reserved 25 | // 26 | 27 | 28 | #import "Smooth_Line_ViewViewController.h" 29 | 30 | #import 31 | 32 | @interface Smooth_Line_ViewViewController () 33 | @property (nonatomic) SmoothLineView * canvas; 34 | @end 35 | 36 | @implementation Smooth_Line_ViewViewController 37 | 38 | - (void)viewDidLoad 39 | { 40 | SmoothLineView * smoothLineView =[[SmoothLineView alloc] initWithFrame:self.view.bounds ]; 41 | self.canvas = smoothLineView; 42 | [self.view addSubview:smoothLineView]; 43 | } 44 | 45 | -(BOOL)canBecomeFirstResponder { 46 | return YES; 47 | } 48 | 49 | -(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event 50 | { 51 | [self.canvas clear]; 52 | } 53 | @end 54 | 55 | 56 | -------------------------------------------------------------------------------- /Smooth Line View/Smooth_Line_ViewViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1296 5 | 12A269 6 | 2549 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1498 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBIPadFramework 28 | 29 | 30 | IBFirstResponder 31 | IBIPadFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 20}, {768, 1004}} 37 | 38 | 39 | 40 | 41 | 3 42 | MQA 43 | 44 | 2 45 | 46 | 47 | 48 | 2 49 | 50 | IBIPadFramework 51 | 52 | 53 | 54 | 55 | 56 | 57 | view 58 | 59 | 60 | 61 | 3 62 | 63 | 64 | 65 | 66 | 67 | 0 68 | 69 | 70 | 71 | 72 | 73 | 1 74 | 75 | 76 | 77 | 78 | -1 79 | 80 | 81 | File's Owner 82 | 83 | 84 | -2 85 | 86 | 87 | 88 | 89 | 90 | 91 | Smooth_Line_ViewViewController 92 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 93 | UIResponder 94 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 95 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 96 | 97 | 98 | 99 | 100 | 101 | 3 102 | 103 | 104 | 105 | 106 | Smooth_Line_ViewViewController 107 | UIViewController 108 | 109 | IBProjectSource 110 | ./Classes/Smooth_Line_ViewViewController.h 111 | 112 | 113 | 114 | 115 | 0 116 | IBIPadFramework 117 | 118 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 119 | 120 | 121 | YES 122 | 3 123 | 1498 124 | 125 | 126 | -------------------------------------------------------------------------------- /Smooth Line View/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Smooth Line View/en.lproj/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 800 5 | 10D540 6 | 760 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 81 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 292 43 | {768, 1024} 44 | 45 | 46 | 1 47 | MSAxIDEAA 48 | 49 | NO 50 | NO 51 | 52 | 2 53 | 54 | IBIPadFramework 55 | YES 56 | 57 | 58 | IBIPadFramework 59 | 60 | 61 | Smooth_Line_ViewViewController 62 | 63 | IBIPadFramework 64 | 65 | 66 | 67 | 68 | YES 69 | 70 | 71 | viewController 72 | 73 | 74 | 75 | 8 76 | 77 | 78 | 79 | delegate 80 | 81 | 82 | 83 | 9 84 | 85 | 86 | 87 | window 88 | 89 | 90 | 91 | 10 92 | 93 | 94 | 95 | 96 | YES 97 | 98 | 0 99 | 100 | 101 | 102 | 103 | 104 | -1 105 | 106 | 107 | File's Owner 108 | 109 | 110 | -2 111 | 112 | 113 | 114 | 115 | 2 116 | 117 | 118 | 119 | 120 | 6 121 | 122 | 123 | Smooth_Line_View App Delegate 124 | 125 | 126 | 7 127 | 128 | 129 | 130 | 131 | 132 | 133 | YES 134 | 135 | YES 136 | -1.CustomClassName 137 | -2.CustomClassName 138 | 2.IBEditorWindowLastContentRect 139 | 2.IBPluginDependency 140 | 6.CustomClassName 141 | 6.IBPluginDependency 142 | 7.CustomClassName 143 | 7.IBEditorWindowLastContentRect 144 | 7.IBPluginDependency 145 | 146 | 147 | YES 148 | UIApplication 149 | UIResponder 150 | {{200, 57}, {783, 799}} 151 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 152 | Smooth_Line_ViewAppDelegate 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | Smooth_Line_ViewViewController 155 | {{512, 351}, {320, 480}} 156 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 157 | 158 | 159 | 160 | YES 161 | 162 | 163 | YES 164 | 165 | 166 | 167 | 168 | YES 169 | 170 | 171 | YES 172 | 173 | 174 | 175 | 10 176 | 177 | 178 | 179 | YES 180 | 181 | Smooth_Line_ViewAppDelegate 182 | NSObject 183 | 184 | YES 185 | 186 | YES 187 | viewController 188 | window 189 | 190 | 191 | YES 192 | Smooth_Line_ViewViewController 193 | UIWindow 194 | 195 | 196 | 197 | IBProjectSource 198 | Smooth_Line_ViewAppDelegate.h 199 | 200 | 201 | 202 | Smooth_Line_ViewViewController 203 | UIViewController 204 | 205 | IBProjectSource 206 | Smooth_Line_ViewViewController.h 207 | 208 | 209 | 210 | 211 | YES 212 | 213 | NSObject 214 | 215 | IBFrameworkSource 216 | Foundation.framework/Headers/NSError.h 217 | 218 | 219 | 220 | NSObject 221 | 222 | IBFrameworkSource 223 | Foundation.framework/Headers/NSFileManager.h 224 | 225 | 226 | 227 | NSObject 228 | 229 | IBFrameworkSource 230 | Foundation.framework/Headers/NSKeyValueCoding.h 231 | 232 | 233 | 234 | NSObject 235 | 236 | IBFrameworkSource 237 | Foundation.framework/Headers/NSKeyValueObserving.h 238 | 239 | 240 | 241 | NSObject 242 | 243 | IBFrameworkSource 244 | Foundation.framework/Headers/NSKeyedArchiver.h 245 | 246 | 247 | 248 | NSObject 249 | 250 | IBFrameworkSource 251 | Foundation.framework/Headers/NSNetServices.h 252 | 253 | 254 | 255 | NSObject 256 | 257 | IBFrameworkSource 258 | Foundation.framework/Headers/NSObject.h 259 | 260 | 261 | 262 | NSObject 263 | 264 | IBFrameworkSource 265 | Foundation.framework/Headers/NSPort.h 266 | 267 | 268 | 269 | NSObject 270 | 271 | IBFrameworkSource 272 | Foundation.framework/Headers/NSRunLoop.h 273 | 274 | 275 | 276 | NSObject 277 | 278 | IBFrameworkSource 279 | Foundation.framework/Headers/NSStream.h 280 | 281 | 282 | 283 | NSObject 284 | 285 | IBFrameworkSource 286 | Foundation.framework/Headers/NSThread.h 287 | 288 | 289 | 290 | NSObject 291 | 292 | IBFrameworkSource 293 | Foundation.framework/Headers/NSURL.h 294 | 295 | 296 | 297 | NSObject 298 | 299 | IBFrameworkSource 300 | Foundation.framework/Headers/NSURLConnection.h 301 | 302 | 303 | 304 | NSObject 305 | 306 | IBFrameworkSource 307 | Foundation.framework/Headers/NSXMLParser.h 308 | 309 | 310 | 311 | NSObject 312 | 313 | IBFrameworkSource 314 | UIKit.framework/Headers/UIAccessibility.h 315 | 316 | 317 | 318 | NSObject 319 | 320 | IBFrameworkSource 321 | UIKit.framework/Headers/UINibLoading.h 322 | 323 | 324 | 325 | NSObject 326 | 327 | IBFrameworkSource 328 | UIKit.framework/Headers/UIResponder.h 329 | 330 | 331 | 332 | UIApplication 333 | UIResponder 334 | 335 | IBFrameworkSource 336 | UIKit.framework/Headers/UIApplication.h 337 | 338 | 339 | 340 | UIResponder 341 | NSObject 342 | 343 | 344 | 345 | UIResponder 346 | 347 | IBFrameworkSource 348 | UIKit.framework/Headers/UITextInput.h 349 | 350 | 351 | 352 | UISearchBar 353 | UIView 354 | 355 | IBFrameworkSource 356 | UIKit.framework/Headers/UISearchBar.h 357 | 358 | 359 | 360 | UISearchDisplayController 361 | NSObject 362 | 363 | IBFrameworkSource 364 | UIKit.framework/Headers/UISearchDisplayController.h 365 | 366 | 367 | 368 | UIView 369 | 370 | IBFrameworkSource 371 | UIKit.framework/Headers/UITextField.h 372 | 373 | 374 | 375 | UIView 376 | UIResponder 377 | 378 | IBFrameworkSource 379 | UIKit.framework/Headers/UIView.h 380 | 381 | 382 | 383 | UIViewController 384 | 385 | IBFrameworkSource 386 | UIKit.framework/Headers/UINavigationController.h 387 | 388 | 389 | 390 | UIViewController 391 | 392 | IBFrameworkSource 393 | UIKit.framework/Headers/UISplitViewController.h 394 | 395 | 396 | 397 | UIViewController 398 | 399 | IBFrameworkSource 400 | UIKit.framework/Headers/UITabBarController.h 401 | 402 | 403 | 404 | UIViewController 405 | UIResponder 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UIViewController.h 409 | 410 | 411 | 412 | UIWindow 413 | UIView 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIWindow.h 417 | 418 | 419 | 420 | 421 | 0 422 | IBIPadFramework 423 | 424 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 425 | 426 | 427 | 428 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 429 | 430 | 431 | YES 432 | Smooth Line View.xcodeproj 433 | 3 434 | 81 435 | 436 | 437 | -------------------------------------------------------------------------------- /Smooth Line View/en.lproj/Smooth_Line_ViewViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1296 5 | 12A269 6 | 2549 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1498 12 | 13 | 14 | YES 15 | IBProxyObject 16 | IBUIView 17 | 18 | 19 | YES 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | YES 28 | 29 | IBFilesOwner 30 | IBIPadFramework 31 | 32 | 33 | IBFirstResponder 34 | IBIPadFramework 35 | 36 | 37 | 38 | 274 39 | 40 | YES 41 | 42 | 43 | 274 44 | {{20, 131}, {737, 601}} 45 | 46 | 47 | 48 | _NS:9 49 | 50 | 3 51 | MQA 52 | 53 | 2 54 | 55 | 56 | IBIPadFramework 57 | 58 | 59 | {{0, 20}, {768, 1004}} 60 | 61 | 62 | 63 | 64 | 3 65 | MQA 66 | 67 | 68 | 69 | 2 70 | 71 | IBIPadFramework 72 | 73 | 74 | 75 | 76 | YES 77 | 78 | 79 | view 80 | 81 | 82 | 83 | 3 84 | 85 | 86 | 87 | 88 | YES 89 | 90 | 0 91 | 92 | YES 93 | 94 | 95 | 96 | 97 | 98 | -1 99 | 100 | 101 | File's Owner 102 | 103 | 104 | -2 105 | 106 | 107 | 108 | 109 | 2 110 | 111 | 112 | YES 113 | 114 | 115 | 116 | 117 | 118 | 11 119 | 120 | 121 | 122 | 123 | 124 | 125 | YES 126 | 127 | YES 128 | -1.CustomClassName 129 | -1.IBPluginDependency 130 | -2.CustomClassName 131 | -2.IBPluginDependency 132 | 11.CustomClassName 133 | 11.IBPluginDependency 134 | 2.IBPluginDependency 135 | 136 | 137 | YES 138 | Smooth_Line_ViewViewController 139 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 140 | UIResponder 141 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 142 | SmoothLineView 143 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 144 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 145 | 146 | 147 | 148 | YES 149 | 150 | 151 | 152 | 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | 11 160 | 161 | 162 | 163 | YES 164 | 165 | SmoothLineView 166 | UIView 167 | 168 | IBProjectSource 169 | ./Classes/SmoothLineView.h 170 | 171 | 172 | 173 | Smooth_Line_ViewViewController 174 | UIViewController 175 | 176 | IBProjectSource 177 | ./Classes/Smooth_Line_ViewViewController.h 178 | 179 | 180 | 181 | 182 | 0 183 | IBIPadFramework 184 | 185 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 186 | 187 | 188 | 189 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 190 | 191 | 192 | YES 193 | 3 194 | 1498 195 | 196 | 197 | -------------------------------------------------------------------------------- /Smooth Line View/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Smooth Line View 4 | // 5 | // Created by Levi Nunnink on 8/10/11. 6 | // Copyright 2011 culturezoo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | @autoreleasepool { 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | return retVal; 16 | } 17 | } 18 | --------------------------------------------------------------------------------