diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/README.md" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/README.md" new file mode 100644 index 00000000..a428a4c0 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/README.md" @@ -0,0 +1,22 @@ +# iPhone开发第二次作业 +====== +- 作业内容:实现一个计算器 +- 平台:iOS +- 编程语言:Objective-C +- 测试环境:iOS Simulator - iPhone 6 / iOS 8.0 +- 实现功能说明: + - '+':加号 + - '-':减号 + - 'x':乘号 + - '/':除号 + - '%':取余数 + - '(', ')':左、右括号 + - '±':改变结果符号 + - '=':计算表达式的值 + - 'AC':清零 + - 'MC':清空内存值 + - 'M+':将显示值与内存值相加 + - 'M-':将内存值减去显示值 + - 'MR':重新调用存储在内存中的值 + - 'delete':删除表达式最后一个字符 + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.pbxproj" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.pbxproj" new file mode 100644 index 00000000..742df56b --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.pbxproj" @@ -0,0 +1,437 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E134D81B1A07AE0E00E2A7DB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E134D81A1A07AE0E00E2A7DB /* main.m */; }; + E134D81E1A07AE0E00E2A7DB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E134D81D1A07AE0E00E2A7DB /* AppDelegate.m */; }; + E134D8211A07AE0E00E2A7DB /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E134D8201A07AE0E00E2A7DB /* ViewController.m */; }; + E134D8241A07AE0E00E2A7DB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E134D8221A07AE0E00E2A7DB /* Main.storyboard */; }; + E134D8261A07AE0E00E2A7DB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E134D8251A07AE0E00E2A7DB /* Images.xcassets */; }; + E134D8291A07AE0E00E2A7DB /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E134D8271A07AE0E00E2A7DB /* LaunchScreen.xib */; }; + E134D8351A07AE0E00E2A7DB /* SimpleCalculatorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E134D8341A07AE0E00E2A7DB /* SimpleCalculatorTests.m */; }; + E18E59F41A08A3D5005A13E9 /* ExprSolver.m in Sources */ = {isa = PBXBuildFile; fileRef = E18E59F31A08A3D5005A13E9 /* ExprSolver.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + E134D82F1A07AE0E00E2A7DB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E134D80D1A07AE0E00E2A7DB /* Project object */; + proxyType = 1; + remoteGlobalIDString = E134D8141A07AE0E00E2A7DB; + remoteInfo = SimpleCalculator; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + E134D8151A07AE0E00E2A7DB /* SimpleCalculator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimpleCalculator.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E134D8191A07AE0E00E2A7DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E134D81A1A07AE0E00E2A7DB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + E134D81C1A07AE0E00E2A7DB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + E134D81D1A07AE0E00E2A7DB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + E134D81F1A07AE0E00E2A7DB /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + E134D8201A07AE0E00E2A7DB /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + E134D8231A07AE0E00E2A7DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + E134D8251A07AE0E00E2A7DB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + E134D8281A07AE0E00E2A7DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + E134D82E1A07AE0E00E2A7DB /* SimpleCalculatorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SimpleCalculatorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + E134D8331A07AE0E00E2A7DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E134D8341A07AE0E00E2A7DB /* SimpleCalculatorTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SimpleCalculatorTests.m; sourceTree = ""; }; + E18E59F21A08A3D5005A13E9 /* ExprSolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExprSolver.h; sourceTree = ""; }; + E18E59F31A08A3D5005A13E9 /* ExprSolver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExprSolver.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E134D8121A07AE0E00E2A7DB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E134D82B1A07AE0E00E2A7DB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E134D80C1A07AE0E00E2A7DB = { + isa = PBXGroup; + children = ( + E134D8171A07AE0E00E2A7DB /* SimpleCalculator */, + E134D8311A07AE0E00E2A7DB /* SimpleCalculatorTests */, + E134D8161A07AE0E00E2A7DB /* Products */, + ); + sourceTree = ""; + }; + E134D8161A07AE0E00E2A7DB /* Products */ = { + isa = PBXGroup; + children = ( + E134D8151A07AE0E00E2A7DB /* SimpleCalculator.app */, + E134D82E1A07AE0E00E2A7DB /* SimpleCalculatorTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + E134D8171A07AE0E00E2A7DB /* SimpleCalculator */ = { + isa = PBXGroup; + children = ( + E18E59F21A08A3D5005A13E9 /* ExprSolver.h */, + E18E59F31A08A3D5005A13E9 /* ExprSolver.m */, + E134D81C1A07AE0E00E2A7DB /* AppDelegate.h */, + E134D81D1A07AE0E00E2A7DB /* AppDelegate.m */, + E134D81F1A07AE0E00E2A7DB /* ViewController.h */, + E134D8201A07AE0E00E2A7DB /* ViewController.m */, + E134D8221A07AE0E00E2A7DB /* Main.storyboard */, + E134D8251A07AE0E00E2A7DB /* Images.xcassets */, + E134D8271A07AE0E00E2A7DB /* LaunchScreen.xib */, + E134D8181A07AE0E00E2A7DB /* Supporting Files */, + ); + path = SimpleCalculator; + sourceTree = ""; + }; + E134D8181A07AE0E00E2A7DB /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E134D8191A07AE0E00E2A7DB /* Info.plist */, + E134D81A1A07AE0E00E2A7DB /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + E134D8311A07AE0E00E2A7DB /* SimpleCalculatorTests */ = { + isa = PBXGroup; + children = ( + E134D8341A07AE0E00E2A7DB /* SimpleCalculatorTests.m */, + E134D8321A07AE0E00E2A7DB /* Supporting Files */, + ); + path = SimpleCalculatorTests; + sourceTree = ""; + }; + E134D8321A07AE0E00E2A7DB /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E134D8331A07AE0E00E2A7DB /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E134D8141A07AE0E00E2A7DB /* SimpleCalculator */ = { + isa = PBXNativeTarget; + buildConfigurationList = E134D8381A07AE0E00E2A7DB /* Build configuration list for PBXNativeTarget "SimpleCalculator" */; + buildPhases = ( + E134D8111A07AE0E00E2A7DB /* Sources */, + E134D8121A07AE0E00E2A7DB /* Frameworks */, + E134D8131A07AE0E00E2A7DB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SimpleCalculator; + productName = SimpleCalculator; + productReference = E134D8151A07AE0E00E2A7DB /* SimpleCalculator.app */; + productType = "com.apple.product-type.application"; + }; + E134D82D1A07AE0E00E2A7DB /* SimpleCalculatorTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E134D83B1A07AE0E00E2A7DB /* Build configuration list for PBXNativeTarget "SimpleCalculatorTests" */; + buildPhases = ( + E134D82A1A07AE0E00E2A7DB /* Sources */, + E134D82B1A07AE0E00E2A7DB /* Frameworks */, + E134D82C1A07AE0E00E2A7DB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + E134D8301A07AE0E00E2A7DB /* PBXTargetDependency */, + ); + name = SimpleCalculatorTests; + productName = SimpleCalculatorTests; + productReference = E134D82E1A07AE0E00E2A7DB /* SimpleCalculatorTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E134D80D1A07AE0E00E2A7DB /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0600; + ORGANIZATIONNAME = "Yilin Gui"; + TargetAttributes = { + E134D8141A07AE0E00E2A7DB = { + CreatedOnToolsVersion = 6.0.1; + }; + E134D82D1A07AE0E00E2A7DB = { + CreatedOnToolsVersion = 6.0.1; + TestTargetID = E134D8141A07AE0E00E2A7DB; + }; + }; + }; + buildConfigurationList = E134D8101A07AE0E00E2A7DB /* Build configuration list for PBXProject "SimpleCalculator" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E134D80C1A07AE0E00E2A7DB; + productRefGroup = E134D8161A07AE0E00E2A7DB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E134D8141A07AE0E00E2A7DB /* SimpleCalculator */, + E134D82D1A07AE0E00E2A7DB /* SimpleCalculatorTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E134D8131A07AE0E00E2A7DB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E134D8241A07AE0E00E2A7DB /* Main.storyboard in Resources */, + E134D8291A07AE0E00E2A7DB /* LaunchScreen.xib in Resources */, + E134D8261A07AE0E00E2A7DB /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E134D82C1A07AE0E00E2A7DB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E134D8111A07AE0E00E2A7DB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E134D8211A07AE0E00E2A7DB /* ViewController.m in Sources */, + E18E59F41A08A3D5005A13E9 /* ExprSolver.m in Sources */, + E134D81E1A07AE0E00E2A7DB /* AppDelegate.m in Sources */, + E134D81B1A07AE0E00E2A7DB /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E134D82A1A07AE0E00E2A7DB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E134D8351A07AE0E00E2A7DB /* SimpleCalculatorTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + E134D8301A07AE0E00E2A7DB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = E134D8141A07AE0E00E2A7DB /* SimpleCalculator */; + targetProxy = E134D82F1A07AE0E00E2A7DB /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + E134D8221A07AE0E00E2A7DB /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + E134D8231A07AE0E00E2A7DB /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + E134D8271A07AE0E00E2A7DB /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + E134D8281A07AE0E00E2A7DB /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + E134D8361A07AE0E00E2A7DB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + E134D8371A07AE0E00E2A7DB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E134D8391A07AE0E00E2A7DB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SimpleCalculator/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + E134D83A1A07AE0E00E2A7DB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SimpleCalculator/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + E134D83C1A07AE0E00E2A7DB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = SimpleCalculatorTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleCalculator.app/SimpleCalculator"; + }; + name = Debug; + }; + E134D83D1A07AE0E00E2A7DB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = SimpleCalculatorTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleCalculator.app/SimpleCalculator"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E134D8101A07AE0E00E2A7DB /* Build configuration list for PBXProject "SimpleCalculator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E134D8361A07AE0E00E2A7DB /* Debug */, + E134D8371A07AE0E00E2A7DB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E134D8381A07AE0E00E2A7DB /* Build configuration list for PBXNativeTarget "SimpleCalculator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E134D8391A07AE0E00E2A7DB /* Debug */, + E134D83A1A07AE0E00E2A7DB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E134D83B1A07AE0E00E2A7DB /* Build configuration list for PBXNativeTarget "SimpleCalculatorTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E134D83C1A07AE0E00E2A7DB /* Debug */, + E134D83D1A07AE0E00E2A7DB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E134D80D1A07AE0E00E2A7DB /* Project object */; +} diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata" new file mode 100644 index 00000000..f3d571c8 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/contents.xcworkspacedata" @@ -0,0 +1,7 @@ + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/xcshareddata/SimpleCalculator.xccheckout" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/xcshareddata/SimpleCalculator.xccheckout" new file mode 100644 index 00000000..bf17e6ca --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/xcshareddata/SimpleCalculator.xccheckout" @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 2D9D20E2-1B4D-4E99-AE1F-9C3B383C1126 + IDESourceControlProjectName + SimpleCalculator + IDESourceControlProjectOriginsDictionary + + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + https://github.com/insaneyilin/iPhone2014.git + + IDESourceControlProjectPath + 21451088桂义林/Project2/SimpleCalculator/SimpleCalculator.xcodeproj + IDESourceControlProjectRelativeInstallPathDictionary + + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + ../../../../.. + + IDESourceControlProjectURL + https://github.com/insaneyilin/iPhone2014.git + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + IDESourceControlWCCName + iPhone2014 + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/xcuserdata/yilin.xcuserdatad/UserInterfaceState.xcuserstate" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/xcuserdata/yilin.xcuserdatad/UserInterfaceState.xcuserstate" new file mode 100644 index 00000000..af934998 Binary files /dev/null and "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/project.xcworkspace/xcuserdata/yilin.xcuserdatad/UserInterfaceState.xcuserstate" differ diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist" new file mode 100644 index 00000000..fe2b4541 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist" @@ -0,0 +1,5 @@ + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/SimpleCalculator.xcscheme" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/SimpleCalculator.xcscheme" new file mode 100644 index 00000000..085aba00 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/SimpleCalculator.xcscheme" @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/xcschememanagement.plist" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/xcschememanagement.plist" new file mode 100644 index 00000000..3871974e --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/xcschememanagement.plist" @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + SimpleCalculator.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + E134D8141A07AE0E00E2A7DB + + primary + + + E134D82D1A07AE0E00E2A7DB + + primary + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/AppDelegate.h" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/AppDelegate.h" new file mode 100644 index 00000000..9cc4284c --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/AppDelegate.h" @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// SimpleCalculator +// +// Created by YilinGui on 14-11-3. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/AppDelegate.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/AppDelegate.m" new file mode 100644 index 00000000..d880e93e --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/AppDelegate.m" @@ -0,0 +1,45 @@ +// +// AppDelegate.m +// SimpleCalculator +// +// Created by YilinGui on 14-11-3. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#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 throttle down OpenGL ES frame rates. 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 inactive 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:. +} + +@end diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Base.lproj/LaunchScreen.xib" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Base.lproj/LaunchScreen.xib" new file mode 100644 index 00000000..9c8c6698 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Base.lproj/LaunchScreen.xib" @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Base.lproj/Main.storyboard" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Base.lproj/Main.storyboard" new file mode 100644 index 00000000..2a214eec --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Base.lproj/Main.storyboard" @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ExprSolver.h" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ExprSolver.h" new file mode 100644 index 00000000..93c266f7 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ExprSolver.h" @@ -0,0 +1,16 @@ +// +// ExprSolver.h +// SimpleCalculator +// +// Created by YilinGui on 14-11-4. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import + +@interface ExprSolver : NSObject + +- (double)getValueOfExpr:(NSString *)expr; +- (NSString *)getValueOfExprInStringFormat:(NSString *)expr; + +@end diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ExprSolver.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ExprSolver.m" new file mode 100644 index 00000000..3fdadec3 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ExprSolver.m" @@ -0,0 +1,281 @@ +// +// ExprSolver.m +// SimpleCalculator +// +// Created by YilinGui on 14-11-4. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import "ExprSolver.h" + +@interface ExprSolver() +@property (nonatomic) BOOL isExprValid; +@property (nonatomic) BOOL divideZeroError; +@property (nonatomic) BOOL modNonIntError; +@property (nonatomic, strong) NSMutableArray *operandStack; +@property (nonatomic, strong) NSMutableArray *operationStack; +@end + +@implementation ExprSolver + +@synthesize isExprValid = _isExprValid; +@synthesize divideZeroError = _divideZeroError; +@synthesize modNonIntError = _modNonIntError; +@synthesize operandStack = _operandStack; +@synthesize operationStack = _operationStack; + +// 判断是否为整形: +- (BOOL)isPureInt:(NSString*)string{ + NSScanner* scan = [NSScanner scannerWithString:string]; + int val; + return[scan scanInt:&val] && [scan isAtEnd]; +} + +// 判断是否为浮点形: +- (BOOL)isPureFloat:(NSString*)string{ + NSScanner* scan = [NSScanner scannerWithString:string]; + float val; + return[scan scanFloat:&val] && [scan isAtEnd]; +} + +// 计算两个数的运算 +- (double)calcNum1:(double)num1 Operation:(NSString *)op Num2:(double)num2 { + double result = 0.0; + + if ([op isEqualToString:@"+"]) { + result = num1 + num2; + } else if ([op isEqualToString:@"-"]) { + result = num2 - num1; + } else if ([op isEqualToString:@"x"]) { + result = num1 * num2; + } else if ([op isEqualToString:@"/"]) { + if (num1 == 0.0) self.divideZeroError = YES; + result = num2 / num1; + } else if ([op isEqualToString:@"%"]) { + if (![self isPureInt:[NSString stringWithFormat:@"%g", num1]] || + ![self isPureInt:[NSString stringWithFormat:@"%g", num2]]) { + self.modNonIntError = YES; + } else { + result = (int)num2 % (int)num1; + } + } + + return result; +} + +// 重写getter +- (NSMutableArray *)operandStack { + if (_operandStack == nil) { + _operandStack = [[NSMutableArray alloc] init]; + } + return _operandStack; +} + +// 重写getter +- (NSMutableArray *)operationStack { + if (_operationStack == nil) { + _operationStack = [[NSMutableArray alloc] init]; + } + return _operationStack; +} + +/* 私有方法 */ + +// 操作数入栈 +- (void)pushOperand:(double)operand { + [self.operandStack addObject:[NSNumber numberWithDouble:operand]]; +} + +// 操作数出栈 +- (double)popOperand { + NSNumber *operandObject = [self.operandStack lastObject]; + if (operandObject) [self.operandStack removeLastObject]; + return [operandObject doubleValue]; +} + +// 操作符入栈 +- (void)pushOperation:(NSString *)operation { + [self.operationStack addObject:operation]; +} + +// 操作符出栈 +- (NSString *)popOperation { + NSString *operationObject = [self.operationStack lastObject]; + if (operationObject) [self.operationStack removeLastObject]; + return operationObject; +} + +// 预处理,分离表达式每个token +- (NSMutableArray *)getExprTokenArray:(NSString *)expr { + NSMutableArray *resultArr = [[NSMutableArray alloc] init]; + int i = 0, j = 0; + BOOL negNum = NO; + for (; i < [expr length]; ++i) { + NSString *rangeStr = [NSString stringWithFormat:@"%d 1", i]; + NSString *numRangeStr = [NSString stringWithFormat:@"%d %d", j, i-j]; + if ([[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@"+"] || + [[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@"-"] || + [[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@"x"] || + [[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@"/"] || + [[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@"("] || + [[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@")"] || + [[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@"%"] ) { + + if ([[expr substringWithRange:NSRangeFromString(rangeStr)] isEqualToString:@"-"]) { + if (i == 0 || [[expr substringWithRange:NSRangeFromString([NSString stringWithFormat:@"%d 1", i-1])] isEqual: @"("]) { + negNum = YES; + continue; + } + } + + if ([[expr substringWithRange:NSRangeFromString(numRangeStr)] isEqualToString:@""]) { + [resultArr addObject:[expr substringWithRange:NSRangeFromString(rangeStr)]]; + } else { + if (negNum) { + [resultArr addObject:[@"-" stringByAppendingString:[expr substringWithRange:NSRangeFromString(numRangeStr)]]]; + negNum = NO; + } else { + [resultArr addObject:[expr substringWithRange:NSRangeFromString(numRangeStr)]]; + } + [resultArr addObject:[expr substringWithRange:NSRangeFromString(rangeStr)]]; + } + j = i + 1; + } + } + if (![[resultArr lastObject] isEqualToString:@")"]) { + [resultArr addObject:[expr substringWithRange:NSRangeFromString([NSString stringWithFormat:@"%d %lu", j, [expr length]-j])]]; + } + return resultArr; +} + +// 运算符优先级 +- (int)getPriorityOfOperation:(NSString *)operation { + int priority = 0; + if ([operation isEqualToString:@"%"]) { + priority = 3; + } else if ([operation isEqualToString:@"x"] || + [operation isEqualToString:@"/"]) { + priority = 2; + } else if ([operation isEqualToString:@"+"] || + [operation isEqualToString:@"-"]) { + priority = 1; + } + + return priority; +} + +/* 公有方法 */ + +// 算术表达式求值 +- (double)getValueOfExpr:(NSString *)expr { + double result = 0.0; + NSMutableArray *tokenArr = [self getExprTokenArray:expr]; + //NSLog(@"%@", [tokenArr description]); + for (int i = 0; i < [tokenArr count]; ++i) { + //NSLog(@"%@", [[tokenArr objectAtIndex:i] description]); + // 当前元素是数值 + if ([self isPureFloat:[tokenArr objectAtIndex:i]] || + [self isPureInt:[tokenArr objectAtIndex:i]]) { + //NSLog(@"%@", [[tokenArr objectAtIndex:i] description]); + [self pushOperand:[[tokenArr objectAtIndex:i] doubleValue]]; // 操作数入栈 + } else { // 当前元素为操作符 + if ([self.operationStack count] == 0) { // 操作符栈空,操作符入栈 + [self pushOperation:[tokenArr objectAtIndex:i]]; + } else if ([self getPriorityOfOperation:[tokenArr objectAtIndex:i]] > + [self getPriorityOfOperation:[self.operationStack lastObject]]) { + // 当前操作符优先级大于栈顶操作符优先级,当前操作符入栈 + [self pushOperation:[tokenArr objectAtIndex:i]]; + } else if ([[tokenArr objectAtIndex:i] isEqualToString: @"("]) { + // 左括号直接入栈 + [self pushOperation:[tokenArr objectAtIndex:i]]; + } else if ([[tokenArr objectAtIndex:i] isEqualToString: @")"]) { + // 对右括号特殊判断,操作符出栈计算,直到碰到左括号 + while (1) { + NSString *stackTopOperation = [self popOperation]; // 栈顶操作符出栈 + if ([self.operationStack count] == 0 || + [stackTopOperation isEqualToString:@"("]) { + break; + } + double num1 = [self popOperand]; + double num2 = [self popOperand]; + [self pushOperand:[self calcNum1:num1 Operation:stackTopOperation Num2:num2]]; + } + + } else { + // 栈顶操作符出栈,操作数出栈,计算结果作为新操作数入栈 + // 直至栈顶操作符优先级低于当前操作符优先级或操作符栈空,当前操作符入栈 + while (1) { + NSString *stackTopOperation = [self popOperation]; // 栈顶操作符出栈 + double num1 = [self popOperand]; + double num2 = [self popOperand]; + [self pushOperand:[self calcNum1:num1 Operation:stackTopOperation Num2:num2]]; + // 退出条件 + if ([self.operationStack count] == 0 || + [self getPriorityOfOperation:[tokenArr objectAtIndex:i]] > + [self getPriorityOfOperation:[self.operationStack lastObject]]) { + [self pushOperation:[tokenArr objectAtIndex:i]]; + break; + } + } /* END while */ + } + } + } /* END for */ + + while (1) { + // 退出条件 + if ([self.operationStack count] == 0 || + [self.operandStack count] == 1) { + break; + } + NSString *stackTopOperation = [self popOperation]; // 栈顶操作符出栈 + double num1 = [self popOperand]; + double num2 = [self popOperand]; + [self pushOperand:[self calcNum1:num1 Operation:stackTopOperation Num2:num2]]; + } /* END while */ + + if ([self.operationStack count] == 0 && + [self.operandStack count] == 1) { + self.isExprValid = YES; + result = [[self.operandStack lastObject] doubleValue]; + } else { + self.isExprValid = NO; + } + + [self.operandStack removeAllObjects]; + [self.operationStack removeAllObjects]; + _operandStack = nil; + _operationStack = nil; + + //NSLog(@"%g", result); + return result; +} + +- (NSString *)getValueOfExprInStringFormat:(NSString *)expr { + self.isExprValid = NO; + self.divideZeroError = NO; + self.modNonIntError = NO; + NSString *resultStr = nil; + + // 调用getValueOfExpr,如果表达式合法,在该方法中将isExprValid设为YES + double resultNum = [self getValueOfExpr:expr]; + + if (self.divideZeroError) { + resultStr = @"Cannot divide 0!"; + return resultStr; + } + + if (self.modNonIntError) { + resultStr = @"Only intergers have % operation!"; + return resultStr; + } + + if (self.isExprValid) { + resultStr = [NSString stringWithFormat:@"%g", resultNum]; + } else { + resultStr = @"Invalid Expression!"; + } + + return resultStr; +} + +@end diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Images.xcassets/AppIcon.appiconset/Contents.json" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Images.xcassets/AppIcon.appiconset/Contents.json" new file mode 100644 index 00000000..118c98f7 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Images.xcassets/AppIcon.appiconset/Contents.json" @@ -0,0 +1,38 @@ +{ + "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" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Info.plist" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Info.plist" new file mode 100644 index 00000000..7fcfab71 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/Info.plist" @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.insaneguy.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ViewController.h" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ViewController.h" new file mode 100644 index 00000000..7bb73f2e --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ViewController.h" @@ -0,0 +1,18 @@ +// +// ViewController.h +// SimpleCalculator +// +// Created by YilinGui on 14-11-3. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + +@property (weak, nonatomic) IBOutlet UILabel *display; +@property (weak, nonatomic) IBOutlet UILabel *resultLabel; +@property (weak, nonatomic) IBOutlet UILabel *memoryLabel; + +@end + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ViewController.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ViewController.m" new file mode 100644 index 00000000..6818f983 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/ViewController.m" @@ -0,0 +1,223 @@ +// +// ViewController.m +// SimpleCalculator +// +// Created by YilinGui on 14-11-3. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import "ViewController.h" +#import "ExprSolver.h" + +@interface ViewController () + +@property (nonatomic) BOOL userIsInTheMiddleOfEnteringANumber; +@property (nonatomic) BOOL currentNumIsDecimal; +@property (nonatomic) double memoryValue; +@property (nonatomic) BOOL hasMemorayValue; +@property (nonatomic, strong) ExprSolver *exprSolver; + +@end + +@implementation ViewController + +@synthesize display = _display; +@synthesize resultLabel = _resultLabel; +@synthesize memoryLabel = _memoryLabel; + +@synthesize userIsInTheMiddleOfEnteringANumber = _userIsInTheMiddleOfEnteringANumber; +@synthesize currentNumIsDecimal = _currentNumIsDecimal; +@synthesize memoryValue = _memoryValue; +@synthesize hasMemorayValue = _hasMemorayValue; +@synthesize exprSolver = _exprSolver; + +// 重写getter +- (ExprSolver *)exprSolver { + if (!_exprSolver) _exprSolver = [[ExprSolver alloc] init]; + return _exprSolver; +} + +// 内存操作按钮响应函数 +// MC: 清空内存 +// M+: 将显示值与内存值相加 +// M-: 将内存值减去显示值 +// MR: 重新调用存储再内存中的值 +- (IBAction)memoryOperation:(UIButton *)sender { + NSString *operation = [sender currentTitle]; + if ([operation isEqualToString:@"MC"]) { + self.memoryLabel.text = @""; + self.memoryValue = 0; + self.hasMemorayValue = NO; + + } else if ([operation isEqualToString:@"M+"]) { + self.memoryLabel.text = @"M"; + [self solveExpr]; + double resultVal = [self.resultLabel.text doubleValue]; + self.memoryValue += resultVal; + self.hasMemorayValue = YES; + + } else if ([operation isEqualToString:@"M-"]) { + self.memoryLabel.text = @"M"; + [self solveExpr]; + double resultVal = [self.resultLabel.text doubleValue]; + self.memoryValue -= resultVal; + self.hasMemorayValue = YES; + + } else if ([operation isEqualToString:@"MR"]) { + if (self.hasMemorayValue) { + NSString *memoryValueStr = [NSString stringWithFormat:@"%g", self.memoryValue]; + self.display.text = memoryValueStr; + self.resultLabel.text = memoryValueStr; + self.userIsInTheMiddleOfEnteringANumber = NO; + } + } +} + +// 按下数字键 +- (IBAction)digitPressed:(UIButton *)sender { + NSString *digit = [sender currentTitle]; + if ([self userIsInTheMiddleOfEnteringANumber]) { + self.display.text = [self.display.text stringByAppendingString:digit]; + } else { + self.display.text = digit; + self.userIsInTheMiddleOfEnteringANumber = YES; + } +} + +// 清除按钮 +- (IBAction)cleanPressed { + self.display.text = @"0"; + self.resultLabel.text = @"0"; + self.userIsInTheMiddleOfEnteringANumber = NO; + self.currentNumIsDecimal = NO; +} + +// 运算符按钮 +- (IBAction)operationPressed:(UIButton *)sender { + NSString *operation = [sender currentTitle]; + self.userIsInTheMiddleOfEnteringANumber = YES; + NSString *lastChar = [self.display.text substringFromIndex:[self.display.text length] - 1]; + //NSLog(@"last char is %@", lastChar); + if ([lastChar isEqualToString:@"+"] || + [lastChar isEqualToString:@"-"] || + [lastChar isEqualToString:@"x"] || + [lastChar isEqualToString:@"/"] || + [lastChar isEqualToString:@"("] || + [lastChar isEqualToString:@"%"]) { + return; + } + self.display.text = [self.display.text stringByAppendingString:operation]; + _currentNumIsDecimal = NO; +} + +// 删除表达式最后一个字符 +- (IBAction)deletePressed { + if ([self.display.text length] >= 2) { + self.display.text = [self.display.text substringToIndex:[self.display.text length] - 1]; + } else { + [self cleanPressed]; + } +} + +// 添加小数点 +- (IBAction)decimalPoint { + self.userIsInTheMiddleOfEnteringANumber = YES; + NSString *lastChar = [self.display.text substringFromIndex:[self.display.text length] - 1]; + + if ([lastChar isEqualToString:@"+"] || + [lastChar isEqualToString:@"-"] || + [lastChar isEqualToString:@"x"] || + [lastChar isEqualToString:@"/"] || + [lastChar isEqualToString:@"("] || + [lastChar isEqualToString:@"%"] || + [lastChar isEqualToString:@")"] || + [lastChar isEqualToString:@"."]) { + return; + } + if (!_currentNumIsDecimal) { + self.display.text = [self.display.text stringByAppendingString:@"."]; + _currentNumIsDecimal = YES; + } +} + +// 添加括号 +- (IBAction)addParenthesis:(UIButton *)sender { + NSString *parenthesis = [sender currentTitle]; + NSString *lastChar = [self.display.text substringFromIndex:[self.display.text length] - 1]; + if ([parenthesis isEqualToString:@"("]) { + + if (!self.userIsInTheMiddleOfEnteringANumber) { + self.userIsInTheMiddleOfEnteringANumber = YES; + self.display.text = parenthesis; + return; + } + if ([lastChar isEqualToString:@"+"] || + [lastChar isEqualToString:@"-"] || + [lastChar isEqualToString:@"x"] || + [lastChar isEqualToString:@"("] || + [lastChar isEqualToString:@"/"] || + [lastChar isEqualToString:@"%"]) { + self.display.text = [self.display.text stringByAppendingString:parenthesis]; + } + + } else { + + if (!self.userIsInTheMiddleOfEnteringANumber) { + return; + } + + if ([lastChar isEqualToString:@"+"] || + [lastChar isEqualToString:@"-"] || + [lastChar isEqualToString:@"x"] || + [lastChar isEqualToString:@"/"] || + [lastChar isEqualToString:@"("] || + [lastChar isEqualToString:@"%"] || + [lastChar isEqualToString:@"."]) { + return; + } + + self.display.text = [self.display.text stringByAppendingString:parenthesis]; + } +} + +// 改变符号 +- (IBAction)minusSign { + [self solveExpr]; + if (![self.display.text isEqualToString:@"Invalid Expression!"] && + ![self.display.text isEqualToString:@"Cannot divide 0!"] && + ![self.display.text isEqualToString:@"Only intergers have % operation!"] && + [self.display.text doubleValue] != 0) { + double dval = [self.exprSolver getValueOfExpr:self.resultLabel.text]; + dval = -1 * dval; + self.display.text = [NSString stringWithFormat:@"%g", dval]; + self.resultLabel.text = [NSString stringWithFormat:@"%g", dval]; + self.userIsInTheMiddleOfEnteringANumber = NO; + } +} + +// 表达式求值,结果显示在display标签上 +- (IBAction)solveExpr { + NSString *resultStr = [[self exprSolver] getValueOfExprInStringFormat:self.display.text]; + self.display.text = resultStr; + self.resultLabel.text = resultStr; + self.userIsInTheMiddleOfEnteringANumber = NO; + //[[self exprSolver] getValueOfExpr:self.display.text]; +} + +//---------------------------------------------// + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + _userIsInTheMiddleOfEnteringANumber = NO; + _currentNumIsDecimal = NO; + _memoryValue = 0; + _hasMemorayValue = NO; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/main.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/main.m" new file mode 100644 index 00000000..8caaa453 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculator/main.m" @@ -0,0 +1,16 @@ +// +// main.m +// SimpleCalculator +// +// Created by YilinGui on 14-11-3. +// Copyright (c) 2014年 Yilin Gui. 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/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculatorTests/Info.plist" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculatorTests/Info.plist" new file mode 100644 index 00000000..2dac30ee --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculatorTests/Info.plist" @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.insaneguy.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculatorTests/SimpleCalculatorTests.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculatorTests/SimpleCalculatorTests.m" new file mode 100644 index 00000000..c90423fa --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project2/SimpleCalculator/SimpleCalculatorTests/SimpleCalculatorTests.m" @@ -0,0 +1,40 @@ +// +// SimpleCalculatorTests.m +// SimpleCalculatorTests +// +// Created by YilinGui on 14-11-3. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import +#import + +@interface SimpleCalculatorTests : XCTestCase + +@end + +@implementation SimpleCalculatorTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/README.md" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/README.md" new file mode 100644 index 00000000..3e5d97d3 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/README.md" @@ -0,0 +1,11 @@ +# iPhone开发第三次作业 +====== +- 作业内容:使用TableView实现一个TaskList +- 平台:iOS +- 编程语言:Objective-C +- 测试环境:iOS Simulator - iPhone 6 / iOS 8.0 +- 实现功能说明: + - 增加一个task,在TextField中输入,点击Insert按钮 + - 修改一个task,点击一行,在弹出的Alert对话框中修改内容 + - 删除一个task,向左滑动一行,点击Delete + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.pbxproj" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.pbxproj" new file mode 100644 index 00000000..1052d9fc --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.pbxproj" @@ -0,0 +1,427 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E175E5181A0F542E007ABF04 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E175E5171A0F542E007ABF04 /* main.m */; }; + E175E51B1A0F542E007ABF04 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E175E51A1A0F542E007ABF04 /* AppDelegate.m */; }; + E175E51E1A0F542E007ABF04 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E175E51D1A0F542E007ABF04 /* ViewController.m */; }; + E175E5211A0F542E007ABF04 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E175E51F1A0F542E007ABF04 /* Main.storyboard */; }; + E175E5231A0F542E007ABF04 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E175E5221A0F542E007ABF04 /* Images.xcassets */; }; + E175E5261A0F542E007ABF04 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E175E5241A0F542E007ABF04 /* LaunchScreen.xib */; }; + E175E5321A0F542E007ABF04 /* TaskListDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E175E5311A0F542E007ABF04 /* TaskListDemoTests.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + E175E52C1A0F542E007ABF04 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E175E50A1A0F542E007ABF04 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E175E5111A0F542E007ABF04; + remoteInfo = TaskListDemo; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + E175E5121A0F542E007ABF04 /* TaskListDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TaskListDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E175E5161A0F542E007ABF04 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E175E5171A0F542E007ABF04 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + E175E5191A0F542E007ABF04 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + E175E51A1A0F542E007ABF04 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + E175E51C1A0F542E007ABF04 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + E175E51D1A0F542E007ABF04 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + E175E5201A0F542E007ABF04 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + E175E5221A0F542E007ABF04 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + E175E5251A0F542E007ABF04 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + E175E52B1A0F542E007ABF04 /* TaskListDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TaskListDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + E175E5301A0F542E007ABF04 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + E175E5311A0F542E007ABF04 /* TaskListDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TaskListDemoTests.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E175E50F1A0F542E007ABF04 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E175E5281A0F542E007ABF04 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E175E5091A0F542E007ABF04 = { + isa = PBXGroup; + children = ( + E175E5141A0F542E007ABF04 /* TaskListDemo */, + E175E52E1A0F542E007ABF04 /* TaskListDemoTests */, + E175E5131A0F542E007ABF04 /* Products */, + ); + sourceTree = ""; + }; + E175E5131A0F542E007ABF04 /* Products */ = { + isa = PBXGroup; + children = ( + E175E5121A0F542E007ABF04 /* TaskListDemo.app */, + E175E52B1A0F542E007ABF04 /* TaskListDemoTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + E175E5141A0F542E007ABF04 /* TaskListDemo */ = { + isa = PBXGroup; + children = ( + E175E5191A0F542E007ABF04 /* AppDelegate.h */, + E175E51A1A0F542E007ABF04 /* AppDelegate.m */, + E175E51C1A0F542E007ABF04 /* ViewController.h */, + E175E51D1A0F542E007ABF04 /* ViewController.m */, + E175E51F1A0F542E007ABF04 /* Main.storyboard */, + E175E5221A0F542E007ABF04 /* Images.xcassets */, + E175E5241A0F542E007ABF04 /* LaunchScreen.xib */, + E175E5151A0F542E007ABF04 /* Supporting Files */, + ); + path = TaskListDemo; + sourceTree = ""; + }; + E175E5151A0F542E007ABF04 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E175E5161A0F542E007ABF04 /* Info.plist */, + E175E5171A0F542E007ABF04 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + E175E52E1A0F542E007ABF04 /* TaskListDemoTests */ = { + isa = PBXGroup; + children = ( + E175E5311A0F542E007ABF04 /* TaskListDemoTests.m */, + E175E52F1A0F542E007ABF04 /* Supporting Files */, + ); + path = TaskListDemoTests; + sourceTree = ""; + }; + E175E52F1A0F542E007ABF04 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E175E5301A0F542E007ABF04 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E175E5111A0F542E007ABF04 /* TaskListDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = E175E5351A0F542E007ABF04 /* Build configuration list for PBXNativeTarget "TaskListDemo" */; + buildPhases = ( + E175E50E1A0F542E007ABF04 /* Sources */, + E175E50F1A0F542E007ABF04 /* Frameworks */, + E175E5101A0F542E007ABF04 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TaskListDemo; + productName = TaskListDemo; + productReference = E175E5121A0F542E007ABF04 /* TaskListDemo.app */; + productType = "com.apple.product-type.application"; + }; + E175E52A1A0F542E007ABF04 /* TaskListDemoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E175E5381A0F542E007ABF04 /* Build configuration list for PBXNativeTarget "TaskListDemoTests" */; + buildPhases = ( + E175E5271A0F542E007ABF04 /* Sources */, + E175E5281A0F542E007ABF04 /* Frameworks */, + E175E5291A0F542E007ABF04 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + E175E52D1A0F542E007ABF04 /* PBXTargetDependency */, + ); + name = TaskListDemoTests; + productName = TaskListDemoTests; + productReference = E175E52B1A0F542E007ABF04 /* TaskListDemoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E175E50A1A0F542E007ABF04 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0600; + ORGANIZATIONNAME = "Yilin Gui"; + TargetAttributes = { + E175E5111A0F542E007ABF04 = { + CreatedOnToolsVersion = 6.0.1; + }; + E175E52A1A0F542E007ABF04 = { + CreatedOnToolsVersion = 6.0.1; + TestTargetID = E175E5111A0F542E007ABF04; + }; + }; + }; + buildConfigurationList = E175E50D1A0F542E007ABF04 /* Build configuration list for PBXProject "TaskListDemo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E175E5091A0F542E007ABF04; + productRefGroup = E175E5131A0F542E007ABF04 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E175E5111A0F542E007ABF04 /* TaskListDemo */, + E175E52A1A0F542E007ABF04 /* TaskListDemoTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E175E5101A0F542E007ABF04 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E175E5211A0F542E007ABF04 /* Main.storyboard in Resources */, + E175E5261A0F542E007ABF04 /* LaunchScreen.xib in Resources */, + E175E5231A0F542E007ABF04 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E175E5291A0F542E007ABF04 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E175E50E1A0F542E007ABF04 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E175E51E1A0F542E007ABF04 /* ViewController.m in Sources */, + E175E51B1A0F542E007ABF04 /* AppDelegate.m in Sources */, + E175E5181A0F542E007ABF04 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E175E5271A0F542E007ABF04 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E175E5321A0F542E007ABF04 /* TaskListDemoTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + E175E52D1A0F542E007ABF04 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = E175E5111A0F542E007ABF04 /* TaskListDemo */; + targetProxy = E175E52C1A0F542E007ABF04 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + E175E51F1A0F542E007ABF04 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + E175E5201A0F542E007ABF04 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + E175E5241A0F542E007ABF04 /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + E175E5251A0F542E007ABF04 /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + E175E5331A0F542E007ABF04 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + E175E5341A0F542E007ABF04 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + 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_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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 = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E175E5361A0F542E007ABF04 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = TaskListDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + E175E5371A0F542E007ABF04 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = TaskListDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + E175E5391A0F542E007ABF04 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = TaskListDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TaskListDemo.app/TaskListDemo"; + }; + name = Debug; + }; + E175E53A1A0F542E007ABF04 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = TaskListDemoTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TaskListDemo.app/TaskListDemo"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E175E50D1A0F542E007ABF04 /* Build configuration list for PBXProject "TaskListDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E175E5331A0F542E007ABF04 /* Debug */, + E175E5341A0F542E007ABF04 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E175E5351A0F542E007ABF04 /* Build configuration list for PBXNativeTarget "TaskListDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E175E5361A0F542E007ABF04 /* Debug */, + E175E5371A0F542E007ABF04 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + E175E5381A0F542E007ABF04 /* Build configuration list for PBXNativeTarget "TaskListDemoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E175E5391A0F542E007ABF04 /* Debug */, + E175E53A1A0F542E007ABF04 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = E175E50A1A0F542E007ABF04 /* Project object */; +} diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata" new file mode 100644 index 00000000..eba83c31 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata" @@ -0,0 +1,7 @@ + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/xcshareddata/TaskListDemo.xccheckout" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/xcshareddata/TaskListDemo.xccheckout" new file mode 100644 index 00000000..a5278df4 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/xcshareddata/TaskListDemo.xccheckout" @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + D4EC7A0F-D882-4AE8-B4AB-54D058CBE9F3 + IDESourceControlProjectName + TaskListDemo + IDESourceControlProjectOriginsDictionary + + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + https://github.com/insaneyilin/iPhone2014.git + + IDESourceControlProjectPath + 21451088桂义林/Project3/TaskListDemo/TaskListDemo.xcodeproj + IDESourceControlProjectRelativeInstallPathDictionary + + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + ../../../../.. + + IDESourceControlProjectURL + https://github.com/insaneyilin/iPhone2014.git + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + BC868CD9B2BB897C6B0CBEE8DA7BC2EA2F1CBBF3 + IDESourceControlWCCName + iPhone2014 + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/xcuserdata/yilin.xcuserdatad/UserInterfaceState.xcuserstate" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/xcuserdata/yilin.xcuserdatad/UserInterfaceState.xcuserstate" new file mode 100644 index 00000000..75536c1b Binary files /dev/null and "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/project.xcworkspace/xcuserdata/yilin.xcuserdatad/UserInterfaceState.xcuserstate" differ diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/TaskListDemo.xcscheme" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/TaskListDemo.xcscheme" new file mode 100644 index 00000000..703098ca --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/TaskListDemo.xcscheme" @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/xcschememanagement.plist" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/xcschememanagement.plist" new file mode 100644 index 00000000..2ec25807 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo.xcodeproj/xcuserdata/yilin.xcuserdatad/xcschemes/xcschememanagement.plist" @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + TaskListDemo.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + E175E5111A0F542E007ABF04 + + primary + + + E175E52A1A0F542E007ABF04 + + primary + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/AppDelegate.h" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/AppDelegate.h" new file mode 100644 index 00000000..e5c3e783 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/AppDelegate.h" @@ -0,0 +1,27 @@ +// +// AppDelegate.h +// TaskListDemo +// +// Created by YilinGui on 14-11-9. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import + +NSString *docPath(void); + +@interface AppDelegate : UIResponder +{ + UITableView *taskTable; + UITextField *taskField; + UIButton *insertButton; + NSMutableArray *tasks; +} + +- (void)addTask:(id)sender; + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/AppDelegate.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/AppDelegate.m" new file mode 100644 index 00000000..68d06f73 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/AppDelegate.m" @@ -0,0 +1,153 @@ +// +// AppDelegate.m +// TaskListDemo +// +// Created by YilinGui on 14-11-9. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import "AppDelegate.h" + +NSString *docPath() { + NSArray *pathList = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); + return [[pathList objectAtIndex:0] stringByAppendingPathComponent:@"data.txt"]; +} + +@interface AppDelegate () +{ + NSIndexPath *updateLocation; +} + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + NSArray *plist = [NSArray arrayWithContentsOfFile:docPath()]; + if (plist) { + tasks = [plist mutableCopy]; + } else { + tasks = [[NSMutableArray alloc] init]; + } + + CGRect windowFrame = [[UIScreen mainScreen] bounds]; + UIWindow *theWindow = [[UIWindow alloc] initWithFrame: windowFrame]; + [self setWindow: theWindow]; + + CGRect tableFrame = CGRectMake(0, 80, 320, 380); + CGRect fieldFrame = CGRectMake(20, 40, 200, 31); + CGRect buttonFrame = CGRectMake(228, 40, 72, 31); + + taskTable = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain]; + [taskTable setSeparatorStyle: UITableViewCellSeparatorStyleNone]; + + taskField = [[UITextField alloc] initWithFrame:fieldFrame]; + [taskField setBorderStyle:UITextBorderStyleRoundedRect]; + [taskField setPlaceholder:@"Type a task, tap Insert"]; + + insertButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + [insertButton setFrame:buttonFrame]; + [insertButton setTitle:@"Insert" forState:UIControlStateNormal]; + + [insertButton addTarget:self action:@selector(addTask:) + forControlEvents:UIControlEventTouchUpInside]; + + if ([tasks count] == 0) { + [tasks addObject:@"Walk the dogs"]; + [tasks addObject:@"Feed the hogs"]; + [tasks addObject:@"Chop the logs"]; + } + + [taskTable setDataSource:self]; + [taskTable setDelegate:self]; + + [[self window] addSubview:taskTable]; + [[self window] addSubview:taskField]; + [[self window] addSubview:insertButton]; + + [[self window] setBackgroundColor: [UIColor whiteColor]]; + [[self window] makeKeyAndVisible]; + + 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 throttle down OpenGL ES frame rates. 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. + [tasks writeToFile:docPath() atomically:YES]; +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (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:. +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return [tasks count]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [taskTable dequeueReusableCellWithIdentifier:@"Cell"]; + if (!cell ) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; + } + NSString *item = [tasks objectAtIndex: [indexPath row]]; + [[cell textLabel] setText:item]; + return cell ; +} + +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tasks removeObjectAtIndex:indexPath.row]; + [taskTable reloadData]; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + updateLocation = indexPath; + UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"修改内容" + message:@" " + delegate:self + cancelButtonTitle:@"取消" + otherButtonTitles:@"修改", nil]; + alertView.alertViewStyle = UIAlertViewStylePlainTextInput; + [alertView show]; +} + +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex +{ + if (buttonIndex == 1) { + UITextField * tmpField = [alertView textFieldAtIndex:0]; + tasks[updateLocation.row] = tmpField.text; + [taskTable reloadData]; + } +} + +- (void)addTask:(id)sender { + NSString *text = [taskField text]; //从输入框获取新的任务 + if ([text isEqualToString:@""]) { + return; //如果是空的什么也不做 + } + [tasks addObject: text]; //将新的任务添加到模型 + [taskTable reloadData]; //表格视图重新载入数据 + [taskField setText:@""]; //清空输入框 + [taskField resignFirstResponder]; //关闭软键盘 +} + +@end diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Base.lproj/LaunchScreen.xib" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Base.lproj/LaunchScreen.xib" new file mode 100644 index 00000000..78b72bbe --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Base.lproj/LaunchScreen.xib" @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Base.lproj/Main.storyboard" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Base.lproj/Main.storyboard" new file mode 100644 index 00000000..d912f9d7 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Base.lproj/Main.storyboard" @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Images.xcassets/AppIcon.appiconset/Contents.json" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Images.xcassets/AppIcon.appiconset/Contents.json" new file mode 100644 index 00000000..118c98f7 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Images.xcassets/AppIcon.appiconset/Contents.json" @@ -0,0 +1,38 @@ +{ + "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" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Info.plist" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Info.plist" new file mode 100644 index 00000000..7fcfab71 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/Info.plist" @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.insaneguy.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/ViewController.h" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/ViewController.h" new file mode 100644 index 00000000..9b6dedbb --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/ViewController.h" @@ -0,0 +1,15 @@ +// +// ViewController.h +// TaskListDemo +// +// Created by YilinGui on 14-11-9. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/ViewController.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/ViewController.m" new file mode 100644 index 00000000..19ec7165 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/ViewController.m" @@ -0,0 +1,27 @@ +// +// ViewController.m +// TaskListDemo +// +// Created by YilinGui on 14-11-9. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/main.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/main.m" new file mode 100644 index 00000000..f8f22eff --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemo/main.m" @@ -0,0 +1,16 @@ +// +// main.m +// TaskListDemo +// +// Created by YilinGui on 14-11-9. +// Copyright (c) 2014年 Yilin Gui. 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/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemoTests/Info.plist" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemoTests/Info.plist" new file mode 100644 index 00000000..2dac30ee --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemoTests/Info.plist" @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.insaneguy.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git "a/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemoTests/TaskListDemoTests.m" "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemoTests/TaskListDemoTests.m" new file mode 100644 index 00000000..2c3838c3 --- /dev/null +++ "b/21451088\346\241\202\344\271\211\346\236\227/Project3/TaskListDemo/TaskListDemoTests/TaskListDemoTests.m" @@ -0,0 +1,40 @@ +// +// TaskListDemoTests.m +// TaskListDemoTests +// +// Created by YilinGui on 14-11-9. +// Copyright (c) 2014年 Yilin Gui. All rights reserved. +// + +#import +#import + +@interface TaskListDemoTests : XCTestCase + +@end + +@implementation TaskListDemoTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end