├── .gitignore ├── Clock ├── Clock.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Clock │ ├── Base.lproj │ │ ├── Main_iPad.storyboard │ │ └── Main_iPhone.storyboard │ ├── Clock-Info.plist │ ├── Clock-Prefix.pch │ ├── Clock-Source │ │ ├── SPClockView.h │ │ └── SPClockView.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── SPAppDelegate.h │ ├── SPAppDelegate.m │ ├── SPViewController.h │ ├── SPViewController.m │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m └── ClockTests │ ├── ClockTests-Info.plist │ ├── ClockTests.m │ └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md └── _config.yml /.gitignore: -------------------------------------------------------------------------------- 1 | ######################### 2 | # .gitignore file for Xcode4 / OS X Source projects 3 | # 4 | # Version 2.0 5 | # For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects 6 | # 7 | # 2013 updates: 8 | # - fixed the broken "save personal Schemes" 9 | # 10 | # NB: if you are storing "built" products, this WILL NOT WORK, 11 | # and you should use a different .gitignore (or none at all) 12 | # This file is for SOURCE projects, where there are many extra 13 | # files that we want to exclude 14 | # 15 | ######################### 16 | 17 | ##### 18 | # OS X temporary files that should never be committed 19 | 20 | .DS_Store 21 | *.swp 22 | *.lock 23 | profile 24 | 25 | 26 | #### 27 | # Xcode temporary files that should never be committed 28 | # 29 | # NB: NIB/XIB files still exist even on Storyboard projects, so we want this... 30 | 31 | *~.nib 32 | 33 | 34 | #### 35 | # Xcode build files - 36 | # 37 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData" 38 | 39 | DerivedData/ 40 | 41 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build" 42 | 43 | build/ 44 | 45 | 46 | ##### 47 | # Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) 48 | # 49 | # This is complicated: 50 | # 51 | # SOMETIMES you need to put this file in version control. 52 | # Apple designed it poorly - if you use "custom executables", they are 53 | # saved in this file. 54 | # 99% of projects do NOT use those, so they do NOT want to version control this file. 55 | # ..but if you're in the 1%, comment out the line "*.pbxuser" 56 | 57 | *.pbxuser 58 | *.mode1v3 59 | *.mode2v3 60 | *.perspectivev3 61 | # NB: also, whitelist the default ones, some projects need to use these 62 | !default.pbxuser 63 | !default.mode1v3 64 | !default.mode2v3 65 | !default.perspectivev3 66 | 67 | 68 | #### 69 | # Xcode 4 - semi-personal settings 70 | # 71 | # 72 | # OPTION 1: --------------------------------- 73 | # throw away ALL personal settings (including custom schemes! 74 | # - unless they are "shared") 75 | # 76 | # NB: this is exclusive with OPTION 2 below 77 | xcuserdata 78 | 79 | # OPTION 2: --------------------------------- 80 | # get rid of ALL personal settings, but KEEP SOME OF THEM 81 | # - NB: you must manually uncomment the bits you want to keep 82 | # 83 | # NB: this is exclusive with OPTION 1 above 84 | # 85 | #xcuserdata/**/* 86 | 87 | # (requires option 2 above): Personal Schemes 88 | # 89 | #!xcuserdata/**/xcschemes/* 90 | 91 | #### 92 | # XCode 4 workspaces - more detailed 93 | # 94 | # Workspaces are important! They are a core feature of Xcode - don't exclude them :) 95 | # 96 | # Workspace layout is quite spammy. For reference: 97 | # 98 | # /(root)/ 99 | # /(project-name).xcodeproj/ 100 | # project.pbxproj 101 | # /project.xcworkspace/ 102 | # contents.xcworkspacedata 103 | # /xcuserdata/ 104 | # /(your name)/xcuserdatad/ 105 | # UserInterfaceState.xcuserstate 106 | # /xcsshareddata/ 107 | # /xcschemes/ 108 | # (shared scheme name).xcscheme 109 | # /xcuserdata/ 110 | # /(your name)/xcuserdatad/ 111 | # (private scheme).xcscheme 112 | # xcschememanagement.plist 113 | # 114 | # 115 | 116 | #### 117 | # Xcode 4 - Deprecated classes 118 | # 119 | # Allegedly, if you manually "deprecate" your classes, they get moved here. 120 | # 121 | # We're using source-control, so this is a "feature" that we do not want! 122 | 123 | *.moved-aside 124 | 125 | 126 | #### 127 | # UNKNOWN: recommended by others, but I can't discover what these files are 128 | # 129 | # ...none. Everything is now explained. 130 | 131 | #### 132 | #CocoaPods 133 | #CocoaPods 134 | Pods/ 135 | # -------------------------------------------------------------------------------- /Clock/Clock.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 90B5A2FA199F713000676FF1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90B5A2F9199F713000676FF1 /* Foundation.framework */; }; 11 | 90B5A2FC199F713000676FF1 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90B5A2FB199F713000676FF1 /* CoreGraphics.framework */; }; 12 | 90B5A2FE199F713000676FF1 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90B5A2FD199F713000676FF1 /* UIKit.framework */; }; 13 | 90B5A304199F713000676FF1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 90B5A302199F713000676FF1 /* InfoPlist.strings */; }; 14 | 90B5A306199F713000676FF1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B5A305199F713000676FF1 /* main.m */; }; 15 | 90B5A30A199F713000676FF1 /* SPAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B5A309199F713000676FF1 /* SPAppDelegate.m */; }; 16 | 90B5A30D199F713000676FF1 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90B5A30B199F713000676FF1 /* Main_iPhone.storyboard */; }; 17 | 90B5A310199F713000676FF1 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90B5A30E199F713000676FF1 /* Main_iPad.storyboard */; }; 18 | 90B5A313199F713000676FF1 /* SPViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B5A312199F713000676FF1 /* SPViewController.m */; }; 19 | 90B5A315199F713000676FF1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 90B5A314199F713000676FF1 /* Images.xcassets */; }; 20 | 90B5A31C199F713000676FF1 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90B5A31B199F713000676FF1 /* XCTest.framework */; }; 21 | 90B5A31D199F713000676FF1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90B5A2F9199F713000676FF1 /* Foundation.framework */; }; 22 | 90B5A31E199F713000676FF1 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90B5A2FD199F713000676FF1 /* UIKit.framework */; }; 23 | 90B5A326199F713000676FF1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 90B5A324199F713000676FF1 /* InfoPlist.strings */; }; 24 | 90B5A328199F713000676FF1 /* ClockTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B5A327199F713000676FF1 /* ClockTests.m */; }; 25 | 90B5A334199F73A000676FF1 /* SPClockView.m in Sources */ = {isa = PBXBuildFile; fileRef = 90B5A333199F73A000676FF1 /* SPClockView.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 90B5A31F199F713000676FF1 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 90B5A2EE199F713000676FF1 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 90B5A2F5199F713000676FF1; 34 | remoteInfo = Clock; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 90B5A2F6199F713000676FF1 /* Clock.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Clock.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 90B5A2F9199F713000676FF1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | 90B5A2FB199F713000676FF1 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | 90B5A2FD199F713000676FF1 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 90B5A301199F713000676FF1 /* Clock-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Clock-Info.plist"; sourceTree = ""; }; 44 | 90B5A303199F713000676FF1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | 90B5A305199F713000676FF1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 90B5A307199F713000676FF1 /* Clock-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Clock-Prefix.pch"; sourceTree = ""; }; 47 | 90B5A308199F713000676FF1 /* SPAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPAppDelegate.h; sourceTree = ""; }; 48 | 90B5A309199F713000676FF1 /* SPAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPAppDelegate.m; sourceTree = ""; }; 49 | 90B5A30C199F713000676FF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; 50 | 90B5A30F199F713000676FF1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; 51 | 90B5A311199F713000676FF1 /* SPViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPViewController.h; sourceTree = ""; }; 52 | 90B5A312199F713000676FF1 /* SPViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPViewController.m; sourceTree = ""; }; 53 | 90B5A314199F713000676FF1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 54 | 90B5A31A199F713000676FF1 /* ClockTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ClockTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 90B5A31B199F713000676FF1 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 56 | 90B5A323199F713000676FF1 /* ClockTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ClockTests-Info.plist"; sourceTree = ""; }; 57 | 90B5A325199F713000676FF1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 58 | 90B5A327199F713000676FF1 /* ClockTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ClockTests.m; sourceTree = ""; }; 59 | 90B5A332199F73A000676FF1 /* SPClockView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPClockView.h; sourceTree = ""; }; 60 | 90B5A333199F73A000676FF1 /* SPClockView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPClockView.m; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 90B5A2F3199F713000676FF1 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 90B5A2FC199F713000676FF1 /* CoreGraphics.framework in Frameworks */, 69 | 90B5A2FE199F713000676FF1 /* UIKit.framework in Frameworks */, 70 | 90B5A2FA199F713000676FF1 /* Foundation.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 90B5A317199F713000676FF1 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | 90B5A31C199F713000676FF1 /* XCTest.framework in Frameworks */, 79 | 90B5A31E199F713000676FF1 /* UIKit.framework in Frameworks */, 80 | 90B5A31D199F713000676FF1 /* Foundation.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | 90B5A2ED199F713000676FF1 = { 88 | isa = PBXGroup; 89 | children = ( 90 | 90B5A2FF199F713000676FF1 /* Clock */, 91 | 90B5A321199F713000676FF1 /* ClockTests */, 92 | 90B5A2F8199F713000676FF1 /* Frameworks */, 93 | 90B5A2F7199F713000676FF1 /* Products */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 90B5A2F7199F713000676FF1 /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 90B5A2F6199F713000676FF1 /* Clock.app */, 101 | 90B5A31A199F713000676FF1 /* ClockTests.xctest */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 90B5A2F8199F713000676FF1 /* Frameworks */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 90B5A2F9199F713000676FF1 /* Foundation.framework */, 110 | 90B5A2FB199F713000676FF1 /* CoreGraphics.framework */, 111 | 90B5A2FD199F713000676FF1 /* UIKit.framework */, 112 | 90B5A31B199F713000676FF1 /* XCTest.framework */, 113 | ); 114 | name = Frameworks; 115 | sourceTree = ""; 116 | }; 117 | 90B5A2FF199F713000676FF1 /* Clock */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 90B5A331199F734000676FF1 /* Clock-Source */, 121 | 90B5A308199F713000676FF1 /* SPAppDelegate.h */, 122 | 90B5A309199F713000676FF1 /* SPAppDelegate.m */, 123 | 90B5A30B199F713000676FF1 /* Main_iPhone.storyboard */, 124 | 90B5A30E199F713000676FF1 /* Main_iPad.storyboard */, 125 | 90B5A311199F713000676FF1 /* SPViewController.h */, 126 | 90B5A312199F713000676FF1 /* SPViewController.m */, 127 | 90B5A314199F713000676FF1 /* Images.xcassets */, 128 | 90B5A300199F713000676FF1 /* Supporting Files */, 129 | ); 130 | path = Clock; 131 | sourceTree = ""; 132 | }; 133 | 90B5A300199F713000676FF1 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 90B5A301199F713000676FF1 /* Clock-Info.plist */, 137 | 90B5A302199F713000676FF1 /* InfoPlist.strings */, 138 | 90B5A305199F713000676FF1 /* main.m */, 139 | 90B5A307199F713000676FF1 /* Clock-Prefix.pch */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | 90B5A321199F713000676FF1 /* ClockTests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 90B5A327199F713000676FF1 /* ClockTests.m */, 148 | 90B5A322199F713000676FF1 /* Supporting Files */, 149 | ); 150 | path = ClockTests; 151 | sourceTree = ""; 152 | }; 153 | 90B5A322199F713000676FF1 /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 90B5A323199F713000676FF1 /* ClockTests-Info.plist */, 157 | 90B5A324199F713000676FF1 /* InfoPlist.strings */, 158 | ); 159 | name = "Supporting Files"; 160 | sourceTree = ""; 161 | }; 162 | 90B5A331199F734000676FF1 /* Clock-Source */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 90B5A332199F73A000676FF1 /* SPClockView.h */, 166 | 90B5A333199F73A000676FF1 /* SPClockView.m */, 167 | ); 168 | path = "Clock-Source"; 169 | sourceTree = ""; 170 | }; 171 | /* End PBXGroup section */ 172 | 173 | /* Begin PBXNativeTarget section */ 174 | 90B5A2F5199F713000676FF1 /* Clock */ = { 175 | isa = PBXNativeTarget; 176 | buildConfigurationList = 90B5A32B199F713000676FF1 /* Build configuration list for PBXNativeTarget "Clock" */; 177 | buildPhases = ( 178 | 90B5A2F2199F713000676FF1 /* Sources */, 179 | 90B5A2F3199F713000676FF1 /* Frameworks */, 180 | 90B5A2F4199F713000676FF1 /* Resources */, 181 | ); 182 | buildRules = ( 183 | ); 184 | dependencies = ( 185 | ); 186 | name = Clock; 187 | productName = Clock; 188 | productReference = 90B5A2F6199F713000676FF1 /* Clock.app */; 189 | productType = "com.apple.product-type.application"; 190 | }; 191 | 90B5A319199F713000676FF1 /* ClockTests */ = { 192 | isa = PBXNativeTarget; 193 | buildConfigurationList = 90B5A32E199F713000676FF1 /* Build configuration list for PBXNativeTarget "ClockTests" */; 194 | buildPhases = ( 195 | 90B5A316199F713000676FF1 /* Sources */, 196 | 90B5A317199F713000676FF1 /* Frameworks */, 197 | 90B5A318199F713000676FF1 /* Resources */, 198 | ); 199 | buildRules = ( 200 | ); 201 | dependencies = ( 202 | 90B5A320199F713000676FF1 /* PBXTargetDependency */, 203 | ); 204 | name = ClockTests; 205 | productName = ClockTests; 206 | productReference = 90B5A31A199F713000676FF1 /* ClockTests.xctest */; 207 | productType = "com.apple.product-type.bundle.unit-test"; 208 | }; 209 | /* End PBXNativeTarget section */ 210 | 211 | /* Begin PBXProject section */ 212 | 90B5A2EE199F713000676FF1 /* Project object */ = { 213 | isa = PBXProject; 214 | attributes = { 215 | CLASSPREFIX = SP; 216 | LastUpgradeCheck = 0510; 217 | ORGANIZATIONNAME = "Su Media"; 218 | TargetAttributes = { 219 | 90B5A319199F713000676FF1 = { 220 | TestTargetID = 90B5A2F5199F713000676FF1; 221 | }; 222 | }; 223 | }; 224 | buildConfigurationList = 90B5A2F1199F713000676FF1 /* Build configuration list for PBXProject "Clock" */; 225 | compatibilityVersion = "Xcode 3.2"; 226 | developmentRegion = English; 227 | hasScannedForEncodings = 0; 228 | knownRegions = ( 229 | en, 230 | Base, 231 | ); 232 | mainGroup = 90B5A2ED199F713000676FF1; 233 | productRefGroup = 90B5A2F7199F713000676FF1 /* Products */; 234 | projectDirPath = ""; 235 | projectRoot = ""; 236 | targets = ( 237 | 90B5A2F5199F713000676FF1 /* Clock */, 238 | 90B5A319199F713000676FF1 /* ClockTests */, 239 | ); 240 | }; 241 | /* End PBXProject section */ 242 | 243 | /* Begin PBXResourcesBuildPhase section */ 244 | 90B5A2F4199F713000676FF1 /* Resources */ = { 245 | isa = PBXResourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 90B5A310199F713000676FF1 /* Main_iPad.storyboard in Resources */, 249 | 90B5A315199F713000676FF1 /* Images.xcassets in Resources */, 250 | 90B5A30D199F713000676FF1 /* Main_iPhone.storyboard in Resources */, 251 | 90B5A304199F713000676FF1 /* InfoPlist.strings in Resources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | 90B5A318199F713000676FF1 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | 90B5A326199F713000676FF1 /* InfoPlist.strings in Resources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXResourcesBuildPhase section */ 264 | 265 | /* Begin PBXSourcesBuildPhase section */ 266 | 90B5A2F2199F713000676FF1 /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | 90B5A306199F713000676FF1 /* main.m in Sources */, 271 | 90B5A313199F713000676FF1 /* SPViewController.m in Sources */, 272 | 90B5A334199F73A000676FF1 /* SPClockView.m in Sources */, 273 | 90B5A30A199F713000676FF1 /* SPAppDelegate.m in Sources */, 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | }; 277 | 90B5A316199F713000676FF1 /* Sources */ = { 278 | isa = PBXSourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | 90B5A328199F713000676FF1 /* ClockTests.m in Sources */, 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | /* End PBXSourcesBuildPhase section */ 286 | 287 | /* Begin PBXTargetDependency section */ 288 | 90B5A320199F713000676FF1 /* PBXTargetDependency */ = { 289 | isa = PBXTargetDependency; 290 | target = 90B5A2F5199F713000676FF1 /* Clock */; 291 | targetProxy = 90B5A31F199F713000676FF1 /* PBXContainerItemProxy */; 292 | }; 293 | /* End PBXTargetDependency section */ 294 | 295 | /* Begin PBXVariantGroup section */ 296 | 90B5A302199F713000676FF1 /* InfoPlist.strings */ = { 297 | isa = PBXVariantGroup; 298 | children = ( 299 | 90B5A303199F713000676FF1 /* en */, 300 | ); 301 | name = InfoPlist.strings; 302 | sourceTree = ""; 303 | }; 304 | 90B5A30B199F713000676FF1 /* Main_iPhone.storyboard */ = { 305 | isa = PBXVariantGroup; 306 | children = ( 307 | 90B5A30C199F713000676FF1 /* Base */, 308 | ); 309 | name = Main_iPhone.storyboard; 310 | sourceTree = ""; 311 | }; 312 | 90B5A30E199F713000676FF1 /* Main_iPad.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | 90B5A30F199F713000676FF1 /* Base */, 316 | ); 317 | name = Main_iPad.storyboard; 318 | sourceTree = ""; 319 | }; 320 | 90B5A324199F713000676FF1 /* InfoPlist.strings */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | 90B5A325199F713000676FF1 /* en */, 324 | ); 325 | name = InfoPlist.strings; 326 | sourceTree = ""; 327 | }; 328 | /* End PBXVariantGroup section */ 329 | 330 | /* Begin XCBuildConfiguration section */ 331 | 90B5A329199F713000676FF1 /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | GCC_C_LANGUAGE_STANDARD = gnu99; 350 | GCC_DYNAMIC_NO_PIC = NO; 351 | GCC_OPTIMIZATION_LEVEL = 0; 352 | GCC_PREPROCESSOR_DEFINITIONS = ( 353 | "DEBUG=1", 354 | "$(inherited)", 355 | ); 356 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 364 | ONLY_ACTIVE_ARCH = YES; 365 | SDKROOT = iphoneos; 366 | TARGETED_DEVICE_FAMILY = "1,2"; 367 | }; 368 | name = Debug; 369 | }; 370 | 90B5A32A199F713000676FF1 /* Release */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 375 | CLANG_CXX_LIBRARY = "libc++"; 376 | CLANG_ENABLE_MODULES = YES; 377 | CLANG_ENABLE_OBJC_ARC = YES; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_CONSTANT_CONVERSION = YES; 380 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 381 | CLANG_WARN_EMPTY_BODY = YES; 382 | CLANG_WARN_ENUM_CONVERSION = YES; 383 | CLANG_WARN_INT_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 386 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 387 | COPY_PHASE_STRIP = YES; 388 | ENABLE_NS_ASSERTIONS = NO; 389 | GCC_C_LANGUAGE_STANDARD = gnu99; 390 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 391 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 392 | GCC_WARN_UNDECLARED_SELECTOR = YES; 393 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 394 | GCC_WARN_UNUSED_FUNCTION = YES; 395 | GCC_WARN_UNUSED_VARIABLE = YES; 396 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 397 | SDKROOT = iphoneos; 398 | TARGETED_DEVICE_FAMILY = "1,2"; 399 | VALIDATE_PRODUCT = YES; 400 | }; 401 | name = Release; 402 | }; 403 | 90B5A32C199F713000676FF1 /* Debug */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 407 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 408 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 409 | GCC_PREFIX_HEADER = "Clock/Clock-Prefix.pch"; 410 | INFOPLIST_FILE = "Clock/Clock-Info.plist"; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | WRAPPER_EXTENSION = app; 413 | }; 414 | name = Debug; 415 | }; 416 | 90B5A32D199F713000676FF1 /* Release */ = { 417 | isa = XCBuildConfiguration; 418 | buildSettings = { 419 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 420 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 421 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 422 | GCC_PREFIX_HEADER = "Clock/Clock-Prefix.pch"; 423 | INFOPLIST_FILE = "Clock/Clock-Info.plist"; 424 | PRODUCT_NAME = "$(TARGET_NAME)"; 425 | WRAPPER_EXTENSION = app; 426 | }; 427 | name = Release; 428 | }; 429 | 90B5A32F199F713000676FF1 /* Debug */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Clock.app/Clock"; 433 | FRAMEWORK_SEARCH_PATHS = ( 434 | "$(SDKROOT)/Developer/Library/Frameworks", 435 | "$(inherited)", 436 | "$(DEVELOPER_FRAMEWORKS_DIR)", 437 | ); 438 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 439 | GCC_PREFIX_HEADER = "Clock/Clock-Prefix.pch"; 440 | GCC_PREPROCESSOR_DEFINITIONS = ( 441 | "DEBUG=1", 442 | "$(inherited)", 443 | ); 444 | INFOPLIST_FILE = "ClockTests/ClockTests-Info.plist"; 445 | PRODUCT_NAME = "$(TARGET_NAME)"; 446 | TEST_HOST = "$(BUNDLE_LOADER)"; 447 | WRAPPER_EXTENSION = xctest; 448 | }; 449 | name = Debug; 450 | }; 451 | 90B5A330199F713000676FF1 /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | buildSettings = { 454 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Clock.app/Clock"; 455 | FRAMEWORK_SEARCH_PATHS = ( 456 | "$(SDKROOT)/Developer/Library/Frameworks", 457 | "$(inherited)", 458 | "$(DEVELOPER_FRAMEWORKS_DIR)", 459 | ); 460 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 461 | GCC_PREFIX_HEADER = "Clock/Clock-Prefix.pch"; 462 | INFOPLIST_FILE = "ClockTests/ClockTests-Info.plist"; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | TEST_HOST = "$(BUNDLE_LOADER)"; 465 | WRAPPER_EXTENSION = xctest; 466 | }; 467 | name = Release; 468 | }; 469 | /* End XCBuildConfiguration section */ 470 | 471 | /* Begin XCConfigurationList section */ 472 | 90B5A2F1199F713000676FF1 /* Build configuration list for PBXProject "Clock" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | 90B5A329199F713000676FF1 /* Debug */, 476 | 90B5A32A199F713000676FF1 /* Release */, 477 | ); 478 | defaultConfigurationIsVisible = 0; 479 | defaultConfigurationName = Release; 480 | }; 481 | 90B5A32B199F713000676FF1 /* Build configuration list for PBXNativeTarget "Clock" */ = { 482 | isa = XCConfigurationList; 483 | buildConfigurations = ( 484 | 90B5A32C199F713000676FF1 /* Debug */, 485 | 90B5A32D199F713000676FF1 /* Release */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | 90B5A32E199F713000676FF1 /* Build configuration list for PBXNativeTarget "ClockTests" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 90B5A32F199F713000676FF1 /* Debug */, 494 | 90B5A330199F713000676FF1 /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | /* End XCConfigurationList section */ 500 | }; 501 | rootObject = 90B5A2EE199F713000676FF1 /* Project object */; 502 | } 503 | -------------------------------------------------------------------------------- /Clock/Clock.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Clock/Clock/Base.lproj/Main_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Clock/Clock/Base.lproj/Main_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Clock/Clock/Clock-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.SuMedia.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main_iPhone 29 | UIMainStoryboardFile~ipad 30 | Main_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Clock/Clock/Clock-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Clock/Clock/Clock-Source/SPClockView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SPClockView.h 3 | // Clock 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SPDigitalClock : UILabel 12 | @property (strong,nonatomic) NSTimeZone *timeZone; 13 | @end 14 | 15 | @interface SPClockView : UIView 16 | 17 | @property (strong,nonatomic) NSTimeZone *timeZone; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Clock/Clock/Clock-Source/SPClockView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SPClockView.m 3 | // Clock 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import "SPClockView.h" 10 | 11 | #define borderWidth 2 12 | #define borderAlpha 1.0 13 | #define graduationOffset 10 14 | #define graduationLength 5.0 15 | #define graduationWidth 1.0 16 | #define digitOffset 0 17 | 18 | @interface SPDigitalClock() 19 | 20 | @property (assign, nonatomic) NSDate *time; 21 | @property(assign,nonatomic) NSInteger seconds; 22 | @property(assign,nonatomic) NSInteger minutes; 23 | @property(assign,nonatomic) NSInteger hours; 24 | 25 | @end 26 | 27 | @implementation SPDigitalClock 28 | 29 | - (id)initWithFrame:(CGRect)frame{ 30 | self = [super initWithFrame:frame]; 31 | self.backgroundColor = [UIColor clearColor]; 32 | self.font = [UIFont boldSystemFontOfSize:20.0]; 33 | self.textColor = [UIColor redColor]; 34 | self.textAlignment = NSTextAlignmentCenter; 35 | 36 | return self; 37 | } 38 | 39 | 40 | - (void)timerFired:(id)sender 41 | { 42 | _time = [NSDate date]; 43 | static NSCalendar *gregorian; 44 | 45 | if (!gregorian) gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; 46 | [gregorian setTimeZone:_timeZone]; // Japan 47 | NSDateComponents *weekdayComponents = 48 | [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:_time]; 49 | 50 | self.hours = [weekdayComponents hour]; 51 | self.minutes = [weekdayComponents minute]; 52 | self.seconds = [weekdayComponents second]; 53 | 54 | self.text = [NSString stringWithFormat:@"%ld:%ld:%ld",(long)self.hours,(long)self.minutes,(long)self.seconds]; 55 | 56 | } 57 | 58 | - (void)setTimeZone:(NSTimeZone *)timeZone 59 | { 60 | _timeZone = timeZone; 61 | CADisplayLink *animationTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(timerFired:)]; 62 | animationTimer.frameInterval = 8.0; 63 | [animationTimer addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; 64 | } 65 | 66 | @end 67 | 68 | @interface SPClockView() 69 | 70 | @property (assign, nonatomic) NSDate *time; 71 | @property(assign,nonatomic) CGPoint boundsCenter; 72 | @property(assign,nonatomic) NSInteger seconds; 73 | @property(assign,nonatomic) NSInteger minutes; 74 | @property(assign,nonatomic) NSInteger hours; 75 | 76 | @property (nonatomic, strong) UIColor *clockBackgroundColor; 77 | @property (nonatomic, strong) UIColor *borderColor; 78 | @property (nonatomic, strong) UIColor *digitColor; 79 | @property (nonatomic, strong) UIFont *digitFont; 80 | 81 | @end 82 | 83 | @implementation SPClockView 84 | 85 | - (void)initOutlook{ 86 | self.backgroundColor = [UIColor clearColor]; 87 | _clockBackgroundColor = [UIColor blackColor]; 88 | _borderColor = [UIColor whiteColor]; 89 | _digitColor = [UIColor whiteColor]; 90 | double fontSize = 8+self.frame.size.width/50; 91 | _digitFont = [UIFont systemFontOfSize:fontSize]; 92 | _boundsCenter = CGPointMake(self.bounds.size.width/2.0, self.bounds.size.height/2.0); 93 | } 94 | 95 | - (void)setAsDay:(BOOL)day{ 96 | _clockBackgroundColor = day? [UIColor whiteColor]:[UIColor blackColor]; 97 | _digitColor = day ? [UIColor blackColor] : [UIColor whiteColor]; 98 | _borderColor = day ? [UIColor blackColor] : [UIColor whiteColor]; 99 | } 100 | 101 | - (id)initWithFrame:(CGRect)frame 102 | { 103 | self = [super initWithFrame:frame]; 104 | if (self) { 105 | // Initialization code 106 | [self initOutlook]; 107 | } 108 | return self; 109 | } 110 | 111 | - (CGPoint)secondsHandPosition { 112 | 113 | float secondsAsRadians = (float)self.seconds / 60.0 * 2.0 * M_PI - M_PI_2; 114 | float handRadius = self.frame.size.width / 3.2; 115 | return CGPointMake(handRadius*cosf(secondsAsRadians)+self.boundsCenter.x, handRadius*sinf(secondsAsRadians)+self.boundsCenter.y); 116 | } 117 | 118 | - (CGPoint)minutesHandPosition { 119 | 120 | float minutesAsRadians = (float)self.minutes / 60.0 * 2.0 * M_PI - M_PI_2; 121 | float handRadius = self.frame.size.width / 3.6; 122 | return CGPointMake(handRadius*cosf(minutesAsRadians)+self.boundsCenter.x, handRadius*sinf(minutesAsRadians)+self.boundsCenter.y); 123 | } 124 | 125 | - (CGPoint)hoursHandPosition { 126 | 127 | float hoursAsRadians = (float)(self.hours+(float)self.minutes/60.0) / 12.0 * 2.0 * M_PI - M_PI_2; 128 | float handRadius = self.frame.size.width / 4.2; 129 | return CGPointMake(handRadius*cosf(hoursAsRadians)+self.boundsCenter.x, handRadius*sinf(hoursAsRadians)+self.boundsCenter.y); 130 | } 131 | 132 | 133 | - (void)drawRect:(CGRect)rect { 134 | // CLOCK'S FACE 135 | CGContextRef ctx = UIGraphicsGetCurrentContext(); 136 | CGContextAddEllipseInRect(ctx, rect); 137 | CGContextSetFillColorWithColor(ctx, self.clockBackgroundColor.CGColor); 138 | CGContextFillPath(ctx); 139 | 140 | // CLOCK'S CENTER 141 | CGFloat radius = 6.0; 142 | CGRect center2 = CGRectMake(self.boundsCenter.x-radius, self.boundsCenter.y-radius, 2*radius, 2*radius); 143 | CGContextAddEllipseInRect(ctx, center2); 144 | CGContextSetFillColorWithColor(ctx, _digitColor.CGColor); 145 | CGContextFillPath(ctx); 146 | 147 | 148 | // CLOCK'S BORDER 149 | CGContextAddEllipseInRect(ctx, CGRectMake(rect.origin.x + borderWidth/2, rect.origin.y + borderWidth/2, rect.size.width - borderWidth, rect.size.height - borderWidth)); 150 | CGContextSetStrokeColorWithColor(ctx, self.borderColor.CGColor); 151 | CGContextSetLineWidth(ctx,borderWidth); 152 | CGContextStrokePath(ctx); 153 | 154 | // CLOCK'S GRADUATION 155 | for (int i = 0; i<60; i++) { 156 | CGFloat gradLength = graduationLength; 157 | if((i+1)%5== 1) gradLength = gradLength + 10; 158 | CGPoint P1 = CGPointMake((self.frame.size.width/2 + ((self.frame.size.width - borderWidth*2 - graduationOffset) / 2) * cos((6*i)*(M_PI/180) - (M_PI/2))), (self.frame.size.width/2 + ((self.frame.size.width - borderWidth*2 - graduationOffset) / 2) * sin((6*i)*(M_PI/180) - (M_PI/2)))); 159 | CGPoint P2 = CGPointMake((self.frame.size.width/2 + ((self.frame.size.width - borderWidth*2 - graduationOffset - gradLength) / 2) * cos((6*i)*(M_PI/180) - (M_PI/2))), (self.frame.size.width/2 + ((self.frame.size.width - borderWidth*2 - graduationOffset - gradLength) / 2) * sin((6*i)*(M_PI/180) - (M_PI/2)))); 160 | 161 | CAShapeLayer *shapeLayer = [CAShapeLayer layer]; 162 | UIBezierPath *path1 = [UIBezierPath bezierPath]; 163 | shapeLayer.path = path1.CGPath; 164 | [path1 setLineWidth:graduationWidth]; 165 | [path1 moveToPoint:P1]; 166 | [path1 addLineToPoint:P2]; 167 | path1.lineCapStyle = kCGLineCapSquare; 168 | [_digitColor set]; 169 | 170 | [path1 strokeWithBlendMode:kCGBlendModeNormal alpha:1.0]; 171 | } 172 | 173 | // DIGIT DRAWING 174 | 175 | CGPoint center = CGPointMake(rect.size.width/2.0f, rect.size.height/2.0f); 176 | CGFloat markingDistanceFromCenter = rect.size.width/2.0f - _digitFont.lineHeight/4.0f - 15 + digitOffset; 177 | NSInteger offset = 4; 178 | 179 | for(unsigned i = 0; i < 12; i ++){ 180 | NSString *hourNumber = [NSString stringWithFormat:@"%@%d", [NSString stringWithFormat:@"%@", i+1<10 ? @" ": @""] , i + 1 ]; 181 | CGFloat labelX = center.x + (markingDistanceFromCenter - _digitFont.lineHeight/2.0f) * cos((M_PI/180)* (i+offset) * 30 + M_PI); 182 | CGFloat labelY = center.y + - 1 * (markingDistanceFromCenter - _digitFont.lineHeight/2.0f) * sin((M_PI/180)*(i+offset) * 30); 183 | [hourNumber drawInRect:CGRectMake(labelX - _digitFont.lineHeight/2.0f,labelY - _digitFont.lineHeight/2.0f,_digitFont.lineHeight,_digitFont.lineHeight) withAttributes:@{NSForegroundColorAttributeName: self.digitColor, NSFontAttributeName: _digitFont}]; 184 | } 185 | 186 | // Hands 187 | 188 | CGPoint secondsHandPosition = [self secondsHandPosition]; 189 | 190 | CGContextSetStrokeColorWithColor(ctx, [UIColor redColor].CGColor); 191 | CGContextBeginPath(ctx); 192 | CGContextMoveToPoint(ctx, self.boundsCenter.x, self.boundsCenter.y); 193 | CGContextSetLineWidth(ctx,1.0); 194 | 195 | CGContextAddLineToPoint(ctx, secondsHandPosition.x, secondsHandPosition.y); 196 | CGContextStrokePath(ctx); 197 | 198 | CGPoint minutesHandPosition = [self minutesHandPosition]; 199 | 200 | CGContextSetStrokeColorWithColor(ctx, _digitColor.CGColor); 201 | CGContextBeginPath(ctx); 202 | CGContextMoveToPoint(ctx, self.boundsCenter.x, self.boundsCenter.y); 203 | CGContextSetLineWidth(ctx,4.0); 204 | CGContextAddLineToPoint(ctx, minutesHandPosition.x, minutesHandPosition.y); 205 | CGContextStrokePath(ctx); 206 | 207 | CGPoint hoursHandPosition = [self hoursHandPosition]; 208 | 209 | CGContextSetStrokeColorWithColor(ctx, _digitColor.CGColor); 210 | CGContextBeginPath(ctx); 211 | CGContextMoveToPoint(ctx, self.boundsCenter.x, self.boundsCenter.y); 212 | CGContextSetLineWidth(ctx,4.0); 213 | CGContextAddLineToPoint(ctx, hoursHandPosition.x, hoursHandPosition.y); 214 | CGContextStrokePath(ctx); 215 | 216 | 217 | // SECOND's CENTER 218 | radius = 3.0; 219 | CGRect center3 = CGRectMake(self.boundsCenter.x-radius, self.boundsCenter.y-radius, 2*radius, 2*radius); 220 | CGContextAddEllipseInRect(ctx, center3); 221 | CGContextSetFillColorWithColor(ctx, [UIColor redColor].CGColor); 222 | CGContextFillPath(ctx); 223 | } 224 | 225 | - (void)timerFired:(id)sender 226 | { 227 | // _time = [NSDate date]; 228 | NSDate * newtime = [NSDate date]; //here was an error when I was triying to use only the analog Clock 229 | 230 | static NSCalendar *gregorian; 231 | 232 | if (!gregorian) gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; 233 | [gregorian setTimeZone:_timeZone]; // Japan 234 | 235 | // Update Deprecated Method 236 | // Fix crash (deallocated _time variable) 237 | NSDateComponents *weekdayComponents = [gregorian components:(NSCalendarUnitDay | NSCalendarUnitWeekday | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond) fromDate:[NSDate date]]; 238 | 239 | self.hours = [weekdayComponents hour]; 240 | BOOL isDay = (self.hours > 6 && self.hours < 18); 241 | [self setAsDay:isDay]; 242 | if (self.hours > 12) self.hours -= 12; 243 | 244 | self.minutes = [weekdayComponents minute]; 245 | self.seconds = [weekdayComponents second]; 246 | 247 | [self setNeedsDisplay]; 248 | } 249 | 250 | - (void)setTimeZone:(NSTimeZone *)timeZone 251 | { 252 | _timeZone = timeZone; 253 | CADisplayLink *animationTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(timerFired:)]; 254 | animationTimer.frameInterval = 8.0; 255 | [animationTimer addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; 256 | } 257 | 258 | 259 | @end 260 | -------------------------------------------------------------------------------- /Clock/Clock/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Clock/Clock/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /Clock/Clock/SPAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SPAppDelegate.h 3 | // Clock 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SPAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Clock/Clock/SPAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SPAppDelegate.m 3 | // Clock 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import "SPAppDelegate.h" 10 | 11 | @implementation SPAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 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 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Clock/Clock/SPViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SPViewController.h 3 | // Clock 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SPViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Clock/Clock/SPViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SPViewController.m 3 | // Clock 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import "SPViewController.h" 10 | #import "SPClockView.h" 11 | 12 | #define clockViewTag 12345 13 | #define clockLabelTag 23456 14 | #define digitalClockTag 34567 15 | #define xPadding 20 16 | #define yPadding 10 17 | 18 | @interface SPViewController () 19 | 20 | @property (nonatomic, strong) UITableView *tableView; 21 | @property (nonatomic, strong) SPClockView *clockView; 22 | @property (nonatomic, strong) NSMutableArray *timeZones; 23 | @property (nonatomic, strong) NSArray *allTimeZones; 24 | 25 | @property (nonatomic, strong) UITableViewController *timeZoneTableViewVC; 26 | 27 | @end 28 | 29 | @implementation SPViewController 30 | 31 | - (void)loadView 32 | { 33 | [super loadView]; 34 | self.tableView = [[UITableView alloc] initWithFrame:self.view.frame]; 35 | self.tableView.dataSource = self; 36 | self.tableView.delegate = self; 37 | [self.view addSubview:self.tableView]; 38 | _timeZones = [NSMutableArray new]; 39 | // add current time zone 40 | [_timeZones addObject:[NSTimeZone localTimeZone]]; 41 | 42 | self.timeZoneTableViewVC = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain]; 43 | self.timeZoneTableViewVC.tableView.dataSource = self; 44 | self.timeZoneTableViewVC.tableView.delegate = self; 45 | _allTimeZones = [NSTimeZone knownTimeZoneNames]; 46 | } 47 | 48 | - (void)viewDidLoad 49 | { 50 | [super viewDidLoad]; 51 | self.view.backgroundColor = [UIColor greenColor]; 52 | self.title = @"SPClockView"; 53 | _tableView.contentInset = UIEdgeInsetsMake(120, 0, 0, 0); 54 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addTimeZone:)]; 55 | } 56 | 57 | - (void)didReceiveMemoryWarning 58 | { 59 | [super didReceiveMemoryWarning]; 60 | // Dispose of any resources that can be recreated. 61 | } 62 | 63 | //============================================================================ 64 | #pragma mark - UI Action 65 | //============================================================================ 66 | - (void)addTimeZone:(UIBarButtonItem *)sender{ 67 | if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) 68 | { 69 | UIPopoverController *popVC = [[UIPopoverController alloc] initWithContentViewController:_timeZoneTableViewVC]; 70 | [popVC presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 71 | } 72 | else { 73 | [self presentViewController:_timeZoneTableViewVC animated:YES completion:^{ 74 | }]; 75 | } 76 | [_timeZoneTableViewVC.tableView reloadData]; 77 | } 78 | 79 | //============================================================================ 80 | #pragma mark - UITableViewDataSource, UITableViewDelegate 81 | //============================================================================ 82 | 83 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 84 | return 1; 85 | } 86 | 87 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 88 | return ([tableView isEqual:_tableView]) ? _timeZones.count : _allTimeZones.count; 89 | } 90 | 91 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 92 | if([tableView isEqual:_tableView]){ 93 | NSString *CellIdentifier = @"ClockCellIdentifier"; 94 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 95 | if(!cell){ 96 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 97 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 98 | SPClockView *clockView = [[SPClockView alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; 99 | [cell.contentView addSubview:clockView]; 100 | clockView.tag = clockViewTag; 101 | UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(0, cell.contentView.frame.size.height - 50, cell.contentView.frame.size.width, 40)]; 102 | name.backgroundColor = [UIColor clearColor]; 103 | name.textAlignment = NSTextAlignmentCenter; 104 | name.tag = clockLabelTag; 105 | [cell.contentView addSubview:name]; 106 | 107 | SPDigitalClock *digitalClock = [[SPDigitalClock alloc] initWithFrame:CGRectMake(0, 0, cell.contentView.frame.size.width, 50)]; 108 | digitalClock.tag = digitalClockTag; 109 | [cell.contentView addSubview:digitalClock]; 110 | } 111 | NSTimeZone *tz = [self.timeZones objectAtIndex:indexPath.row]; 112 | SPClockView *clockView = (SPClockView *)[cell.contentView viewWithTag:clockViewTag]; 113 | UILabel *clockNameLabel = (UILabel *)[cell.contentView viewWithTag:clockLabelTag]; 114 | SPDigitalClock *digitalClock = (SPDigitalClock *)[cell.contentView viewWithTag:digitalClockTag]; 115 | if([clockNameLabel isKindOfClass:[UILabel class]]){ 116 | clockNameLabel.text = tz.name; 117 | clockNameLabel.frame = CGRectMake(0, 0, cell.contentView.frame.size.width, 20); 118 | } 119 | if(clockView && [clockView isKindOfClass:[SPClockView class]]){ 120 | [clockView setTimeZone:tz]; 121 | clockView.frame = CGRectMake(CGRectGetMidX(cell.contentView.frame)-CGRectGetWidth(clockView.frame)/2, CGRectGetMaxY(clockNameLabel.frame)+yPadding, clockView.frame.size.width, clockView.frame.size.width); 122 | } 123 | if(digitalClock && [digitalClock isKindOfClass:[SPDigitalClock class]]){ 124 | [digitalClock setTimeZone:tz]; 125 | digitalClock.frame = CGRectMake(0, CGRectGetMaxY(clockView.frame)+yPadding, cell.contentView.frame.size.width, 30); 126 | } 127 | 128 | return cell; 129 | } 130 | else { 131 | NSString *CellIdentifier = @"TimeZoneCellIdentifier"; 132 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 133 | if(!cell){ 134 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 135 | } 136 | cell.textLabel.text = [self.allTimeZones objectAtIndex:indexPath.row]; 137 | return cell; 138 | } 139 | } 140 | 141 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 142 | return ([tableView isEqual:_tableView]) ? 220.0 : 44; 143 | } 144 | 145 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 146 | { 147 | if([tableView isEqual:_tableView]){ 148 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 149 | } 150 | else { 151 | NSString *tzStr = [self.allTimeZones objectAtIndex:indexPath.row]; 152 | [self.timeZones addObject:[NSTimeZone timeZoneWithName:tzStr]]; 153 | [_tableView reloadData]; 154 | [_timeZoneTableViewVC dismissViewControllerAnimated:YES completion:nil]; 155 | } 156 | } 157 | 158 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ 159 | if([tableView isEqual:_tableView]){ 160 | NSTimeZone *tz = [self.timeZones objectAtIndex:indexPath.row]; 161 | [self.timeZones removeObject:tz]; 162 | [_tableView beginUpdates]; 163 | [_tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; 164 | [_tableView endUpdates]; 165 | } 166 | } 167 | 168 | 169 | @end 170 | -------------------------------------------------------------------------------- /Clock/Clock/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Clock/Clock/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Clock 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "SPAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SPAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Clock/ClockTests/ClockTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.SuMedia.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Clock/ClockTests/ClockTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ClockTests.m 3 | // ClockTests 4 | // 5 | // Created by Suraj on 16/8/14. 6 | // Copyright (c) 2014 Su Media. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ClockTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ClockTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Clock/ClockTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 freesuraj 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Clock-iOS 2 | ========= 3 | 4 | *** A clone of native app clock *** 5 | 6 | ![SPClockView 1] (https://dl.dropboxusercontent.com/u/4280704/publicPhotos/spclockView.png) 7 | 8 | ###Features 9 | 1. Can set the time zone or choose from a list of time zone 10 | 2. Automatically detects the day or night and changes the background of the clock 11 | 3. Doesn't use `NSTimer ` to schedule the time, so it won't be blocked by any other UI operations. 12 | 4. Swipe to delete the added clock 13 | 5. Displays the name of the timezone and time in digital format 14 | 6. Digital clock to display the name in format: `HH:mm:ss` 15 | 16 | ### How to use 17 | 18 | ### CocoaPods 19 | Pod 'SPClockView' 20 | 21 | ### Manual 22 | 23 | 1. Import the files `SPClockView.h` and `SPClockView.m` into your projects. 24 | 2. After adding the `SPClockView` into your parent view, set its `time zone` by calling `setTimeZone:` method. 25 | 3. Digital clock `SPDigitalClock` is a subclass of `UILabel`, and is implemented inside the `SPClockView` class. To set the digital time also call the method `setTimeZone:` on `SPDigitalClock`. 26 | 27 | ### Example 28 | 1. `SPClockView` 29 | 30 | SPClockView *clockView = [[SPClockView alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; 31 | 32 | [clockView setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York 33 | 34 | 2. `SPDigitalClock` 35 | 36 | SPDigitalClock *digClock = [[SPDigitalClock alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; 37 | 38 | [digClock setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York 39 | 40 | 41 | 42 | ### Contact 43 | This is a quickly made project so could have few bugs. Feel free to add bug list or contact me at or !! 44 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman --------------------------------------------------------------------------------