From 3e15b38a2422e34e1b3a75452a83a6065696b790 Mon Sep 17 00:00:00 2001 From: Liukang Date: Sun, 30 Oct 2016 12:20:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E5=92=8C=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Project2.xcodeproj/project.pbxproj" | 568 ++++++++++++++++ .../project02/Project2/AppDelegate.h" | 22 + .../project02/Project2/AppDelegate.m" | 97 +++ .../AppIcon.appiconset/Contents.json" | 68 ++ .../Base.lproj/LaunchScreen.storyboard" | 27 + .../Project2/Base.lproj/Main.storyboard" | 60 ++ .../project02/Project2/CalendarViewCell.h" | 15 + .../project02/Project2/CalendarViewCell.m" | 13 + .../project02/Project2/Info.plist" | 45 ++ .../project02/Project2/JKCalendar.h" | 23 + .../project02/Project2/JKCalendar.m" | 139 ++++ .../Project2.xcdatamodeld/.xccurrentversion" | 8 + .../Project2.xcdatamodel/contents" | 4 + .../project02/Project2/ViewController.h" | 15 + .../project02/Project2/ViewController.m" | 75 +++ .../project02/Project2/main.m" | 16 + .../Project3.xcodeproj/project.pbxproj" | 606 ++++++++++++++++++ .../project03/Project3/AppDelegate.h" | 22 + .../project03/Project3/AppDelegate.m" | 102 +++ .../AppIcon.appiconset/Contents.json" | 68 ++ .../Base.lproj/LaunchScreen.storyboard" | 27 + .../Project3/Base.lproj/Main.storyboard" | 89 +++ .../project03/Project3/GlobalData.h" | 17 + .../project03/Project3/GlobalData.m" | 21 + .../project03/Project3/Info.plist" | 49 ++ .../Project3.xcdatamodeld/.xccurrentversion" | 8 + .../Project3.xcdatamodel/contents" | 4 + .../project03/Project3/Task.h" | 17 + .../project03/Project3/Task.m" | 30 + .../project03/Project3/TaskTableViewCell.h" | 15 + .../project03/Project3/TaskTableViewCell.m" | 23 + .../project03/Project3/ViewController.h" | 15 + .../project03/Project3/ViewController.m" | 73 +++ .../project03/Project3/main.m" | 15 + 34 files changed, 2396 insertions(+) create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2.xcodeproj/project.pbxproj" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.h" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.m" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/Assets.xcassets/AppIcon.appiconset/Contents.json" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/LaunchScreen.storyboard" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/Main.storyboard" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.h" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.m" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/Info.plist" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.h" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.m" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/.xccurrentversion" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/Project2.xcdatamodel/contents" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/ViewController.h" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/ViewController.m" create mode 100644 "21651060\345\210\230\345\272\267/project02/Project2/main.m" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3.xcodeproj/project.pbxproj" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.h" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.m" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Assets.xcassets/AppIcon.appiconset/Contents.json" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/LaunchScreen.storyboard" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/Main.storyboard" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/GlobalData.h" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/GlobalData.m" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Info.plist" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/.xccurrentversion" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/Project3.xcdatamodel/contents" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Task.h" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/Task.m" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.h" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.m" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/ViewController.h" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/ViewController.m" create mode 100644 "21651060\345\210\230\345\272\267/project03/Project3/main.m" diff --git "a/21651060\345\210\230\345\272\267/project02/Project2.xcodeproj/project.pbxproj" "b/21651060\345\210\230\345\272\267/project02/Project2.xcodeproj/project.pbxproj" new file mode 100644 index 0000000..e7c8a7c --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2.xcodeproj/project.pbxproj" @@ -0,0 +1,568 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2B3029041DBD92FF00FCCC1B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029031DBD92FF00FCCC1B /* main.m */; }; + 2B3029071DBD92FF00FCCC1B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029061DBD92FF00FCCC1B /* AppDelegate.m */; }; + 2B30290A1DBD92FF00FCCC1B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029091DBD92FF00FCCC1B /* ViewController.m */; }; + 2B30290D1DBD92FF00FCCC1B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B30290B1DBD92FF00FCCC1B /* Main.storyboard */; }; + 2B3029101DBD92FF00FCCC1B /* Project2.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 2B30290E1DBD92FF00FCCC1B /* Project2.xcdatamodeld */; }; + 2B3029121DBD92FF00FCCC1B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B3029111DBD92FF00FCCC1B /* Assets.xcassets */; }; + 2B3029151DBD92FF00FCCC1B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B3029131DBD92FF00FCCC1B /* LaunchScreen.storyboard */; }; + 2B3029201DBD930000FCCC1B /* Project2Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B30291F1DBD930000FCCC1B /* Project2Tests.m */; }; + 2B30292B1DBD930000FCCC1B /* Project2UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B30292A1DBD930000FCCC1B /* Project2UITests.m */; }; + 2B30293A1DBD94E600FCCC1B /* JKCalendar.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029391DBD94E600FCCC1B /* JKCalendar.m */; }; + 2B3029401DBD9BDA00FCCC1B /* CalendarViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B30293F1DBD9BDA00FCCC1B /* CalendarViewCell.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 2B30291C1DBD930000FCCC1B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2B3028F71DBD92FF00FCCC1B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2B3028FE1DBD92FF00FCCC1B; + remoteInfo = Project2; + }; + 2B3029271DBD930000FCCC1B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2B3028F71DBD92FF00FCCC1B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2B3028FE1DBD92FF00FCCC1B; + remoteInfo = Project2; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2B3028FF1DBD92FF00FCCC1B /* Project2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Project2.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B3029031DBD92FF00FCCC1B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2B3029051DBD92FF00FCCC1B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 2B3029061DBD92FF00FCCC1B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 2B3029081DBD92FF00FCCC1B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 2B3029091DBD92FF00FCCC1B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 2B30290C1DBD92FF00FCCC1B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 2B30290F1DBD92FF00FCCC1B /* Project2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Project2.xcdatamodel; sourceTree = ""; }; + 2B3029111DBD92FF00FCCC1B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2B3029141DBD92FF00FCCC1B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 2B3029161DBD92FF00FCCC1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2B30291B1DBD930000FCCC1B /* Project2Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Project2Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B30291F1DBD930000FCCC1B /* Project2Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Project2Tests.m; sourceTree = ""; }; + 2B3029211DBD930000FCCC1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2B3029261DBD930000FCCC1B /* Project2UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Project2UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B30292A1DBD930000FCCC1B /* Project2UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Project2UITests.m; sourceTree = ""; }; + 2B30292C1DBD930000FCCC1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2B3029381DBD94E600FCCC1B /* JKCalendar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JKCalendar.h; sourceTree = ""; }; + 2B3029391DBD94E600FCCC1B /* JKCalendar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JKCalendar.m; sourceTree = ""; }; + 2B30293E1DBD9BDA00FCCC1B /* CalendarViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CalendarViewCell.h; sourceTree = ""; }; + 2B30293F1DBD9BDA00FCCC1B /* CalendarViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CalendarViewCell.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2B3028FC1DBD92FF00FCCC1B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029181DBD930000FCCC1B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029231DBD930000FCCC1B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2B3028F61DBD92FF00FCCC1B = { + isa = PBXGroup; + children = ( + 2B3029011DBD92FF00FCCC1B /* Project2 */, + 2B30291E1DBD930000FCCC1B /* Project2Tests */, + 2B3029291DBD930000FCCC1B /* Project2UITests */, + 2B3029001DBD92FF00FCCC1B /* Products */, + ); + sourceTree = ""; + }; + 2B3029001DBD92FF00FCCC1B /* Products */ = { + isa = PBXGroup; + children = ( + 2B3028FF1DBD92FF00FCCC1B /* Project2.app */, + 2B30291B1DBD930000FCCC1B /* Project2Tests.xctest */, + 2B3029261DBD930000FCCC1B /* Project2UITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2B3029011DBD92FF00FCCC1B /* Project2 */ = { + isa = PBXGroup; + children = ( + 2B3029051DBD92FF00FCCC1B /* AppDelegate.h */, + 2B3029061DBD92FF00FCCC1B /* AppDelegate.m */, + 2B3029081DBD92FF00FCCC1B /* ViewController.h */, + 2B3029091DBD92FF00FCCC1B /* ViewController.m */, + 2B30293E1DBD9BDA00FCCC1B /* CalendarViewCell.h */, + 2B30293F1DBD9BDA00FCCC1B /* CalendarViewCell.m */, + 2B30290B1DBD92FF00FCCC1B /* Main.storyboard */, + 2B3029111DBD92FF00FCCC1B /* Assets.xcassets */, + 2B3029131DBD92FF00FCCC1B /* LaunchScreen.storyboard */, + 2B3029161DBD92FF00FCCC1B /* Info.plist */, + 2B30290E1DBD92FF00FCCC1B /* Project2.xcdatamodeld */, + 2B3029021DBD92FF00FCCC1B /* Supporting Files */, + ); + path = Project2; + sourceTree = ""; + }; + 2B3029021DBD92FF00FCCC1B /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2B3029381DBD94E600FCCC1B /* JKCalendar.h */, + 2B3029391DBD94E600FCCC1B /* JKCalendar.m */, + 2B3029031DBD92FF00FCCC1B /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 2B30291E1DBD930000FCCC1B /* Project2Tests */ = { + isa = PBXGroup; + children = ( + 2B30291F1DBD930000FCCC1B /* Project2Tests.m */, + 2B3029211DBD930000FCCC1B /* Info.plist */, + ); + path = Project2Tests; + sourceTree = ""; + }; + 2B3029291DBD930000FCCC1B /* Project2UITests */ = { + isa = PBXGroup; + children = ( + 2B30292A1DBD930000FCCC1B /* Project2UITests.m */, + 2B30292C1DBD930000FCCC1B /* Info.plist */, + ); + path = Project2UITests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2B3028FE1DBD92FF00FCCC1B /* Project2 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2B30292F1DBD930000FCCC1B /* Build configuration list for PBXNativeTarget "Project2" */; + buildPhases = ( + 2B3028FB1DBD92FF00FCCC1B /* Sources */, + 2B3028FC1DBD92FF00FCCC1B /* Frameworks */, + 2B3028FD1DBD92FF00FCCC1B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Project2; + productName = Project2; + productReference = 2B3028FF1DBD92FF00FCCC1B /* Project2.app */; + productType = "com.apple.product-type.application"; + }; + 2B30291A1DBD930000FCCC1B /* Project2Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2B3029321DBD930000FCCC1B /* Build configuration list for PBXNativeTarget "Project2Tests" */; + buildPhases = ( + 2B3029171DBD930000FCCC1B /* Sources */, + 2B3029181DBD930000FCCC1B /* Frameworks */, + 2B3029191DBD930000FCCC1B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2B30291D1DBD930000FCCC1B /* PBXTargetDependency */, + ); + name = Project2Tests; + productName = Project2Tests; + productReference = 2B30291B1DBD930000FCCC1B /* Project2Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 2B3029251DBD930000FCCC1B /* Project2UITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2B3029351DBD930000FCCC1B /* Build configuration list for PBXNativeTarget "Project2UITests" */; + buildPhases = ( + 2B3029221DBD930000FCCC1B /* Sources */, + 2B3029231DBD930000FCCC1B /* Frameworks */, + 2B3029241DBD930000FCCC1B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2B3029281DBD930000FCCC1B /* PBXTargetDependency */, + ); + name = Project2UITests; + productName = Project2UITests; + productReference = 2B3029261DBD930000FCCC1B /* Project2UITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2B3028F71DBD92FF00FCCC1B /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0800; + ORGANIZATIONNAME = "Edward Lin"; + TargetAttributes = { + 2B3028FE1DBD92FF00FCCC1B = { + CreatedOnToolsVersion = 8.0; + DevelopmentTeam = 78N63EW2U8; + ProvisioningStyle = Automatic; + }; + 2B30291A1DBD930000FCCC1B = { + CreatedOnToolsVersion = 8.0; + DevelopmentTeam = 78N63EW2U8; + ProvisioningStyle = Automatic; + TestTargetID = 2B3028FE1DBD92FF00FCCC1B; + }; + 2B3029251DBD930000FCCC1B = { + CreatedOnToolsVersion = 8.0; + DevelopmentTeam = 78N63EW2U8; + ProvisioningStyle = Automatic; + TestTargetID = 2B3028FE1DBD92FF00FCCC1B; + }; + }; + }; + buildConfigurationList = 2B3028FA1DBD92FF00FCCC1B /* Build configuration list for PBXProject "Project2" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2B3028F61DBD92FF00FCCC1B; + productRefGroup = 2B3029001DBD92FF00FCCC1B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2B3028FE1DBD92FF00FCCC1B /* Project2 */, + 2B30291A1DBD930000FCCC1B /* Project2Tests */, + 2B3029251DBD930000FCCC1B /* Project2UITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2B3028FD1DBD92FF00FCCC1B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B3029151DBD92FF00FCCC1B /* LaunchScreen.storyboard in Resources */, + 2B3029121DBD92FF00FCCC1B /* Assets.xcassets in Resources */, + 2B30290D1DBD92FF00FCCC1B /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029191DBD930000FCCC1B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029241DBD930000FCCC1B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2B3028FB1DBD92FF00FCCC1B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B30290A1DBD92FF00FCCC1B /* ViewController.m in Sources */, + 2B3029071DBD92FF00FCCC1B /* AppDelegate.m in Sources */, + 2B3029101DBD92FF00FCCC1B /* Project2.xcdatamodeld in Sources */, + 2B30293A1DBD94E600FCCC1B /* JKCalendar.m in Sources */, + 2B3029401DBD9BDA00FCCC1B /* CalendarViewCell.m in Sources */, + 2B3029041DBD92FF00FCCC1B /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029171DBD930000FCCC1B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B3029201DBD930000FCCC1B /* Project2Tests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029221DBD930000FCCC1B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B30292B1DBD930000FCCC1B /* Project2UITests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 2B30291D1DBD930000FCCC1B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2B3028FE1DBD92FF00FCCC1B /* Project2 */; + targetProxy = 2B30291C1DBD930000FCCC1B /* PBXContainerItemProxy */; + }; + 2B3029281DBD930000FCCC1B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2B3028FE1DBD92FF00FCCC1B /* Project2 */; + targetProxy = 2B3029271DBD930000FCCC1B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 2B30290B1DBD92FF00FCCC1B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2B30290C1DBD92FF00FCCC1B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 2B3029131DBD92FF00FCCC1B /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2B3029141DBD92FF00FCCC1B /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2B30292D1DBD930000FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2B30292E1DBD930000FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2B3029301DBD930000FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project2/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project2; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 2B3029311DBD930000FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project2/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project2; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 2B3029331DBD930000FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project2Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project2Tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Project2.app/Project2"; + }; + name = Debug; + }; + 2B3029341DBD930000FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project2Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project2Tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Project2.app/Project2"; + }; + name = Release; + }; + 2B3029361DBD930000FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project2UITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project2UITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Project2; + }; + name = Debug; + }; + 2B3029371DBD930000FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project2UITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project2UITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Project2; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2B3028FA1DBD92FF00FCCC1B /* Build configuration list for PBXProject "Project2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B30292D1DBD930000FCCC1B /* Debug */, + 2B30292E1DBD930000FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2B30292F1DBD930000FCCC1B /* Build configuration list for PBXNativeTarget "Project2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B3029301DBD930000FCCC1B /* Debug */, + 2B3029311DBD930000FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 2B3029321DBD930000FCCC1B /* Build configuration list for PBXNativeTarget "Project2Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B3029331DBD930000FCCC1B /* Debug */, + 2B3029341DBD930000FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 2B3029351DBD930000FCCC1B /* Build configuration list for PBXNativeTarget "Project2UITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B3029361DBD930000FCCC1B /* Debug */, + 2B3029371DBD930000FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + 2B30290E1DBD92FF00FCCC1B /* Project2.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + 2B30290F1DBD92FF00FCCC1B /* Project2.xcdatamodel */, + ); + currentVersion = 2B30290F1DBD92FF00FCCC1B /* Project2.xcdatamodel */; + path = Project2.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = 2B3028F71DBD92FF00FCCC1B /* Project object */; +} diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.h" "b/21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.h" new file mode 100644 index 0000000..c234b68 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.h" @@ -0,0 +1,22 @@ +// +// AppDelegate.h +// Project2 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@property (readonly, strong) NSPersistentContainer *persistentContainer; + +- (void)saveContext; + + +@end + diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.m" "b/21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.m" new file mode 100644 index 0000000..2f824ac --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/AppDelegate.m" @@ -0,0 +1,97 @@ +// +// AppDelegate.m +// Project2 +// +// Created by Newcon on 2016/10/24. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // 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. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // 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. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Saves changes in the application's managed object context before the application terminates. + [self saveContext]; +} + + +#pragma mark - Core Data stack + +@synthesize persistentContainer = _persistentContainer; + +- (NSPersistentContainer *)persistentContainer { + // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. + @synchronized (self) { + if (_persistentContainer == nil) { + _persistentContainer = [[NSPersistentContainer alloc] initWithName:@"Project2"]; + [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) { + if (error != nil) { + // Replace this implementation with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + NSLog(@"Unresolved error %@, %@", error, error.userInfo); + abort(); + } + }]; + } + } + + return _persistentContainer; +} + +#pragma mark - Core Data Saving support + +- (void)saveContext { + NSManagedObjectContext *context = self.persistentContainer.viewContext; + NSError *error = nil; + if ([context hasChanges] && ![context save:&error]) { + // Replace this implementation with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + NSLog(@"Unresolved error %@, %@", error, error.userInfo); + abort(); + } +} + +@end diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/Assets.xcassets/AppIcon.appiconset/Contents.json" "b/21651060\345\210\230\345\272\267/project02/Project2/Assets.xcassets/AppIcon.appiconset/Contents.json" new file mode 100644 index 0000000..36d2c80 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/Assets.xcassets/AppIcon.appiconset/Contents.json" @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/LaunchScreen.storyboard" "b/21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/LaunchScreen.storyboard" new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/LaunchScreen.storyboard" @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/Main.storyboard" "b/21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/Main.storyboard" new file mode 100644 index 0000000..d3dc9f2 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/Base.lproj/Main.storyboard" @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.h" "b/21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.h" new file mode 100644 index 0000000..b02cbef --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.h" @@ -0,0 +1,15 @@ +// +// CalendarViewCell.h +// Project2 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import + +@interface CalendarViewCell : UICollectionViewCell + +@property (weak, nonatomic) IBOutlet UILabel *cellLabel; + +@end diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.m" "b/21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.m" new file mode 100644 index 0000000..d60d041 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/CalendarViewCell.m" @@ -0,0 +1,13 @@ +// +// CalendarViewCell.m +// Project2 +// +// Created by Newcon on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import "CalendarViewCell.h" + +@implementation CalendarViewCell + +@end diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/Info.plist" "b/21651060\345\210\230\345\272\267/project02/Project2/Info.plist" new file mode 100644 index 0000000..d052473 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/Info.plist" @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.h" "b/21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.h" new file mode 100644 index 0000000..b90a380 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.h" @@ -0,0 +1,23 @@ +// +// JKCalendar.h +// Project1 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import + +@interface JKCalendar : NSObject + +@property (nonatomic, copy, readonly) NSString *weekTitle; +@property (nonatomic, copy, readonly) NSArray *monthTitleInYearArray; +@property (nonatomic, copy, readonly) NSString *weekTitleInYear; +@property (nonatomic, copy, readonly) NSArray *monthTitleArray; + +- (NSString *)printMonthCalendarWithFirstDayOfMonth:(NSDate *) firstDayOfMonth; +- (NSString *)printYearCalendarWithYear:(int) year; + +- (NSArray *)getArrayOfCalendarWithFirstDayOfMonth:(NSDate *) firstDayOfMonth; + +@end diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.m" "b/21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.m" new file mode 100644 index 0000000..d19053a --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/JKCalendar.m" @@ -0,0 +1,139 @@ +// +// JKCalendar.m +// Project2 +// +// Created by Newcon on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import "JKCalendar.h" + +@implementation JKCalendar + +- (instancetype)init +{ + if (self = [super init]) { + _weekTitle = @"日 一 二 三 四 五 六"; + _monthTitleInYearArray = @[@" 一月 二月 三月", + @" 四月 五月 六月", + @" 七月 八月 九月", + @" 十月 十一月 十二月"]; + _weekTitleInYear = @"日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六"; + _monthTitleArray = @[@" 一月", @" 二月", @" 三月", @" 四月", @" 五月", @" 六月", @" 七月", @" 八月", @" 九月", @" 十月", @"十一月", @"十二月"]; + } + return self; +} + +- (NSArray *)getArrayOfCalendarWithFirstDayOfMonth:(NSDate *) firstDayOfMonth { + NSMutableArray *output = [NSMutableArray array]; + + NSDateComponents *firstDayOfMonthComponents = [[NSCalendar currentCalendar] components:NSCalendarUnitDay|NSCalendarUnitMonth|NSCalendarUnitYear|NSCalendarUnitWeekday fromDate:firstDayOfMonth]; + [output addObject:[NSString stringWithFormat:@"%@ %ld", [_monthTitleArray objectAtIndex:([firstDayOfMonthComponents month] - 1)], (long)[firstDayOfMonthComponents year]]]; + + NSArray *weekTitle = @[@"日", @"一", @"二", @"三", @"四", @"五", @"六"]; + [output addObjectsFromArray:weekTitle]; + + NSMutableArray *currentMonthArray = [NSMutableArray arrayWithCapacity:31]; + for (int i = 0; i < [firstDayOfMonthComponents weekday] - 1; ++i) { //每月第一天之前用空格补充 + [currentMonthArray addObject:@" "]; + } + for (int i = 0; i < [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:firstDayOfMonth].length; ++i) { + [currentMonthArray addObject:[NSString stringWithFormat:@"%2i", i + 1]]; + } + [output addObjectsFromArray:currentMonthArray]; + + for (NSInteger i = output.count; i <= 49; ++i) { + [output addObject:@" "]; + } + + return output; +} + +- (NSString *)printMonthCalendarWithFirstDayOfMonth:(NSDate *) firstDayOfMonth { + NSMutableString *output = [NSMutableString string]; + + NSDateComponents *firstDayOfMonthComponents = [[NSCalendar currentCalendar] components:NSCalendarUnitDay|NSCalendarUnitMonth|NSCalendarUnitYear|NSCalendarUnitWeekday fromDate:firstDayOfMonth]; + [output appendFormat:@"\n %@ %ld\n", [_monthTitleArray objectAtIndex:([firstDayOfMonthComponents month] - 1)], (long)[firstDayOfMonthComponents year]]; + [output appendFormat:@"%@\n", _weekTitle]; + + NSMutableArray *currentMonthArray = [NSMutableArray arrayWithCapacity:31]; + for (int i = 0; i < [firstDayOfMonthComponents weekday] - 1; ++i) { //每月第一天之前用空格补充 + [currentMonthArray addObject:@" "]; + } + for (int i = 0; i < [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:firstDayOfMonth].length; ++i) { + [currentMonthArray addObject:[NSString stringWithFormat:@"%2i", i + 1]]; + } + NSMutableString *outputLine = [NSMutableString string]; //七天一换行 + for (int i = 0; i < [currentMonthArray count]; ++i) { + [outputLine appendFormat:@"%@ ", [currentMonthArray objectAtIndex:i]]; + if (i % 7 == 6) { + [output appendFormat:@"%@\n", [outputLine substringToIndex:([outputLine length] - 1)]]; + outputLine = [NSMutableString string]; + } + } + if (![outputLine isEqualToString:@""]) { //最后一周可能没有七天 + [output appendFormat:@"%@\n", [outputLine substringToIndex:([outputLine length] - 1)]]; + } +// NSLog(@"%@", output); + return output; +} + +- (NSString *)printYearCalendarWithYear:(int) year { + NSMutableString *output = [NSMutableString string]; + + [output appendFormat:@"\n %i\n\n", year]; + + NSMutableArray *monthArrays = [NSMutableArray arrayWithCapacity:12]; + + for (int i = 0; i < 12; ++i) { + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; // 年-月-日 时:分:秒 + NSString *dateStr = [NSString stringWithFormat:@"%i-%i-01 12:00:00", year, i + 1]; //自定义每个月的第一天 + NSDate *firstDayOfMonth = [formatter dateFromString:dateStr]; + NSDateComponents *firstDayOfMonthComponents = [[NSCalendar currentCalendar] components:NSCalendarUnitDay|NSCalendarUnitMonth|NSCalendarUnitYear|NSCalendarUnitWeekday fromDate:firstDayOfMonth]; + + NSMutableArray *theMonthArray = [NSMutableArray array]; //初始化这个月,并存为Array,每个月都按六周算,前后用空格补充 + for (int j = 0; j < [firstDayOfMonthComponents weekday] - 1; ++j) { + [theMonthArray addObject:@" "]; + } + for (int j = 0; j < [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:firstDayOfMonth].length; ++j) { + [theMonthArray addObject:[NSString stringWithFormat:@"%2i", j + 1]]; + } + if ((i + 1) % 3 != 0) { + for (int j = (int)[theMonthArray count]; j < 42; ++j) { + [theMonthArray addObject:@" "]; + } + } + + [monthArrays addObject:[NSMutableArray arrayWithArray:[theMonthArray copy]]]; + } + + for (int i = 0; i < 4; ++i) { + [output appendFormat:@"%@\n%@\n", _monthTitleInYearArray[i], _weekTitleInYear]; + + for (int line = 0; line < 6; ++line) { //每个月都是输出六行,每行都是输出第i周的三个月的日期 + NSString *outputLine = [NSString string]; //outputLine保存每行的输出字符串 + for (int j = 0; j < 3; ++j) { //每行三个月 + NSMutableArray *theMonthArray = [NSMutableArray arrayWithArray:[monthArrays objectAtIndex:i * 3 + j]]; + for (int k = line * 7; k < [theMonthArray count]; ++k) { //每七天后接下个月第i周的日期 + outputLine = [outputLine stringByAppendingString:[NSString stringWithFormat:@"%@ ", [theMonthArray objectAtIndex:k]]]; + if (k % 7 == 6 ) { + if ((j + 1) % 3 != 0) { + outputLine = [outputLine stringByAppendingString:@" "]; + } + break; + } + } + } + if ([outputLine length] > 46) { //当这行完成以后,保存进最终的输出字符串output + [output appendFormat:@"%@\n", [outputLine substringToIndex:([outputLine length] - 1)]]; + } else { + [output appendFormat:@"%@\n", outputLine]; + } + } + } +// NSLog(@"%@", output); + return output; +} + +@end diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/.xccurrentversion" "b/21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/.xccurrentversion" new file mode 100644 index 0000000..251e4da --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/.xccurrentversion" @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + Project2.xcdatamodel + + diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/Project2.xcdatamodel/contents" "b/21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/Project2.xcdatamodel/contents" new file mode 100644 index 0000000..ad82c3b --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/Project2.xcdatamodeld/Project2.xcdatamodel/contents" @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/ViewController.h" "b/21651060\345\210\230\345\272\267/project02/Project2/ViewController.h" new file mode 100644 index 0000000..cb0692a --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/ViewController.h" @@ -0,0 +1,15 @@ +// +// ViewController.h +// Project2 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import + +@interface ViewController : UICollectionViewController + + +@end + diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/ViewController.m" "b/21651060\345\210\230\345\272\267/project02/Project2/ViewController.m" new file mode 100644 index 0000000..48b9f3c --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/ViewController.m" @@ -0,0 +1,75 @@ +// +// ViewController.m +// Project2 +// +// Created by Newcon on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import "ViewController.h" +#import "JKCalendar.h" +#import "CalendarViewCell.h" + +@interface ViewController () + +@property (nonatomic, strong) NSArray *outputArray; + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + + JKCalendar *jkCalendar = [[JKCalendar alloc] init]; + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDate *currentDate = [NSDate date]; + NSDateComponents *components = [calendar components:NSCalendarUnitDay|NSCalendarUnitMonth|NSCalendarUnitYear|NSCalendarUnitWeekday fromDate:currentDate]; + + NSDate *firstDayOfMonth = [NSDate dateWithTimeIntervalSinceNow:(-24 * 60 * 60 *([components day] - 1))]; //得到当前月的第一天 + _outputArray = [NSArray array]; + _outputArray = [jkCalendar getArrayOfCalendarWithFirstDayOfMonth:firstDayOfMonth]; + +} + +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { + return 2; +} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + if (section == 0) { + return 1; + } else { + return 49; + } +} + +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + CalendarViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CalendarViewCell" forIndexPath:indexPath]; + cell.cellLabel.text = _outputArray[indexPath.row + indexPath.section]; + return cell; +} + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ + NSInteger cellWidth = self.collectionView.frame.size.width / 7 - 9; + CGSize cellSize; + if (indexPath.section == 0) { + cellSize.width = self.collectionView.frame.size.width; + cellSize.height = cellWidth; + } else { + cellSize.width = cellWidth; + cellSize.height = cellWidth; + } + cellSize = CGSizeMake(cellSize.width, cellSize.height); + return cellSize; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + + + +@end diff --git "a/21651060\345\210\230\345\272\267/project02/Project2/main.m" "b/21651060\345\210\230\345\272\267/project02/Project2/main.m" new file mode 100644 index 0000000..6f6d617 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project02/Project2/main.m" @@ -0,0 +1,16 @@ +// +// main.m +// Project2 +// +// Created by Newcon on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git "a/21651060\345\210\230\345\272\267/project03/Project3.xcodeproj/project.pbxproj" "b/21651060\345\210\230\345\272\267/project03/Project3.xcodeproj/project.pbxproj" new file mode 100644 index 0000000..8d28bb3 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3.xcodeproj/project.pbxproj" @@ -0,0 +1,606 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2B30294F1DBDA1B400FCCC1B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B30294E1DBDA1B400FCCC1B /* main.m */; }; + 2B3029521DBDA1B400FCCC1B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029511DBDA1B400FCCC1B /* AppDelegate.m */; }; + 2B3029551DBDA1B400FCCC1B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029541DBDA1B400FCCC1B /* ViewController.m */; }; + 2B3029581DBDA1B400FCCC1B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B3029561DBDA1B400FCCC1B /* Main.storyboard */; }; + 2B30295B1DBDA1B400FCCC1B /* Project3.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029591DBDA1B400FCCC1B /* Project3.xcdatamodeld */; }; + 2B30295D1DBDA1B400FCCC1B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B30295C1DBDA1B400FCCC1B /* Assets.xcassets */; }; + 2B3029601DBDA1B400FCCC1B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B30295E1DBDA1B400FCCC1B /* LaunchScreen.storyboard */; }; + 2B30296B1DBDA1B400FCCC1B /* Project3Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B30296A1DBDA1B400FCCC1B /* Project3Tests.m */; }; + 2B3029761DBDA1B400FCCC1B /* Project3UITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029751DBDA1B400FCCC1B /* Project3UITests.m */; }; + 2B3029881DBDA33C00FCCC1B /* TaskTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B3029871DBDA33C00FCCC1B /* TaskTableViewCell.m */; }; + 2B30298B1DBDA37500FCCC1B /* Task.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B30298A1DBDA37500FCCC1B /* Task.m */; }; + 2BEC9DD11DC04E740053C8E6 /* GlobalData.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BEC9DD01DC04E740053C8E6 /* GlobalData.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 2B3029671DBDA1B400FCCC1B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2B3029421DBDA1B400FCCC1B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2B3029491DBDA1B400FCCC1B; + remoteInfo = Project3; + }; + 2B3029721DBDA1B400FCCC1B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2B3029421DBDA1B400FCCC1B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2B3029491DBDA1B400FCCC1B; + remoteInfo = Project3; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2B30294A1DBDA1B400FCCC1B /* Project3.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Project3.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B30294E1DBDA1B400FCCC1B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2B3029501DBDA1B400FCCC1B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 2B3029511DBDA1B400FCCC1B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 2B3029531DBDA1B400FCCC1B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 2B3029541DBDA1B400FCCC1B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 2B3029571DBDA1B400FCCC1B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 2B30295A1DBDA1B400FCCC1B /* Project3.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Project3.xcdatamodel; sourceTree = ""; }; + 2B30295C1DBDA1B400FCCC1B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2B30295F1DBDA1B400FCCC1B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 2B3029611DBDA1B400FCCC1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2B3029661DBDA1B400FCCC1B /* Project3Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Project3Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B30296A1DBDA1B400FCCC1B /* Project3Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Project3Tests.m; sourceTree = ""; }; + 2B30296C1DBDA1B400FCCC1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2B3029711DBDA1B400FCCC1B /* Project3UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Project3UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B3029751DBDA1B400FCCC1B /* Project3UITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Project3UITests.m; sourceTree = ""; }; + 2B3029771DBDA1B400FCCC1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2B3029861DBDA33C00FCCC1B /* TaskTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskTableViewCell.h; sourceTree = ""; }; + 2B3029871DBDA33C00FCCC1B /* TaskTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskTableViewCell.m; sourceTree = ""; }; + 2B3029891DBDA37500FCCC1B /* Task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Task.h; sourceTree = ""; }; + 2B30298A1DBDA37500FCCC1B /* Task.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Task.m; sourceTree = ""; }; + 2BEC9DCF1DC04E740053C8E6 /* GlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalData.h; sourceTree = ""; }; + 2BEC9DD01DC04E740053C8E6 /* GlobalData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GlobalData.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2B3029471DBDA1B400FCCC1B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029631DBDA1B400FCCC1B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B30296E1DBDA1B400FCCC1B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2B3029411DBDA1B400FCCC1B = { + isa = PBXGroup; + children = ( + 2B30294C1DBDA1B400FCCC1B /* Project3 */, + 2B3029691DBDA1B400FCCC1B /* Project3Tests */, + 2B3029741DBDA1B400FCCC1B /* Project3UITests */, + 2B30294B1DBDA1B400FCCC1B /* Products */, + ); + sourceTree = ""; + }; + 2B30294B1DBDA1B400FCCC1B /* Products */ = { + isa = PBXGroup; + children = ( + 2B30294A1DBDA1B400FCCC1B /* Project3.app */, + 2B3029661DBDA1B400FCCC1B /* Project3Tests.xctest */, + 2B3029711DBDA1B400FCCC1B /* Project3UITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2B30294C1DBDA1B400FCCC1B /* Project3 */ = { + isa = PBXGroup; + children = ( + 2BEC9DCF1DC04E740053C8E6 /* GlobalData.h */, + 2BEC9DD01DC04E740053C8E6 /* GlobalData.m */, + 2B3029831DBDA2DE00FCCC1B /* Model */, + 2B3029841DBDA2E800FCCC1B /* View */, + 2B3029851DBDA2ED00FCCC1B /* Controller */, + 2B3029501DBDA1B400FCCC1B /* AppDelegate.h */, + 2B3029511DBDA1B400FCCC1B /* AppDelegate.m */, + 2B30295C1DBDA1B400FCCC1B /* Assets.xcassets */, + 2B30295E1DBDA1B400FCCC1B /* LaunchScreen.storyboard */, + 2B3029611DBDA1B400FCCC1B /* Info.plist */, + 2B3029591DBDA1B400FCCC1B /* Project3.xcdatamodeld */, + 2B30294D1DBDA1B400FCCC1B /* Supporting Files */, + ); + path = Project3; + sourceTree = ""; + }; + 2B30294D1DBDA1B400FCCC1B /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2B30294E1DBDA1B400FCCC1B /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 2B3029691DBDA1B400FCCC1B /* Project3Tests */ = { + isa = PBXGroup; + children = ( + 2B30296A1DBDA1B400FCCC1B /* Project3Tests.m */, + 2B30296C1DBDA1B400FCCC1B /* Info.plist */, + ); + path = Project3Tests; + sourceTree = ""; + }; + 2B3029741DBDA1B400FCCC1B /* Project3UITests */ = { + isa = PBXGroup; + children = ( + 2B3029751DBDA1B400FCCC1B /* Project3UITests.m */, + 2B3029771DBDA1B400FCCC1B /* Info.plist */, + ); + path = Project3UITests; + sourceTree = ""; + }; + 2B3029831DBDA2DE00FCCC1B /* Model */ = { + isa = PBXGroup; + children = ( + 2B3029891DBDA37500FCCC1B /* Task.h */, + 2B30298A1DBDA37500FCCC1B /* Task.m */, + ); + name = Model; + sourceTree = ""; + }; + 2B3029841DBDA2E800FCCC1B /* View */ = { + isa = PBXGroup; + children = ( + 2B3029861DBDA33C00FCCC1B /* TaskTableViewCell.h */, + 2B3029871DBDA33C00FCCC1B /* TaskTableViewCell.m */, + ); + name = View; + sourceTree = ""; + }; + 2B3029851DBDA2ED00FCCC1B /* Controller */ = { + isa = PBXGroup; + children = ( + 2B3029561DBDA1B400FCCC1B /* Main.storyboard */, + 2B3029531DBDA1B400FCCC1B /* ViewController.h */, + 2B3029541DBDA1B400FCCC1B /* ViewController.m */, + ); + name = Controller; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2B3029491DBDA1B400FCCC1B /* Project3 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2B30297A1DBDA1B400FCCC1B /* Build configuration list for PBXNativeTarget "Project3" */; + buildPhases = ( + 2B3029461DBDA1B400FCCC1B /* Sources */, + 2B3029471DBDA1B400FCCC1B /* Frameworks */, + 2B3029481DBDA1B400FCCC1B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Project3; + productName = Project3; + productReference = 2B30294A1DBDA1B400FCCC1B /* Project3.app */; + productType = "com.apple.product-type.application"; + }; + 2B3029651DBDA1B400FCCC1B /* Project3Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2B30297D1DBDA1B400FCCC1B /* Build configuration list for PBXNativeTarget "Project3Tests" */; + buildPhases = ( + 2B3029621DBDA1B400FCCC1B /* Sources */, + 2B3029631DBDA1B400FCCC1B /* Frameworks */, + 2B3029641DBDA1B400FCCC1B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2B3029681DBDA1B400FCCC1B /* PBXTargetDependency */, + ); + name = Project3Tests; + productName = Project3Tests; + productReference = 2B3029661DBDA1B400FCCC1B /* Project3Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 2B3029701DBDA1B400FCCC1B /* Project3UITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2B3029801DBDA1B400FCCC1B /* Build configuration list for PBXNativeTarget "Project3UITests" */; + buildPhases = ( + 2B30296D1DBDA1B400FCCC1B /* Sources */, + 2B30296E1DBDA1B400FCCC1B /* Frameworks */, + 2B30296F1DBDA1B400FCCC1B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2B3029731DBDA1B400FCCC1B /* PBXTargetDependency */, + ); + name = Project3UITests; + productName = Project3UITests; + productReference = 2B3029711DBDA1B400FCCC1B /* Project3UITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2B3029421DBDA1B400FCCC1B /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0800; + ORGANIZATIONNAME = "Edward Lin"; + TargetAttributes = { + 2B3029491DBDA1B400FCCC1B = { + CreatedOnToolsVersion = 8.0; + DevelopmentTeam = 78N63EW2U8; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.BackgroundModes = { + enabled = 1; + }; + }; + }; + 2B3029651DBDA1B400FCCC1B = { + CreatedOnToolsVersion = 8.0; + DevelopmentTeam = 78N63EW2U8; + ProvisioningStyle = Automatic; + TestTargetID = 2B3029491DBDA1B400FCCC1B; + }; + 2B3029701DBDA1B400FCCC1B = { + CreatedOnToolsVersion = 8.0; + DevelopmentTeam = 78N63EW2U8; + ProvisioningStyle = Automatic; + TestTargetID = 2B3029491DBDA1B400FCCC1B; + }; + }; + }; + buildConfigurationList = 2B3029451DBDA1B400FCCC1B /* Build configuration list for PBXProject "Project3" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2B3029411DBDA1B400FCCC1B; + productRefGroup = 2B30294B1DBDA1B400FCCC1B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2B3029491DBDA1B400FCCC1B /* Project3 */, + 2B3029651DBDA1B400FCCC1B /* Project3Tests */, + 2B3029701DBDA1B400FCCC1B /* Project3UITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2B3029481DBDA1B400FCCC1B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B3029601DBDA1B400FCCC1B /* LaunchScreen.storyboard in Resources */, + 2B30295D1DBDA1B400FCCC1B /* Assets.xcassets in Resources */, + 2B3029581DBDA1B400FCCC1B /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029641DBDA1B400FCCC1B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B30296F1DBDA1B400FCCC1B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2B3029461DBDA1B400FCCC1B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BEC9DD11DC04E740053C8E6 /* GlobalData.m in Sources */, + 2B3029551DBDA1B400FCCC1B /* ViewController.m in Sources */, + 2B3029521DBDA1B400FCCC1B /* AppDelegate.m in Sources */, + 2B3029881DBDA33C00FCCC1B /* TaskTableViewCell.m in Sources */, + 2B30294F1DBDA1B400FCCC1B /* main.m in Sources */, + 2B30298B1DBDA37500FCCC1B /* Task.m in Sources */, + 2B30295B1DBDA1B400FCCC1B /* Project3.xcdatamodeld in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B3029621DBDA1B400FCCC1B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B30296B1DBDA1B400FCCC1B /* Project3Tests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B30296D1DBDA1B400FCCC1B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B3029761DBDA1B400FCCC1B /* Project3UITests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 2B3029681DBDA1B400FCCC1B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2B3029491DBDA1B400FCCC1B /* Project3 */; + targetProxy = 2B3029671DBDA1B400FCCC1B /* PBXContainerItemProxy */; + }; + 2B3029731DBDA1B400FCCC1B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2B3029491DBDA1B400FCCC1B /* Project3 */; + targetProxy = 2B3029721DBDA1B400FCCC1B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 2B3029561DBDA1B400FCCC1B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2B3029571DBDA1B400FCCC1B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 2B30295E1DBDA1B400FCCC1B /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2B30295F1DBDA1B400FCCC1B /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2B3029781DBDA1B400FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2B3029791DBDA1B400FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2B30297B1DBDA1B400FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project3/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project3; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 2B30297C1DBDA1B400FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project3/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project3; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 2B30297E1DBDA1B400FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project3Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project3Tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Project3.app/Project3"; + }; + name = Debug; + }; + 2B30297F1DBDA1B400FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project3Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project3Tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Project3.app/Project3"; + }; + name = Release; + }; + 2B3029811DBDA1B400FCCC1B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project3UITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project3UITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Project3; + }; + name = Debug; + }; + 2B3029821DBDA1B400FCCC1B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = 78N63EW2U8; + INFOPLIST_FILE = Project3UITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.EL.Project3UITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Project3; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2B3029451DBDA1B400FCCC1B /* Build configuration list for PBXProject "Project3" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B3029781DBDA1B400FCCC1B /* Debug */, + 2B3029791DBDA1B400FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2B30297A1DBDA1B400FCCC1B /* Build configuration list for PBXNativeTarget "Project3" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B30297B1DBDA1B400FCCC1B /* Debug */, + 2B30297C1DBDA1B400FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2B30297D1DBDA1B400FCCC1B /* Build configuration list for PBXNativeTarget "Project3Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B30297E1DBDA1B400FCCC1B /* Debug */, + 2B30297F1DBDA1B400FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2B3029801DBDA1B400FCCC1B /* Build configuration list for PBXNativeTarget "Project3UITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2B3029811DBDA1B400FCCC1B /* Debug */, + 2B3029821DBDA1B400FCCC1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + 2B3029591DBDA1B400FCCC1B /* Project3.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + 2B30295A1DBDA1B400FCCC1B /* Project3.xcdatamodel */, + ); + currentVersion = 2B30295A1DBDA1B400FCCC1B /* Project3.xcdatamodel */; + path = Project3.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = 2B3029421DBDA1B400FCCC1B /* Project object */; +} diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.h" "b/21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.h" new file mode 100644 index 0000000..52ba65d --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.h" @@ -0,0 +1,22 @@ +// +// AppDelegate.h +// Project3 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@property (readonly, strong) NSPersistentContainer *persistentContainer; + +- (void)saveContext; + + +@end + diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.m" "b/21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.m" new file mode 100644 index 0000000..f6da1b6 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/AppDelegate.m" @@ -0,0 +1,102 @@ +// +// AppDelegate.m +// Project3 +// +// Created by Newcon on 2016/10/24. +// + +#import "AppDelegate.h" +#import "GlobalData.h" +#import "Task.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // 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. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + NSArray *tasksArray = [GlobalData sharedData].tasks; + [NSKeyedArchiver archiveRootObject:tasksArray toFile:[Task docPath]]; + +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // 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. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Saves changes in the application's managed object context before the application terminates. + [self saveContext]; +} + + +#pragma mark - Core Data stack + +@synthesize persistentContainer = _persistentContainer; + +- (NSPersistentContainer *)persistentContainer { + // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. + @synchronized (self) { + if (_persistentContainer == nil) { + _persistentContainer = [[NSPersistentContainer alloc] initWithName:@"Project3"]; + [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) { + if (error != nil) { + // Replace this implementation with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + NSLog(@"Unresolved error %@, %@", error, error.userInfo); + abort(); + } + }]; + } + } + + return _persistentContainer; +} + +#pragma mark - Core Data Saving support + +- (void)saveContext { + NSManagedObjectContext *context = self.persistentContainer.viewContext; + NSError *error = nil; + if ([context hasChanges] && ![context save:&error]) { + // Replace this implementation with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + NSLog(@"Unresolved error %@, %@", error, error.userInfo); + abort(); + } +} + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Assets.xcassets/AppIcon.appiconset/Contents.json" "b/21651060\345\210\230\345\272\267/project03/Project3/Assets.xcassets/AppIcon.appiconset/Contents.json" new file mode 100644 index 0000000..36d2c80 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Assets.xcassets/AppIcon.appiconset/Contents.json" @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/LaunchScreen.storyboard" "b/21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/LaunchScreen.storyboard" new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/LaunchScreen.storyboard" @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/Main.storyboard" "b/21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/Main.storyboard" new file mode 100644 index 0000000..ce54848 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Base.lproj/Main.storyboard" @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/GlobalData.h" "b/21651060\345\210\230\345\272\267/project03/Project3/GlobalData.h" new file mode 100644 index 0000000..0893ade --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/GlobalData.h" @@ -0,0 +1,17 @@ +// +// GlobalData.h +// Project3 +// +// Created by Edward Lin on 2016/10/26. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import + +@interface GlobalData : NSObject + +@property (nonatomic, strong) NSArray *tasks; + ++ (instancetype)sharedData; + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/GlobalData.m" "b/21651060\345\210\230\345\272\267/project03/Project3/GlobalData.m" new file mode 100644 index 0000000..93bc6f4 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/GlobalData.m" @@ -0,0 +1,21 @@ +// +// GlobalData.m +// Project3 +// +// Created by Newcon on 2016/10/26. +// + +#import "GlobalData.h" + +@implementation GlobalData + ++ (instancetype)sharedData { + static id instance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + instance = [self new]; + }); + return instance; +} + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Info.plist" "b/21651060\345\210\230\345\272\267/project03/Project3/Info.plist" new file mode 100644 index 0000000..979368a --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Info.plist" @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIBackgroundModes + + newsstand-content + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/.xccurrentversion" "b/21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/.xccurrentversion" new file mode 100644 index 0000000..df44a69 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/.xccurrentversion" @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + Project3.xcdatamodel + + diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/Project3.xcdatamodel/contents" "b/21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/Project3.xcdatamodel/contents" new file mode 100644 index 0000000..ad82c3b --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Project3.xcdatamodeld/Project3.xcdatamodel/contents" @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Task.h" "b/21651060\345\210\230\345\272\267/project03/Project3/Task.h" new file mode 100644 index 0000000..e6779ed --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Task.h" @@ -0,0 +1,17 @@ +// +// Task.h +// Project3 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import + +@interface Task : NSObject + +@property (copy, nonatomic) NSString *taskName; + ++ (NSString *)docPath; + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/Task.m" "b/21651060\345\210\230\345\272\267/project03/Project3/Task.m" new file mode 100644 index 0000000..de49bc2 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/Task.m" @@ -0,0 +1,30 @@ +// +// Task.m +// Project3 +// +// Created by Newcon on 2016/10/24. +// + +#import "Task.h" + +@implementation Task + ++ (NSString *)docPath { + NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *docPath = [[pathArray objectAtIndex:0] stringByAppendingPathComponent:@"data.data"]; + NSLog(@"%@", docPath); + return docPath; +} + +- (void)encodeWithCoder:(NSCoder *)encoder { + [encoder encodeObject:self.taskName forKey:@"task"]; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder { + if (self = [super init]) { + self.taskName = [decoder decodeObjectForKey:@"task"]; + } + return self; +} + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.h" "b/21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.h" new file mode 100644 index 0000000..d02b92a --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.h" @@ -0,0 +1,15 @@ +// +// TaskTableViewCell.h +// Project3 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import + +@interface TaskTableViewCell : UITableViewCell + +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.m" "b/21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.m" new file mode 100644 index 0000000..6bc0de8 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/TaskTableViewCell.m" @@ -0,0 +1,23 @@ +// +// TaskTableViewCell.m +// Project3 +// +// Created by Newcon on 2016/10/24. +// + +#import "TaskTableViewCell.h" + +@implementation TaskTableViewCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/ViewController.h" "b/21651060\345\210\230\345\272\267/project03/Project3/ViewController.h" new file mode 100644 index 0000000..50a2070 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/ViewController.h" @@ -0,0 +1,15 @@ +// +// ViewController.h +// Project3 +// +// Created by Edward Lin on 2016/10/24. +// Copyright © 2016年 Edward Lin. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/ViewController.m" "b/21651060\345\210\230\345\272\267/project03/Project3/ViewController.m" new file mode 100644 index 0000000..68fc5d4 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/ViewController.m" @@ -0,0 +1,73 @@ +// +// ViewController.m +// Project3 +// +// Created by Newcon on 2016/10/24. +// + +#import "ViewController.h" +#import "Task.h" +#import "TaskTableViewCell.h" +#import "GlobalData.h" + +@interface ViewController () + +@property (strong, nonatomic) NSMutableArray *taskArray; + +@property (weak, nonatomic) IBOutlet UITextField *taskTextField; +@property (weak, nonatomic) IBOutlet UITableView *taskTableView; + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + + [self loadTasksData]; +} + +- (void)loadTasksData { + _taskArray = [NSMutableArray array]; + NSArray *tempArray = [NSArray array]; + tempArray = [NSKeyedUnarchiver unarchiveObjectWithFile:[Task docPath]]; + if (tempArray != nil) { + _taskArray = [tempArray mutableCopy]; + } + [GlobalData sharedData].tasks = [NSArray array]; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [_taskArray count]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + TaskTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskTableViewCell" forIndexPath:indexPath]; + cell.titleLabel.text = _taskArray[indexPath.row].taskName; + return cell; +} + +- (IBAction)insertButtonDidClicked:(id)sender { + Task *newTask = [[Task alloc] init]; + newTask.taskName = _taskTextField.text; + if ([newTask.taskName isEqualToString:@""]) { + return; + } + [_taskArray addObject:newTask]; + [self.taskTableView reloadData]; + [self.taskTextField setText:@""]; + [self.taskTextField resignFirstResponder]; + [GlobalData sharedData].tasks = _taskArray; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git "a/21651060\345\210\230\345\272\267/project03/Project3/main.m" "b/21651060\345\210\230\345\272\267/project03/Project3/main.m" new file mode 100644 index 0000000..29b1916 --- /dev/null +++ "b/21651060\345\210\230\345\272\267/project03/Project3/main.m" @@ -0,0 +1,15 @@ +// +// main.m +// Project3 +// +// Created by Newcon on 2016/10/24. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +}