From f37b57fcb3b38cc81cd02b50b9d337d684a1f02a Mon Sep 17 00:00:00 2001 From: wangweicheng Date: Thu, 16 Nov 2017 10:58:16 +0800 Subject: [PATCH] first init --- Clock.xcodeproj/project.pbxproj | 231 +++++- .../xcdebugger/Breakpoints_v2.xcbkptlist | 5 + .../xcschemes/Clock.xcscheme | 82 ++ .../xcschemes/Example.xcscheme | 93 +++ .../xcschemes/xcschememanagement.plist | 18 + Clock/Clock.h | 15 + Clock/Clock.m | 197 +++++ Clock/ClockView.h | 13 - Clock/ClockView.m | 52 -- Clock/DialView.h | 17 + Clock/DialView.m | 124 +++ Clock/Info.plist | 2 +- Clock/NSBezierPath+quartz.h | 15 + Clock/NSBezierPath+quartz.m | 62 ++ Example/AppDelegate.h | 15 + Example/AppDelegate.m | 28 + .../AppIcon.appiconset/Contents.json | 58 ++ Example/Base.lproj/Main.storyboard | 731 ++++++++++++++++++ Example/Example.entitlements | 10 + Example/Info.plist | 32 + Example/ViewController.h | 15 + Example/ViewController.m | 48 ++ Example/main.m | 13 + 23 files changed, 1800 insertions(+), 76 deletions(-) create mode 100644 Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Clock.xcscheme create mode 100644 Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Example.xcscheme create mode 100644 Clock/Clock.h create mode 100644 Clock/Clock.m delete mode 100644 Clock/ClockView.h delete mode 100644 Clock/ClockView.m create mode 100644 Clock/DialView.h create mode 100644 Clock/DialView.m create mode 100644 Clock/NSBezierPath+quartz.h create mode 100644 Clock/NSBezierPath+quartz.m create mode 100644 Example/AppDelegate.h create mode 100644 Example/AppDelegate.m create mode 100644 Example/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Example/Base.lproj/Main.storyboard create mode 100644 Example/Example.entitlements create mode 100644 Example/Info.plist create mode 100644 Example/ViewController.h create mode 100644 Example/ViewController.m create mode 100644 Example/main.m diff --git a/Clock.xcodeproj/project.pbxproj b/Clock.xcodeproj/project.pbxproj index dcd7901..0b8de97 100644 --- a/Clock.xcodeproj/project.pbxproj +++ b/Clock.xcodeproj/project.pbxproj @@ -7,19 +7,68 @@ objects = { /* Begin PBXBuildFile section */ - BC6B62B11FB9BFD5002AD625 /* ClockView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6B62B01FB9BFD5002AD625 /* ClockView.h */; }; - BC6B62B31FB9BFD5002AD625 /* ClockView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B62B21FB9BFD5002AD625 /* ClockView.m */; }; + BC6B62F01FB9C2D7002AD625 /* Clock.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B62EE1FB9C2D7002AD625 /* Clock.m */; }; + BC6B62FB1FBA94E0002AD625 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B62FA1FBA94E0002AD625 /* AppDelegate.m */; }; + BC6B62FE1FBA94E0002AD625 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B62FD1FBA94E0002AD625 /* ViewController.m */; }; + BC6B63001FBA94E0002AD625 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BC6B62FF1FBA94E0002AD625 /* Assets.xcassets */; }; + BC6B63031FBA94E0002AD625 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BC6B63011FBA94E0002AD625 /* Main.storyboard */; }; + BC6B63061FBA94E0002AD625 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B63051FBA94E0002AD625 /* main.m */; }; + BC6B630D1FBAA5E0002AD625 /* DialView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6B630B1FBAA5E0002AD625 /* DialView.h */; }; + BC6B630E1FBAA5E0002AD625 /* DialView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B630C1FBAA5E0002AD625 /* DialView.m */; }; + BC6B63141FBAF302002AD625 /* NSBezierPath+quartz.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6B63121FBAF302002AD625 /* NSBezierPath+quartz.h */; }; + BC6B63151FBAF302002AD625 /* NSBezierPath+quartz.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B63131FBAF302002AD625 /* NSBezierPath+quartz.m */; }; + BC6B63181FBB099D002AD625 /* ScreenSaver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC6B63171FBB0994002AD625 /* ScreenSaver.framework */; }; + BC6B631A1FBB09C1002AD625 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC6B63191FBB09BE002AD625 /* Quartz.framework */; }; + BC6B631D1FBB0B61002AD625 /* Clock.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6B62ED1FB9C2D7002AD625 /* Clock.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BC6B631F1FBB0DF9002AD625 /* NSBezierPath+quartz.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B63131FBAF302002AD625 /* NSBezierPath+quartz.m */; }; + BC6B63251FBB2EB3002AD625 /* DialView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B630C1FBAA5E0002AD625 /* DialView.m */; }; + BC6B632B1FBB4E3E002AD625 /* Clock.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6B62EE1FB9C2D7002AD625 /* Clock.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + BC6B631B1FBB0A21002AD625 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BC6B62A41FB9BFD5002AD625 /* Project object */; + proxyType = 1; + remoteGlobalIDString = BC6B62AC1FB9BFD5002AD625; + remoteInfo = Clock; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ BC6B62AD1FB9BFD5002AD625 /* Clock.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Clock.saver; sourceTree = BUILT_PRODUCTS_DIR; }; - BC6B62B01FB9BFD5002AD625 /* ClockView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ClockView.h; sourceTree = ""; }; - BC6B62B21FB9BFD5002AD625 /* ClockView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ClockView.m; sourceTree = ""; }; BC6B62B41FB9BFD5002AD625 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BC6B62ED1FB9C2D7002AD625 /* Clock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clock.h; sourceTree = ""; }; + BC6B62EE1FB9C2D7002AD625 /* Clock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Clock.m; sourceTree = ""; }; + BC6B62F71FBA94E0002AD625 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BC6B62F91FBA94E0002AD625 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + BC6B62FA1FBA94E0002AD625 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + BC6B62FC1FBA94E0002AD625 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + BC6B62FD1FBA94E0002AD625 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + BC6B62FF1FBA94E0002AD625 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + BC6B63021FBA94E0002AD625 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + BC6B63041FBA94E0002AD625 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BC6B63051FBA94E0002AD625 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + BC6B63071FBA94E0002AD625 /* Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example.entitlements; sourceTree = ""; }; + BC6B630B1FBAA5E0002AD625 /* DialView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DialView.h; sourceTree = ""; }; + BC6B630C1FBAA5E0002AD625 /* DialView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DialView.m; sourceTree = ""; }; + BC6B63121FBAF302002AD625 /* NSBezierPath+quartz.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSBezierPath+quartz.h"; sourceTree = ""; }; + BC6B63131FBAF302002AD625 /* NSBezierPath+quartz.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSBezierPath+quartz.m"; sourceTree = ""; }; + BC6B63171FBB0994002AD625 /* ScreenSaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScreenSaver.framework; path = System/Library/Frameworks/ScreenSaver.framework; sourceTree = SDKROOT; }; + BC6B63191FBB09BE002AD625 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ BC6B62A91FB9BFD5002AD625 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BC6B63181FBB099D002AD625 /* ScreenSaver.framework in Frameworks */, + BC6B631A1FBB09C1002AD625 /* Quartz.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BC6B62F41FBA94E0002AD625 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -33,7 +82,9 @@ isa = PBXGroup; children = ( BC6B62AF1FB9BFD5002AD625 /* Clock */, + BC6B62F81FBA94E0002AD625 /* Example */, BC6B62AE1FB9BFD5002AD625 /* Products */, + BC6B63161FBB0994002AD625 /* Frameworks */, ); sourceTree = ""; }; @@ -41,6 +92,7 @@ isa = PBXGroup; children = ( BC6B62AD1FB9BFD5002AD625 /* Clock.saver */, + BC6B62F71FBA94E0002AD625 /* Example.app */, ); name = Products; sourceTree = ""; @@ -48,13 +100,42 @@ BC6B62AF1FB9BFD5002AD625 /* Clock */ = { isa = PBXGroup; children = ( - BC6B62B01FB9BFD5002AD625 /* ClockView.h */, - BC6B62B21FB9BFD5002AD625 /* ClockView.m */, + BC6B62ED1FB9C2D7002AD625 /* Clock.h */, + BC6B62EE1FB9C2D7002AD625 /* Clock.m */, BC6B62B41FB9BFD5002AD625 /* Info.plist */, + BC6B630B1FBAA5E0002AD625 /* DialView.h */, + BC6B630C1FBAA5E0002AD625 /* DialView.m */, + BC6B63121FBAF302002AD625 /* NSBezierPath+quartz.h */, + BC6B63131FBAF302002AD625 /* NSBezierPath+quartz.m */, ); path = Clock; sourceTree = ""; }; + BC6B62F81FBA94E0002AD625 /* Example */ = { + isa = PBXGroup; + children = ( + BC6B62F91FBA94E0002AD625 /* AppDelegate.h */, + BC6B62FA1FBA94E0002AD625 /* AppDelegate.m */, + BC6B62FC1FBA94E0002AD625 /* ViewController.h */, + BC6B62FD1FBA94E0002AD625 /* ViewController.m */, + BC6B62FF1FBA94E0002AD625 /* Assets.xcassets */, + BC6B63011FBA94E0002AD625 /* Main.storyboard */, + BC6B63041FBA94E0002AD625 /* Info.plist */, + BC6B63051FBA94E0002AD625 /* main.m */, + BC6B63071FBA94E0002AD625 /* Example.entitlements */, + ); + path = Example; + sourceTree = ""; + }; + BC6B63161FBB0994002AD625 /* Frameworks */ = { + isa = PBXGroup; + children = ( + BC6B63191FBB09BE002AD625 /* Quartz.framework */, + BC6B63171FBB0994002AD625 /* ScreenSaver.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -62,7 +143,9 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - BC6B62B11FB9BFD5002AD625 /* ClockView.h in Headers */, + BC6B631D1FBB0B61002AD625 /* Clock.h in Headers */, + BC6B63141FBAF302002AD625 /* NSBezierPath+quartz.h in Headers */, + BC6B630D1FBAA5E0002AD625 /* DialView.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -77,6 +160,7 @@ BC6B62A91FB9BFD5002AD625 /* Frameworks */, BC6B62AA1FB9BFD5002AD625 /* Headers */, BC6B62AB1FB9BFD5002AD625 /* Resources */, + BC6B630F1FBAADD6002AD625 /* ShellScript */, ); buildRules = ( ); @@ -87,6 +171,24 @@ productReference = BC6B62AD1FB9BFD5002AD625 /* Clock.saver */; productType = "com.apple.product-type.bundle"; }; + BC6B62F61FBA94E0002AD625 /* Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = BC6B63081FBA94E0002AD625 /* Build configuration list for PBXNativeTarget "Example" */; + buildPhases = ( + BC6B62F31FBA94E0002AD625 /* Sources */, + BC6B62F41FBA94E0002AD625 /* Frameworks */, + BC6B62F51FBA94E0002AD625 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + BC6B631C1FBB0A21002AD625 /* PBXTargetDependency */, + ); + name = Example; + productName = Example; + productReference = BC6B62F71FBA94E0002AD625 /* Example.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -100,6 +202,10 @@ CreatedOnToolsVersion = 9.1; ProvisioningStyle = Automatic; }; + BC6B62F61FBA94E0002AD625 = { + CreatedOnToolsVersion = 9.1; + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = BC6B62A71FB9BFD5002AD625 /* Build configuration list for PBXProject "Clock" */; @@ -108,6 +214,7 @@ hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = BC6B62A31FB9BFD5002AD625; productRefGroup = BC6B62AE1FB9BFD5002AD625 /* Products */; @@ -115,6 +222,7 @@ projectRoot = ""; targets = ( BC6B62AC1FB9BFD5002AD625 /* Clock */, + BC6B62F61FBA94E0002AD625 /* Example */, ); }; /* End PBXProject section */ @@ -127,19 +235,78 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + BC6B62F51FBA94E0002AD625 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BC6B63001FBA94E0002AD625 /* Assets.xcassets in Resources */, + BC6B63031FBA94E0002AD625 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + BC6B630F1FBAADD6002AD625 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "SCREEN_SAVER_PATH=\"${HOME}/Library/Screen Savers/${FULL_PRODUCT_NAME}\"\necho SCREEN_SAVER_PATH\nif [[ -d \"${SCREEN_SAVER_PATH}\" || -f \"${SCREEN_SAVER_PATH}\" || -L \"${SCREEN_SAVER_PATH}\" ]]; then\nrm -rf \"${SCREEN_SAVER_PATH}\"\nfi\nln -s \"${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}\" \"${SCREEN_SAVER_PATH}\""; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ BC6B62A81FB9BFD5002AD625 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BC6B62B31FB9BFD5002AD625 /* ClockView.m in Sources */, + BC6B62F01FB9C2D7002AD625 /* Clock.m in Sources */, + BC6B63151FBAF302002AD625 /* NSBezierPath+quartz.m in Sources */, + BC6B630E1FBAA5E0002AD625 /* DialView.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BC6B62F31FBA94E0002AD625 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BC6B632B1FBB4E3E002AD625 /* Clock.m in Sources */, + BC6B63251FBB2EB3002AD625 /* DialView.m in Sources */, + BC6B631F1FBB0DF9002AD625 /* NSBezierPath+quartz.m in Sources */, + BC6B62FE1FBA94E0002AD625 /* ViewController.m in Sources */, + BC6B63061FBA94E0002AD625 /* main.m in Sources */, + BC6B62FB1FBA94E0002AD625 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + BC6B631C1FBB0A21002AD625 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BC6B62AC1FB9BFD5002AD625 /* Clock */; + targetProxy = BC6B631B1FBB0A21002AD625 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + BC6B63011FBA94E0002AD625 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + BC6B63021FBA94E0002AD625 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ BC6B62B51FB9BFD5002AD625 /* Debug */ = { isa = XCBuildConfiguration; @@ -189,7 +356,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -238,7 +405,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; }; @@ -247,10 +414,13 @@ BC6B62B81FB9BFD5002AD625 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = Clock/Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = PW.Clock; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = saver; @@ -260,16 +430,48 @@ BC6B62B91FB9BFD5002AD625 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = Clock/Info.plist; INSTALL_PATH = "$(HOME)/Library/Screen Savers"; + OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = PW.Clock; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = saver; }; name = Release; }; + BC6B63091FBA94E0002AD625 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Example/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = PW.Example; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + BC6B630A1FBA94E0002AD625 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD)"; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Example/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = PW.Example; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -291,6 +493,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + BC6B63081FBA94E0002AD625 /* Build configuration list for PBXNativeTarget "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BC6B63091FBA94E0002AD625 /* Debug */, + BC6B630A1FBA94E0002AD625 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = BC6B62A41FB9BFD5002AD625 /* Project object */; diff --git a/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Clock.xcscheme b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Clock.xcscheme new file mode 100644 index 0000000..1750b0a --- /dev/null +++ b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Clock.xcscheme @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Example.xcscheme b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Example.xcscheme new file mode 100644 index 0000000..027defe --- /dev/null +++ b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/Example.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/xcschememanagement.plist b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/xcschememanagement.plist index e7ada97..afdd9c7 100644 --- a/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Clock.xcodeproj/xcuserdata/weicheng.xcuserdatad/xcschemes/xcschememanagement.plist @@ -9,6 +9,24 @@ orderHint 0 + Example.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + BC6B62AC1FB9BFD5002AD625 + + primary + + + BC6B62F61FBA94E0002AD625 + + primary + + diff --git a/Clock/Clock.h b/Clock/Clock.h new file mode 100644 index 0000000..e1f6190 --- /dev/null +++ b/Clock/Clock.h @@ -0,0 +1,15 @@ +// +// WebSaverView.h +// WebSaver +// +// Created by Thomas Robinson on 10/13/09. +// Modified by Pekka Nikander in May 2012. +// Copyright (c) 2013, Thomas Robinson. All rights reserved. +// Copyright (c) 2012, Senseg. All rights reserved. +// + +#import + +@interface Clock : ScreenSaverView + +@end diff --git a/Clock/Clock.m b/Clock/Clock.m new file mode 100644 index 0000000..4feee49 --- /dev/null +++ b/Clock/Clock.m @@ -0,0 +1,197 @@ +// +// WebSaverView.m +// WebSaver +// +// Created by Thomas Robinson on 10/13/09. +// Modified by Pekka Nikander in May 2012. +// Copyright (c) 2013, Thomas Robinson. All rights reserved. +// Copyright (c) 2012, Senseg. All rights reserved. +// + +#import "Clock.h" +#import "DialView.h" +#import +#import "NSBezierPath+quartz.h" +//#import "TaiChiView.h" + +@interface Clock () +{ + CGFloat _rotation; + float _rate; + NSBezierPath *_path; + NSBezierPath *_linePath; + NSTextField *_textField; +} + +@property (nonatomic, strong) NSArray *textArray; +@property (nonatomic, strong) DialView *hourDialView; +@property (nonatomic, strong) DialView *quarterDialView; +@property (nonatomic, strong) DialView *secondDialView; + +@property (nonatomic, strong) NSTextField *timeTextField; + +//@property (nonatomic, strong) TaiChiView *taiChiView; + +@end + +@implementation Clock + +- (instancetype)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview { + if(self = [super initWithFrame:frame isPreview:isPreview]) { + _rotation = 0; + + _rate = (frame.size.height)/([NSScreen mainScreen].visibleFrame.size.height); + + _textField = [[NSTextField alloc] initWithFrame:CGRectMake(0, 0, frame.size.height-300*_rate, frame.size.height/2-150*_rate)]; + _textField.bordered = NO; + _textField.backgroundColor = [NSColor clearColor]; + _textField.selectable = NO; + _textField.textColor = [NSColor whiteColor]; + _textField.cell.font = [NSFont fontWithName:@"HelveticaNeue-UltraLight" size:108*_rate]; + _textField.cell.alignment = NSTextAlignmentCenter; + [self addSubview:_textField]; + [self addSubview:self.hourDialView]; + [self addSubview:self.quarterDialView]; + [self addSubview:self.secondDialView]; + + [self setAnimationTimeInterval:0.01]; +// [self addSubview:self.taiChiView]; + + } + return self; +} + +- (void)startAnimation { + [super startAnimation]; + + self.hourDialView.textArray = @[@"子", @"丑", @"寅", @"卯", @"辰", @"巳", @"午", @"未", @"申", @"酉", @"戌", @"亥"]; + self.quarterDialView.textArray = @[@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正",@"初", @"正"]; + + NSMutableArray *tmp = [NSMutableArray array]; + for (NSInteger i = 0; i < 96; i ++) { + [tmp addObject:@""]; + } + self.secondDialView.textArray = tmp; + + NSPoint point = NSMakePoint(self.frame.size.width/2, self.frame.size.height/2); + CGFloat radius = self.bounds.size.height/2-160*_rate; + NSRect rect = NSMakeRect(point.x - radius, point.y - radius, radius*2, radius*2); + _path = [NSBezierPath bezierPathWithOvalInRect:rect]; + _linePath = [NSBezierPath bezierPath]; +} + +- (BOOL)hasConfigureSheet { + return NO; +} + +- (NSWindow *)configureSheet { + return nil; +} + +- (void)animateOneFrame { + [super animateOneFrame]; + + _rotation += 1; +// [self.dialView setNeedsDisplay:YES]; + + [self.hourDialView setNeedsLayout:YES]; + [self.quarterDialView setNeedsLayout:YES]; + [self.secondDialView setNeedsLayout:YES]; + _textField.stringValue = [self currentDisplayTime]; + [_textField sizeToFit]; + [_textField setFrameOrigin:NSMakePoint(self.frame.size.width/2-_textField.bounds.size.width/2, self.frame.size.height/2- _textField.bounds.size.height/2)]; + + [self setNeedsDisplay:YES]; +} + +- (void)drawRect:(NSRect)rect { + [super drawRect:rect]; + + [[NSColor whiteColor] set]; + + [_path stroke]; + [_linePath removeAllPoints]; + + float angle = M_PI/180*(360/1440.0); + float radius = rect.size.height/2 - 30*_rate; + float minRadius = rect.size.height/2-180*_rate; + + + float minute = [self countTimeInterval]/60.0; + + NSPoint origin = NSMakePoint(rect.size.width/2+radius*sinf( angle*minute), + rect.size.height/2+radius*cosf(angle*minute)); + + NSPoint toPoint1 = NSMakePoint(rect.size.width/2+minRadius*sinf(angle*minute+M_PI/360), + rect.size.height/2+minRadius*cosf(angle*minute+M_PI/360)); + + NSPoint toPoint2 = NSMakePoint(rect.size.width/2+minRadius*sinf(angle*minute-M_PI/360), + rect.size.height/2+minRadius*cosf(angle*minute-M_PI/360)); + + [_linePath moveToPoint:origin]; + [_linePath lineToPoint:toPoint1]; + [_linePath lineToPoint:toPoint2]; + [_linePath closePath]; + [[NSColor redColor] set]; + [_linePath fill]; + +} + +//计算时间差 +-(NSTimeInterval)countTimeInterval{ + + NSDate *date = [NSDate date]; + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + formatter.dateFormat = @"HH:mm:ss"; + NSString *timeStr = [formatter stringFromDate:date]; + + NSString *zeroTime = @"00:00:00"; + NSDate *zeroDate = [formatter dateFromString:zeroTime]; + NSDate *currentDate = [formatter dateFromString:timeStr]; + // 因为是逆时针的 + NSTimeInterval interval = [currentDate timeIntervalSinceDate:zeroDate]; + return interval; +} + +//计算时间差 +-(NSString *)currentDisplayTime{ + + NSDate *date = [NSDate date]; + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + formatter.dateFormat = @"HH:mm:ss"; + NSString *timeStr = [formatter stringFromDate:date]; + + NSDate *currentDate = [formatter dateFromString:timeStr]; + NSString *time = [formatter stringFromDate:currentDate]; + + return time; +} + +- (DialView *)hourDialView { + if (!_hourDialView) { + + NSPoint point = NSMakePoint(self.frame.size.width/2, self.frame.size.height/2); + _hourDialView = [[DialView alloc] initWithRadius:self.bounds.size.height/2-100*_rate center:point minRadius:self.bounds.size.height/2-160*_rate]; + _hourDialView.frameCenterRotation = 75; + } + return _hourDialView; +} + +- (DialView *)quarterDialView { + if (!_quarterDialView) { + NSPoint point = NSMakePoint(self.frame.size.width/2, self.frame.size.height/2); + _quarterDialView = [[DialView alloc] initWithRadius:self.bounds.size.height/2-50*_rate center:point minRadius:self.bounds.size.height/2-100*_rate]; + } + return _quarterDialView; +} + +- (DialView *)secondDialView { + if (!_secondDialView) { + + NSPoint point = NSMakePoint(self.frame.size.width/2, self.frame.size.height/2); + _secondDialView = [[DialView alloc] initWithRadius:self.bounds.size.height/2-30*_rate center:point minRadius:self.bounds.size.height/2-50*_rate]; + } + return _secondDialView; +} + +@end diff --git a/Clock/ClockView.h b/Clock/ClockView.h deleted file mode 100644 index 5a06279..0000000 --- a/Clock/ClockView.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ClockView.h -// Clock -// -// Created by wangweicheng on 2017/11/13. -// Copyright © 2017年 wangweicheng. All rights reserved. -// - -#import - -@interface ClockView : ScreenSaverView - -@end diff --git a/Clock/ClockView.m b/Clock/ClockView.m deleted file mode 100644 index 45a256d..0000000 --- a/Clock/ClockView.m +++ /dev/null @@ -1,52 +0,0 @@ -// -// ClockView.m -// Clock -// -// Created by wangweicheng on 2017/11/13. -// Copyright © 2017年 wangweicheng. All rights reserved. -// - -#import "ClockView.h" - -@implementation ClockView - -- (instancetype)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview -{ - self = [super initWithFrame:frame isPreview:isPreview]; - if (self) { - [self setAnimationTimeInterval:1/30.0]; - } - return self; -} - -- (void)startAnimation -{ - [super startAnimation]; -} - -- (void)stopAnimation -{ - [super stopAnimation]; -} - -- (void)drawRect:(NSRect)rect -{ - [super drawRect:rect]; -} - -- (void)animateOneFrame -{ - return; -} - -- (BOOL)hasConfigureSheet -{ - return NO; -} - -- (NSWindow*)configureSheet -{ - return nil; -} - -@end diff --git a/Clock/DialView.h b/Clock/DialView.h new file mode 100644 index 0000000..bb81431 --- /dev/null +++ b/Clock/DialView.h @@ -0,0 +1,17 @@ +// +// DiallView.h +// Clock +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import + +@interface DialView : NSView + +@property (nonatomic, strong) NSArray *textArray; + +- (instancetype)initWithRadius:(CGFloat)radius center:(NSPoint)point minRadius:(CGFloat)minRadius; + +@end diff --git a/Clock/DialView.m b/Clock/DialView.m new file mode 100644 index 0000000..ee24a5b --- /dev/null +++ b/Clock/DialView.m @@ -0,0 +1,124 @@ +// +// DiallView.m +// Clock +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import "DialView.h" +#import + +@interface DialView () { + float _rotation; + float _minRadius; + float _radius; + float _rate; + NSBezierPath *path; + NSMutableArray *_textFields; +} + +@end + +@implementation DialView + +@synthesize textArray = _textArray; + +- (instancetype)initWithRadius:(CGFloat)radius center:(NSPoint)point minRadius:(CGFloat)minRadius { + + _rate = radius*2/([NSScreen mainScreen].visibleFrame.size.height); + + if (self = [super initWithFrame:NSMakeRect(point.x - radius, point.y - radius, radius*2, radius*2)]) { + _minRadius = minRadius; + _radius = radius; + _textFields = [NSMutableArray array]; + path = [NSBezierPath bezierPath]; + } + return self; +} + +- (instancetype)initWithFrame:(NSRect)frameRect { + if (self = [super initWithFrame:frameRect]) { + _textFields = [NSMutableArray array]; + path = [NSBezierPath bezierPath]; + } + return self; +} + +- (void)setTextArray:(NSArray *)textArray { + _textArray = textArray; + // 移除所有的文字 + [self.subviews enumerateObjectsUsingBlock:^(__kindof NSView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [obj removeFromSuperview]; + }]; + + _rotation = 0; + float radius = (_radius + _minRadius)/2;; + float angle = M_PI/180*(360.0/textArray.count); + NSUInteger i = textArray.count; + for (NSString *text in _textArray) { + + NSTextField *textField = [[NSTextField alloc] init]; + textField.backgroundColor = [NSColor clearColor]; + textField.bordered = NO; + textField.selectable = NO; + textField.textColor = [NSColor whiteColor]; + textField.stringValue = text; + if (textArray.count == 12) { + textField.cell.font = [NSFont fontWithName:@"Libian SC" size:44*_rate]; + }else{ + textField.cell.font = [NSFont fontWithName:@"Libian SC" size:20*_rate]; + } + [textField sizeToFit]; + + NSPoint origin = NSMakePoint(radius*cosf(angle*(i+0.5)) - textField.frame.size.width/2 + _radius, + radius*sinf(angle*(i+0.5)) - textField.frame.size.height/2 + _radius); + + [textField setFrameOrigin:origin]; + textField.frameCenterRotation = 180/M_PI * angle*(i+0.5) + 90; + [self addSubview:textField]; + i --; + [_textFields addObject:textField]; + } + + +} + +- (void)drawRect:(NSRect)dirtyRect { + [super drawRect:dirtyRect]; + + NSRect _rect = NSMakeRect((dirtyRect.size.width - dirtyRect.size.height)/2, 0, dirtyRect.size.height, dirtyRect.size.height); + [path appendBezierPathWithOvalInRect:_rect]; + + CGFloat radius = 0; + float radian = 360.0/(self.textArray.count == 0 ? 1 : self.textArray.count); + double angle = M_PI/180*radian; + + for (NSInteger i = 0; i < 96; i ++) { + + radius = dirtyRect.size.height/2; + + NSPoint origin = NSMakePoint(radius+radius*cosf(angle*i), + radius+radius*sinf(angle*i)); + + NSPoint toPoint = NSMakePoint(dirtyRect.size.width/2 + _minRadius*cosf(angle*i), + dirtyRect.size.width/2 + _minRadius*sinf(angle*i)); + [path moveToPoint:origin]; + [path lineToPoint:toPoint]; + } + + + [[NSColor whiteColor] set]; + [path stroke]; + + [path removeAllPoints]; +} + +- (NSArray *)textArray { + if (!_textArray) { + _textArray = [[NSArray alloc] init]; + } + return _textArray; +} + +@end diff --git a/Clock/Info.plist b/Clock/Info.plist index 13bd45a..fbe5094 100644 --- a/Clock/Info.plist +++ b/Clock/Info.plist @@ -21,6 +21,6 @@ NSHumanReadableCopyright Copyright © 2017年 wangweicheng. All rights reserved. NSPrincipalClass - ClockView + Clock.Clock diff --git a/Clock/NSBezierPath+quartz.h b/Clock/NSBezierPath+quartz.h new file mode 100644 index 0000000..41e3c04 --- /dev/null +++ b/Clock/NSBezierPath+quartz.h @@ -0,0 +1,15 @@ +// +// NSBezierPath+quartz.h +// Clock +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import + +@interface NSBezierPath (quartz) + +- (CGPathRef)quartzPath; + +@end diff --git a/Clock/NSBezierPath+quartz.m b/Clock/NSBezierPath+quartz.m new file mode 100644 index 0000000..adc3b5a --- /dev/null +++ b/Clock/NSBezierPath+quartz.m @@ -0,0 +1,62 @@ +// +// NSBezierPath+quartz.m +// Clock +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import "NSBezierPath+quartz.h" + +@implementation NSBezierPath (quartz) + +- (CGPathRef)quartzPath +{ + NSInteger i, numElements; + CGPathRef immutablePath = NULL; + + numElements = [self elementCount]; + if (numElements > 0) + { + CGMutablePathRef path = CGPathCreateMutable(); + NSPoint points[3]; + BOOL didClosePath = YES; + + for (i = 0; i < numElements; i++) + { + switch ([self elementAtIndex:i associatedPoints:points]) + { + case NSMoveToBezierPathElement: + CGPathMoveToPoint(path, NULL, points[0].x, points[0].y); + break; + + case NSLineToBezierPathElement: + CGPathAddLineToPoint(path, NULL, points[0].x, points[0].y); + didClosePath = NO; + break; + + case NSCurveToBezierPathElement: + CGPathAddCurveToPoint(path, NULL, points[0].x, points[0].y, + points[1].x, points[1].y, + points[2].x, points[2].y); + didClosePath = NO; + break; + + case NSClosePathBezierPathElement: + CGPathCloseSubpath(path); + didClosePath = YES; + break; + } + } + + // Be sure the path is closed or Quartz may not do valid hit detection. + if (!didClosePath) + CGPathCloseSubpath(path); + + immutablePath = CGPathCreateCopy(path); + CGPathRelease(path); + } + + return immutablePath; +} +@end diff --git a/Example/AppDelegate.h b/Example/AppDelegate.h new file mode 100644 index 0000000..87414d4 --- /dev/null +++ b/Example/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// Example +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import + +@interface AppDelegate : NSObject + + +@end + diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m new file mode 100644 index 0000000..7390662 --- /dev/null +++ b/Example/AppDelegate.m @@ -0,0 +1,28 @@ +// +// AppDelegate.m +// Example +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +// Clock *clock = [[Clock alloc] initWithFrame:window isPreview:YES]; +} + + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + +@end diff --git a/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/Base.lproj/Main.storyboard b/Example/Base.lproj/Main.storyboard new file mode 100644 index 0000000..e6174b1 --- /dev/null +++ b/Example/Base.lproj/Main.storyboard @@ -0,0 +1,731 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Example.entitlements b/Example/Example.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/Example/Example.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Example/Info.plist b/Example/Info.plist new file mode 100644 index 0000000..5d74524 --- /dev/null +++ b/Example/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2017年 wangweicheng. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Example/ViewController.h b/Example/ViewController.h new file mode 100644 index 0000000..423a481 --- /dev/null +++ b/Example/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// Example +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import + +@interface ViewController : NSViewController + + +@end + diff --git a/Example/ViewController.m b/Example/ViewController.m new file mode 100644 index 0000000..7f73d80 --- /dev/null +++ b/Example/ViewController.m @@ -0,0 +1,48 @@ +// +// ViewController.m +// Example +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import "ViewController.h" +#import "Clock.h" + +@interface ViewController() + +@property (nonatomic, strong) Clock *clock; + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.clock = [[Clock alloc] initWithFrame:self.view.bounds isPreview:YES]; + [self.clock setAutoresizingMask:NSViewHeightSizable|NSViewWidthSizable]; + [self.view addSubview:self.clock]; + [self.clock startAnimation]; + +} + +- (void)viewDidAppear { + [super viewDidAppear]; +} +- (IBAction)buttonClicked:(id)sender { + + +// [textField.layer addAnimation:anim forKey:nil]; + +} + + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; + + // Update the view, if already loaded. +} + + +@end diff --git a/Example/main.m b/Example/main.m new file mode 100644 index 0000000..81f630b --- /dev/null +++ b/Example/main.m @@ -0,0 +1,13 @@ +// +// main.m +// Example +// +// Created by wangweicheng on 2017/11/14. +// Copyright © 2017年 wangweicheng. All rights reserved. +// + +#import + +int main(int argc, const char * argv[]) { + return NSApplicationMain(argc, argv); +}