├── README.md ├── ToDo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── ToDo.xccheckout │ └── xcuserdata │ │ └── missummer.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── missummer.xcuserdatad │ └── xcschemes │ ├── ToDo.xcscheme │ └── xcschememanagement.plist ├── ToDo ├── AddViewController.swift ├── AnimateViewController.swift ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CollectionViewController.swift ├── FavouriteViewController.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── hot.imageset │ │ ├── Contents.json │ │ └── hot.png │ ├── hot_press.imageset │ │ ├── Contents.json │ │ └── hot_press.png │ ├── personal.imageset │ │ ├── Contents.json │ │ └── personal.png │ ├── personal_press.imageset │ │ ├── Contents.json │ │ └── personal_press.png │ ├── scenic_spot.imageset │ │ ├── Contents.json │ │ └── scenic_spot.png │ └── scenic_spot_press.imageset │ │ ├── Contents.json │ │ └── scenic_spot_press.png ├── Info.plist ├── MoreViewController.swift ├── ToDoModel.swift └── ViewController.swift └── ToDoTests ├── Info.plist └── ToDoTests.swift /README.md: -------------------------------------------------------------------------------- 1 | # SwiftTableView 2 | swift简单的控件使用,搜索条,tableview等,仅用于学习交流 3 | 添加了各种UI控件的基本使用,欢迎大家使用,交流 4 | -------------------------------------------------------------------------------- /ToDo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 274440AC1B7B159900FC791D /* FavouriteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274440AB1B7B159900FC791D /* FavouriteViewController.swift */; }; 11 | 274440AE1B7B160400FC791D /* MoreViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274440AD1B7B160400FC791D /* MoreViewController.swift */; }; 12 | 274440B01B7B170900FC791D /* CollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274440AF1B7B170900FC791D /* CollectionViewController.swift */; }; 13 | 279859F71B79F3060049F015 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279859F61B79F3060049F015 /* AppDelegate.swift */; }; 14 | 279859F91B79F3060049F015 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279859F81B79F3060049F015 /* ViewController.swift */; }; 15 | 279859FC1B79F3060049F015 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 279859FA1B79F3060049F015 /* Main.storyboard */; }; 16 | 279859FE1B79F3060049F015 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 279859FD1B79F3060049F015 /* Images.xcassets */; }; 17 | 27985A011B79F3060049F015 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 279859FF1B79F3060049F015 /* LaunchScreen.xib */; }; 18 | 27985A0D1B79F3060049F015 /* ToDoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27985A0C1B79F3060049F015 /* ToDoTests.swift */; }; 19 | 27985A171B79F5600049F015 /* ToDoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27985A161B79F5600049F015 /* ToDoModel.swift */; }; 20 | 27985A251B7A195D0049F015 /* AddViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27985A241B7A195D0049F015 /* AddViewController.swift */; }; 21 | 27AA06F71B84699D00B9C0FF /* AnimateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27AA06F61B84699D00B9C0FF /* AnimateViewController.swift */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 27985A071B79F3060049F015 /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 279859E91B79F3060049F015 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 279859F01B79F3060049F015; 30 | remoteInfo = ToDo; 31 | }; 32 | /* End PBXContainerItemProxy section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 274440AB1B7B159900FC791D /* FavouriteViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FavouriteViewController.swift; sourceTree = ""; }; 36 | 274440AD1B7B160400FC791D /* MoreViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoreViewController.swift; sourceTree = ""; }; 37 | 274440AF1B7B170900FC791D /* CollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewController.swift; sourceTree = ""; }; 38 | 279859F11B79F3060049F015 /* ToDo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ToDo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 279859F51B79F3060049F015 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 279859F61B79F3060049F015 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | 279859F81B79F3060049F015 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | 279859FB1B79F3060049F015 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | 279859FD1B79F3060049F015 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 44 | 27985A001B79F3060049F015 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 45 | 27985A061B79F3060049F015 /* ToDoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ToDoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 27985A0B1B79F3060049F015 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | 27985A0C1B79F3060049F015 /* ToDoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToDoTests.swift; sourceTree = ""; }; 48 | 27985A161B79F5600049F015 /* ToDoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToDoModel.swift; sourceTree = ""; }; 49 | 27985A241B7A195D0049F015 /* AddViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddViewController.swift; sourceTree = ""; }; 50 | 27AA06F61B84699D00B9C0FF /* AnimateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimateViewController.swift; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 279859EE1B79F3060049F015 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | 27985A031B79F3060049F015 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 279859E81B79F3060049F015 = { 72 | isa = PBXGroup; 73 | children = ( 74 | 279859F31B79F3060049F015 /* ToDo */, 75 | 27985A091B79F3060049F015 /* ToDoTests */, 76 | 279859F21B79F3060049F015 /* Products */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | 279859F21B79F3060049F015 /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 279859F11B79F3060049F015 /* ToDo.app */, 84 | 27985A061B79F3060049F015 /* ToDoTests.xctest */, 85 | ); 86 | name = Products; 87 | sourceTree = ""; 88 | }; 89 | 279859F31B79F3060049F015 /* ToDo */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 279859F61B79F3060049F015 /* AppDelegate.swift */, 93 | 279859F81B79F3060049F015 /* ViewController.swift */, 94 | 274440AB1B7B159900FC791D /* FavouriteViewController.swift */, 95 | 274440AF1B7B170900FC791D /* CollectionViewController.swift */, 96 | 274440AD1B7B160400FC791D /* MoreViewController.swift */, 97 | 27985A241B7A195D0049F015 /* AddViewController.swift */, 98 | 27AA06F61B84699D00B9C0FF /* AnimateViewController.swift */, 99 | 27985A161B79F5600049F015 /* ToDoModel.swift */, 100 | 279859FA1B79F3060049F015 /* Main.storyboard */, 101 | 279859FD1B79F3060049F015 /* Images.xcassets */, 102 | 279859FF1B79F3060049F015 /* LaunchScreen.xib */, 103 | 279859F41B79F3060049F015 /* Supporting Files */, 104 | ); 105 | path = ToDo; 106 | sourceTree = ""; 107 | }; 108 | 279859F41B79F3060049F015 /* Supporting Files */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 279859F51B79F3060049F015 /* Info.plist */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | 27985A091B79F3060049F015 /* ToDoTests */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 27985A0C1B79F3060049F015 /* ToDoTests.swift */, 120 | 27985A0A1B79F3060049F015 /* Supporting Files */, 121 | ); 122 | path = ToDoTests; 123 | sourceTree = ""; 124 | }; 125 | 27985A0A1B79F3060049F015 /* Supporting Files */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 27985A0B1B79F3060049F015 /* Info.plist */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | /* End PBXGroup section */ 134 | 135 | /* Begin PBXNativeTarget section */ 136 | 279859F01B79F3060049F015 /* ToDo */ = { 137 | isa = PBXNativeTarget; 138 | buildConfigurationList = 27985A101B79F3060049F015 /* Build configuration list for PBXNativeTarget "ToDo" */; 139 | buildPhases = ( 140 | 279859ED1B79F3060049F015 /* Sources */, 141 | 279859EE1B79F3060049F015 /* Frameworks */, 142 | 279859EF1B79F3060049F015 /* Resources */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = ToDo; 149 | productName = ToDo; 150 | productReference = 279859F11B79F3060049F015 /* ToDo.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | 27985A051B79F3060049F015 /* ToDoTests */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = 27985A131B79F3060049F015 /* Build configuration list for PBXNativeTarget "ToDoTests" */; 156 | buildPhases = ( 157 | 27985A021B79F3060049F015 /* Sources */, 158 | 27985A031B79F3060049F015 /* Frameworks */, 159 | 27985A041B79F3060049F015 /* Resources */, 160 | ); 161 | buildRules = ( 162 | ); 163 | dependencies = ( 164 | 27985A081B79F3060049F015 /* PBXTargetDependency */, 165 | ); 166 | name = ToDoTests; 167 | productName = ToDoTests; 168 | productReference = 27985A061B79F3060049F015 /* ToDoTests.xctest */; 169 | productType = "com.apple.product-type.bundle.unit-test"; 170 | }; 171 | /* End PBXNativeTarget section */ 172 | 173 | /* Begin PBXProject section */ 174 | 279859E91B79F3060049F015 /* Project object */ = { 175 | isa = PBXProject; 176 | attributes = { 177 | LastUpgradeCheck = 0630; 178 | ORGANIZATIONNAME = ldf; 179 | TargetAttributes = { 180 | 279859F01B79F3060049F015 = { 181 | CreatedOnToolsVersion = 6.3.1; 182 | }; 183 | 27985A051B79F3060049F015 = { 184 | CreatedOnToolsVersion = 6.3.1; 185 | TestTargetID = 279859F01B79F3060049F015; 186 | }; 187 | }; 188 | }; 189 | buildConfigurationList = 279859EC1B79F3060049F015 /* Build configuration list for PBXProject "ToDo" */; 190 | compatibilityVersion = "Xcode 3.2"; 191 | developmentRegion = English; 192 | hasScannedForEncodings = 0; 193 | knownRegions = ( 194 | en, 195 | Base, 196 | ); 197 | mainGroup = 279859E81B79F3060049F015; 198 | productRefGroup = 279859F21B79F3060049F015 /* Products */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | 279859F01B79F3060049F015 /* ToDo */, 203 | 27985A051B79F3060049F015 /* ToDoTests */, 204 | ); 205 | }; 206 | /* End PBXProject section */ 207 | 208 | /* Begin PBXResourcesBuildPhase section */ 209 | 279859EF1B79F3060049F015 /* Resources */ = { 210 | isa = PBXResourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | 279859FC1B79F3060049F015 /* Main.storyboard in Resources */, 214 | 27985A011B79F3060049F015 /* LaunchScreen.xib in Resources */, 215 | 279859FE1B79F3060049F015 /* Images.xcassets in Resources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | 27985A041B79F3060049F015 /* Resources */ = { 220 | isa = PBXResourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXResourcesBuildPhase section */ 227 | 228 | /* Begin PBXSourcesBuildPhase section */ 229 | 279859ED1B79F3060049F015 /* Sources */ = { 230 | isa = PBXSourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | 279859F91B79F3060049F015 /* ViewController.swift in Sources */, 234 | 279859F71B79F3060049F015 /* AppDelegate.swift in Sources */, 235 | 27985A251B7A195D0049F015 /* AddViewController.swift in Sources */, 236 | 274440AE1B7B160400FC791D /* MoreViewController.swift in Sources */, 237 | 27AA06F71B84699D00B9C0FF /* AnimateViewController.swift in Sources */, 238 | 274440B01B7B170900FC791D /* CollectionViewController.swift in Sources */, 239 | 274440AC1B7B159900FC791D /* FavouriteViewController.swift in Sources */, 240 | 27985A171B79F5600049F015 /* ToDoModel.swift in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | 27985A021B79F3060049F015 /* Sources */ = { 245 | isa = PBXSourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 27985A0D1B79F3060049F015 /* ToDoTests.swift in Sources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | /* End PBXSourcesBuildPhase section */ 253 | 254 | /* Begin PBXTargetDependency section */ 255 | 27985A081B79F3060049F015 /* PBXTargetDependency */ = { 256 | isa = PBXTargetDependency; 257 | target = 279859F01B79F3060049F015 /* ToDo */; 258 | targetProxy = 27985A071B79F3060049F015 /* PBXContainerItemProxy */; 259 | }; 260 | /* End PBXTargetDependency section */ 261 | 262 | /* Begin PBXVariantGroup section */ 263 | 279859FA1B79F3060049F015 /* Main.storyboard */ = { 264 | isa = PBXVariantGroup; 265 | children = ( 266 | 279859FB1B79F3060049F015 /* Base */, 267 | ); 268 | name = Main.storyboard; 269 | sourceTree = ""; 270 | }; 271 | 279859FF1B79F3060049F015 /* LaunchScreen.xib */ = { 272 | isa = PBXVariantGroup; 273 | children = ( 274 | 27985A001B79F3060049F015 /* Base */, 275 | ); 276 | name = LaunchScreen.xib; 277 | sourceTree = ""; 278 | }; 279 | /* End PBXVariantGroup section */ 280 | 281 | /* Begin XCBuildConfiguration section */ 282 | 27985A0E1B79F3060049F015 /* Debug */ = { 283 | isa = XCBuildConfiguration; 284 | buildSettings = { 285 | ALWAYS_SEARCH_USER_PATHS = NO; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BOOL_CONVERSION = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_EMPTY_BODY = YES; 294 | CLANG_WARN_ENUM_CONVERSION = YES; 295 | CLANG_WARN_INT_CONVERSION = YES; 296 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 297 | CLANG_WARN_UNREACHABLE_CODE = YES; 298 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 299 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 300 | COPY_PHASE_STRIP = NO; 301 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 302 | ENABLE_STRICT_OBJC_MSGSEND = YES; 303 | GCC_C_LANGUAGE_STANDARD = gnu99; 304 | GCC_DYNAMIC_NO_PIC = NO; 305 | GCC_NO_COMMON_BLOCKS = YES; 306 | GCC_OPTIMIZATION_LEVEL = 0; 307 | GCC_PREPROCESSOR_DEFINITIONS = ( 308 | "DEBUG=1", 309 | "$(inherited)", 310 | ); 311 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 312 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 313 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 314 | GCC_WARN_UNDECLARED_SELECTOR = YES; 315 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 316 | GCC_WARN_UNUSED_FUNCTION = YES; 317 | GCC_WARN_UNUSED_VARIABLE = YES; 318 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 319 | MTL_ENABLE_DEBUG_INFO = YES; 320 | ONLY_ACTIVE_ARCH = YES; 321 | SDKROOT = iphoneos; 322 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 323 | }; 324 | name = Debug; 325 | }; 326 | 27985A0F1B79F3060049F015 /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_CONSTANT_CONVERSION = YES; 336 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 337 | CLANG_WARN_EMPTY_BODY = YES; 338 | CLANG_WARN_ENUM_CONVERSION = YES; 339 | CLANG_WARN_INT_CONVERSION = YES; 340 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 341 | CLANG_WARN_UNREACHABLE_CODE = YES; 342 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 343 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 344 | COPY_PHASE_STRIP = NO; 345 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 346 | ENABLE_NS_ASSERTIONS = NO; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | GCC_C_LANGUAGE_STANDARD = gnu99; 349 | GCC_NO_COMMON_BLOCKS = YES; 350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 352 | GCC_WARN_UNDECLARED_SELECTOR = YES; 353 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 354 | GCC_WARN_UNUSED_FUNCTION = YES; 355 | GCC_WARN_UNUSED_VARIABLE = YES; 356 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 357 | MTL_ENABLE_DEBUG_INFO = NO; 358 | SDKROOT = iphoneos; 359 | VALIDATE_PRODUCT = YES; 360 | }; 361 | name = Release; 362 | }; 363 | 27985A111B79F3060049F015 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | INFOPLIST_FILE = ToDo/Info.plist; 368 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | }; 372 | name = Debug; 373 | }; 374 | 27985A121B79F3060049F015 /* Release */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | INFOPLIST_FILE = ToDo/Info.plist; 379 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | PRODUCT_NAME = "$(TARGET_NAME)"; 382 | }; 383 | name = Release; 384 | }; 385 | 27985A141B79F3060049F015 /* Debug */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | BUNDLE_LOADER = "$(TEST_HOST)"; 389 | FRAMEWORK_SEARCH_PATHS = ( 390 | "$(SDKROOT)/Developer/Library/Frameworks", 391 | "$(inherited)", 392 | ); 393 | GCC_PREPROCESSOR_DEFINITIONS = ( 394 | "DEBUG=1", 395 | "$(inherited)", 396 | ); 397 | INFOPLIST_FILE = ToDoTests/Info.plist; 398 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 399 | PRODUCT_NAME = "$(TARGET_NAME)"; 400 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ToDo.app/ToDo"; 401 | }; 402 | name = Debug; 403 | }; 404 | 27985A151B79F3060049F015 /* Release */ = { 405 | isa = XCBuildConfiguration; 406 | buildSettings = { 407 | BUNDLE_LOADER = "$(TEST_HOST)"; 408 | FRAMEWORK_SEARCH_PATHS = ( 409 | "$(SDKROOT)/Developer/Library/Frameworks", 410 | "$(inherited)", 411 | ); 412 | INFOPLIST_FILE = ToDoTests/Info.plist; 413 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 414 | PRODUCT_NAME = "$(TARGET_NAME)"; 415 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ToDo.app/ToDo"; 416 | }; 417 | name = Release; 418 | }; 419 | /* End XCBuildConfiguration section */ 420 | 421 | /* Begin XCConfigurationList section */ 422 | 279859EC1B79F3060049F015 /* Build configuration list for PBXProject "ToDo" */ = { 423 | isa = XCConfigurationList; 424 | buildConfigurations = ( 425 | 27985A0E1B79F3060049F015 /* Debug */, 426 | 27985A0F1B79F3060049F015 /* Release */, 427 | ); 428 | defaultConfigurationIsVisible = 0; 429 | defaultConfigurationName = Release; 430 | }; 431 | 27985A101B79F3060049F015 /* Build configuration list for PBXNativeTarget "ToDo" */ = { 432 | isa = XCConfigurationList; 433 | buildConfigurations = ( 434 | 27985A111B79F3060049F015 /* Debug */, 435 | 27985A121B79F3060049F015 /* Release */, 436 | ); 437 | defaultConfigurationIsVisible = 0; 438 | defaultConfigurationName = Release; 439 | }; 440 | 27985A131B79F3060049F015 /* Build configuration list for PBXNativeTarget "ToDoTests" */ = { 441 | isa = XCConfigurationList; 442 | buildConfigurations = ( 443 | 27985A141B79F3060049F015 /* Debug */, 444 | 27985A151B79F3060049F015 /* Release */, 445 | ); 446 | defaultConfigurationIsVisible = 0; 447 | defaultConfigurationName = Release; 448 | }; 449 | /* End XCConfigurationList section */ 450 | }; 451 | rootObject = 279859E91B79F3060049F015 /* Project object */; 452 | } 453 | -------------------------------------------------------------------------------- /ToDo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ToDo.xcodeproj/project.xcworkspace/xcshareddata/ToDo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 88E59141-46BA-49BF-9EB8-F22049762A93 9 | IDESourceControlProjectName 10 | ToDo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 8BFF8A2B71E9CB982779F00CF6A2C4BF538C3CAB 14 | https://github.com/ldf0269/SwiftTableView.git 15 | 16 | IDESourceControlProjectPath 17 | ToDo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 8BFF8A2B71E9CB982779F00CF6A2C4BF538C3CAB 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/ldf0269/SwiftTableView.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 8BFF8A2B71E9CB982779F00CF6A2C4BF538C3CAB 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 8BFF8A2B71E9CB982779F00CF6A2C4BF538C3CAB 36 | IDESourceControlWCCName 37 | SwiftTableView 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ToDo.xcodeproj/project.xcworkspace/xcuserdata/missummer.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldf0269/SwiftTableView/1750c24f061c7f278a4755715ce23c26eff40bf1/ToDo.xcodeproj/project.xcworkspace/xcuserdata/missummer.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ToDo.xcodeproj/xcuserdata/missummer.xcuserdatad/xcschemes/ToDo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ToDo.xcodeproj/xcuserdata/missummer.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ToDo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 279859F01B79F3060049F015 16 | 17 | primary 18 | 19 | 20 | 27985A051B79F3060049F015 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ToDo/AddViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AddViewController.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/11. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AddViewController: UIViewController,UITextFieldDelegate { 12 | 13 | @IBOutlet weak var findHouseBtn: UIButton! 14 | @IBOutlet weak var findSceneryBtn: UIButton! 15 | @IBOutlet weak var findPeopleBtn: UIButton! 16 | @IBOutlet weak var inputTextFeild: UITextField! 17 | @IBOutlet weak var choseDateView: UIDatePicker! 18 | 19 | var todo:ToDoModel? 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | inputTextFeild.delegate = self 24 | if todo == nil{ 25 | findHouseBtn.selected = true 26 | self.title = "新增事件" 27 | 28 | }else{ 29 | self.title = "修改事件" 30 | 31 | if todo?.image == "hot_press"{ 32 | findHouseBtn.selected = true 33 | 34 | 35 | }else if todo?.image == "scenic_spot_press"{ 36 | findSceneryBtn.selected = true 37 | 38 | }else{ 39 | 40 | findPeopleBtn.selected = true 41 | } 42 | inputTextFeild.text = todo?.title 43 | choseDateView.setDate(todo!.date, animated: false) 44 | } 45 | // Do any additional setup after loading the view. 46 | } 47 | 48 | override func didReceiveMemoryWarning() { 49 | super.didReceiveMemoryWarning() 50 | // Dispose of any resources that can be recreated. 51 | } 52 | @IBAction func findHouseBtnClick(sender: AnyObject) { 53 | findPeopleBtn.selected = false 54 | findSceneryBtn.selected = false 55 | findHouseBtn.selected = true 56 | } 57 | 58 | @IBAction func findSceneryBtnClick(sender: AnyObject) { 59 | 60 | findPeopleBtn.selected = false 61 | findSceneryBtn.selected = true 62 | findHouseBtn.selected = false 63 | } 64 | @IBAction func findPeopleBtnClick(sender: AnyObject) { 65 | 66 | findPeopleBtn.selected = true 67 | findSceneryBtn.selected = false 68 | findHouseBtn.selected = false 69 | } 70 | 71 | @IBAction func sureButtonClick(sender: AnyObject) { 72 | 73 | var image = "" 74 | if findHouseBtn.selected == true{ 75 | image = "hot_press" 76 | }else if findSceneryBtn.selected == true{ 77 | image = "scenic_spot_press" 78 | }else if findPeopleBtn.selected == true{ 79 | image = "personal_press" 80 | } 81 | if todo == nil{ 82 | let uuid = NSUUID().UUIDString 83 | var todo = ToDoModel(id: uuid, image: image, title: inputTextFeild.text, date: choseDateView.date) 84 | todos.append(todo) 85 | }else{ 86 | todo?.image = image 87 | todo?.title = inputTextFeild.text 88 | todo?.date = choseDateView.date 89 | 90 | 91 | } 92 | 93 | 94 | 95 | } 96 | func textFieldShouldReturn(textField: UITextField) -> Bool { 97 | 98 | inputTextFeild.resignFirstResponder() 99 | return true 100 | } 101 | override func touchesEnded(touches: Set, withEvent event: UIEvent) { 102 | 103 | super.touchesEnded(touches, withEvent: event) 104 | inputTextFeild.resignFirstResponder() 105 | } 106 | 107 | 108 | } 109 | -------------------------------------------------------------------------------- /ToDo/AnimateViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimateViewController.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/19. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AnimateViewController: UIViewController { 12 | var fromVc:String? 13 | var view1:UIView? 14 | var view2:UIView? 15 | var view3:UIView? 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | if fromVc != nil{ 19 | self.title = fromVc; 20 | } 21 | self.view.backgroundColor = UIColor.whiteColor() 22 | view1 = UIView() 23 | view1?.backgroundColor = UIColor.redColor() 24 | view1?.frame = CGRectMake(10, 74, 80, 80) 25 | self.view.addSubview(view1!) 26 | 27 | view2 = UIView() 28 | view2?.backgroundColor = UIColor.blueColor() 29 | view2?.frame = CGRectMake(10, 74 + 90, 80, 80) 30 | self.view.addSubview(view2!) 31 | 32 | view3 = UIView() 33 | view3?.backgroundColor = UIColor.greenColor() 34 | view3?.frame = CGRectMake((self.view.bounds.width - 80)*0.5, 100 + 2*90, 80, 80) 35 | self.view.addSubview(view3!) 36 | } 37 | override func viewDidAppear(animated: Bool) { 38 | super.viewDidAppear(animated) 39 | 40 | 41 | UIView.animateWithDuration(1, animations: { () -> Void in 42 | self.view1!.center.x = self.view.bounds.width - self.view1!.center.x 43 | self.view2?.alpha = 0 44 | self.view3?.transform = CGAffineTransformMakeScale(1.5, 1.5) 45 | self.view3?.backgroundColor = UIColor.redColor() 46 | 47 | }) 48 | 49 | self.spin() 50 | 51 | 52 | } 53 | func spin(){ 54 | UIView.animateWithDuration(1, delay: 0, options: .CurveLinear, animations: { () -> Void in 55 | self.view3?.transform = CGAffineTransformRotate(self.view3!.transform, CGFloat(M_1_PI)) 56 | }) { (finished) -> Void in 57 | self.spin() 58 | } 59 | 60 | } 61 | override func didReceiveMemoryWarning() { 62 | super.didReceiveMemoryWarning() 63 | // Dispose of any resources that can be recreated. 64 | } 65 | 66 | 67 | /* 68 | // MARK: - Navigation 69 | 70 | // In a storyboard-based application, you will often want to do a little preparation before navigation 71 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 72 | // Get the new view controller using segue.destinationViewController. 73 | // Pass the selected object to the new view controller. 74 | } 75 | */ 76 | 77 | } 78 | -------------------------------------------------------------------------------- /ToDo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/11. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /ToDo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ToDo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 49 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 119 | 129 | 139 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 362 | 368 | 374 | 380 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | -------------------------------------------------------------------------------- /ToDo/CollectionViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewController.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/12. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let reuseIdentifier = "Cell" 12 | 13 | class CollectionViewController: UICollectionViewController { 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | // Uncomment the following line to preserve selection between presentations 19 | // self.clearsSelectionOnViewWillAppear = false 20 | 21 | // Register cell classes 22 | self.collectionView?.backgroundColor = UIColor.whiteColor() 23 | self.collectionView!.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "nineCollectionItem") 24 | 25 | // Do any additional setup after loading the view. 26 | } 27 | 28 | override func didReceiveMemoryWarning() { 29 | super.didReceiveMemoryWarning() 30 | // Dispose of any resources that can be recreated. 31 | } 32 | 33 | 34 | // MARK: UICollectionViewDataSource 35 | 36 | override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { 37 | //#warning Incomplete method implementation -- Return the number of sections 38 | return 1 39 | } 40 | 41 | 42 | override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 43 | //#warning Incomplete method implementation -- Return the number of items in the section 44 | return 10 45 | } 46 | 47 | override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 48 | let cell = collectionView.dequeueReusableCellWithReuseIdentifier("nineCollectionItem", forIndexPath: indexPath) as! UICollectionViewCell 49 | 50 | // Configure the cell 51 | cell.backgroundColor = UIColor.redColor() 52 | 53 | return cell 54 | } 55 | override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { 56 | println("---点了第\(indexPath.row)个红方块---") 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /ToDo/FavouriteViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FavouriteViewController.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/12. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FavouriteViewController: UIViewController { 12 | 13 | 14 | @IBOutlet weak var heightLabel: UILabel! 15 | @IBOutlet weak var nameTextField: UITextField! 16 | @IBOutlet weak var sexView: UISegmentedControl! 17 | @IBOutlet weak var birthDay: UIDatePicker! 18 | @IBOutlet weak var heightView: UISlider! 19 | @IBOutlet weak var haveHouse: UISwitch! 20 | var alertView:UIAlertView? 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | heightView.value = 170.0 24 | // Do any additional setup after loading the view. 25 | 26 | } 27 | @IBAction func heightChange(sender: AnyObject) { 28 | var slide = sender as! UISlider 29 | var i = Int(slide.value) 30 | heightLabel.text = "\(i)CM" 31 | } 32 | @IBAction func rightBarButtonClick(sender: AnyObject) { 33 | let sexText = sexView.selectedSegmentIndex == 0 ? "高富帅":"白富美" 34 | let gre = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian) 35 | let now = NSDate() 36 | let gnnn = gre?.components(NSCalendarUnit.YearCalendarUnit, fromDate: birthDay.date, toDate: now, options: NSCalendarOptions(0)) 37 | let age = gnnn?.year 38 | let have = haveHouse.on ? "有房" : "没房" 39 | let heightStr = heightLabel.text! 40 | alertView = UIAlertView() 41 | alertView!.title = "我要脱单" 42 | alertView!.message = "我叫\(nameTextField.text),今年\(age!)岁,标准\(sexText),身高\(heightStr),\(have),求交往!!!" 43 | alertView!.addButtonWithTitle("确定") 44 | NSTimer.scheduledTimerWithTimeInterval(10, target:self, selector:"dismiss:", userInfo:alertView, repeats:false) 45 | alertView!.show() 46 | 47 | 48 | } 49 | func dismiss(timer:NSTimer){ 50 | alertView!.dismissWithClickedButtonIndex(0, animated:true) 51 | println("正在匹配.......") 52 | } 53 | override func didReceiveMemoryWarning() { 54 | super.didReceiveMemoryWarning() 55 | // Dispose of any resources that can be recreated. 56 | } 57 | 58 | override func touchesEnded(touches: Set, withEvent event: UIEvent) { 59 | super.touchesEnded(touches, withEvent: event) 60 | nameTextField.resignFirstResponder() 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /ToDo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ToDo/Images.xcassets/hot.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "hot.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ToDo/Images.xcassets/hot.imageset/hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldf0269/SwiftTableView/1750c24f061c7f278a4755715ce23c26eff40bf1/ToDo/Images.xcassets/hot.imageset/hot.png -------------------------------------------------------------------------------- /ToDo/Images.xcassets/hot_press.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "hot_press.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ToDo/Images.xcassets/hot_press.imageset/hot_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldf0269/SwiftTableView/1750c24f061c7f278a4755715ce23c26eff40bf1/ToDo/Images.xcassets/hot_press.imageset/hot_press.png -------------------------------------------------------------------------------- /ToDo/Images.xcassets/personal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "personal.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ToDo/Images.xcassets/personal.imageset/personal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldf0269/SwiftTableView/1750c24f061c7f278a4755715ce23c26eff40bf1/ToDo/Images.xcassets/personal.imageset/personal.png -------------------------------------------------------------------------------- /ToDo/Images.xcassets/personal_press.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "personal_press.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ToDo/Images.xcassets/personal_press.imageset/personal_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldf0269/SwiftTableView/1750c24f061c7f278a4755715ce23c26eff40bf1/ToDo/Images.xcassets/personal_press.imageset/personal_press.png -------------------------------------------------------------------------------- /ToDo/Images.xcassets/scenic_spot.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "scenic_spot.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ToDo/Images.xcassets/scenic_spot.imageset/scenic_spot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldf0269/SwiftTableView/1750c24f061c7f278a4755715ce23c26eff40bf1/ToDo/Images.xcassets/scenic_spot.imageset/scenic_spot.png -------------------------------------------------------------------------------- /ToDo/Images.xcassets/scenic_spot_press.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "scenic_spot_press.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ToDo/Images.xcassets/scenic_spot_press.imageset/scenic_spot_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldf0269/SwiftTableView/1750c24f061c7f278a4755715ce23c26eff40bf1/ToDo/Images.xcassets/scenic_spot_press.imageset/scenic_spot_press.png -------------------------------------------------------------------------------- /ToDo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | lou.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /ToDo/MoreViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MoreViewController.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/12. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MoreViewController: UITableViewController { 12 | 13 | var showArray = [] 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | self.title = "更多" 18 | showArray = ["动画","修改密码","二维码名片","版本信息","意见反馈"] 19 | 20 | } 21 | 22 | override func didReceiveMemoryWarning() { 23 | super.didReceiveMemoryWarning() 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | // MARK: - Table view data source 28 | 29 | 30 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 31 | // #warning Incomplete method implementation. 32 | // Return the number of rows in the section. 33 | return showArray.count 34 | } 35 | 36 | 37 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 38 | let cell = tableView.dequeueReusableCellWithIdentifier("moreCell", forIndexPath: indexPath) as! UITableViewCell 39 | 40 | 41 | cell.textLabel?.text = showArray[indexPath.row] as? String 42 | 43 | return cell 44 | } 45 | override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 46 | println("-----点击了第\(indexPath.row)行-------") 47 | var toVc = AnimateViewController() 48 | toVc.fromVc = showArray[indexPath.row] as? String 49 | self.navigationController?.pushViewController(toVc, animated: true) 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /ToDo/ToDoModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToDoModel.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/11. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ToDoModel: NSObject { 12 | var id:String 13 | var image:String 14 | var title:String 15 | var date:NSDate 16 | init(id:String,image:String,title:String,date:NSDate) { 17 | self.id = id 18 | self.image = image 19 | self.title = title 20 | self.date = date 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ToDo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // ToDo 4 | // 5 | // Created by missummer on 15/8/11. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | var todos:[ToDoModel] = [] 12 | var resultTodos:[ToDoModel] = [] 13 | func dateFromString(dateStr:String)->NSDate?{ 14 | 15 | let dateFormatter = NSDateFormatter() 16 | dateFormatter.dateFormat = "yyyy-MM-dd" 17 | let date = dateFormatter.dateFromString(dateStr) 18 | return date 19 | 20 | } 21 | class ViewController: UIViewController,UITableViewDataSource,UITableViewDelegate ,UISearchDisplayDelegate{ 22 | @IBOutlet weak var tableView: UITableView! 23 | override func viewWillAppear(animated: Bool) { 24 | super.viewWillAppear(animated) 25 | tableView.reloadData() 26 | } 27 | override func viewDidLoad() { 28 | super.viewDidLoad() 29 | // Do any additional setup after loading the view, typically from a nib. 30 | todos = [ToDoModel(id: "1", image: "hot_press", title: "1.去找房子", date:dateFromString("2012-11-11")!),ToDoModel(id: "2", image: "scenic_spot_press", title: "2.去找景点", date:dateFromString("2013-11-11")!),ToDoModel(id: "3", image: "personal_press", title: "3.去找面包人", date:dateFromString("2014-11-11")!)] 31 | 32 | tableView.dataSource = self 33 | tableView.delegate = self 34 | 35 | navigationItem.leftBarButtonItem = editButtonItem() 36 | tableView.frame = CGRectMake(0, -searchDisplayController!.searchBar.frame.size.height, self.view.frame.size.width, self.view.frame.size.height) 37 | var contentOffSet = tableView.contentOffset 38 | contentOffSet.y += searchDisplayController!.searchBar.frame.size.height 39 | tableView.contentOffset = contentOffSet 40 | } 41 | func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat{ 42 | 43 | return 70 44 | 45 | } 46 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{ 47 | if tableView == searchDisplayController?.searchResultsTableView{ 48 | return resultTodos.count 49 | }else{ 50 | return todos.count 51 | } 52 | } 53 | 54 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ 55 | 56 | let cell = self.tableView.dequeueReusableCellWithIdentifier("todocell")as! UITableViewCell 57 | 58 | var todo = todos[indexPath.row]as ToDoModel 59 | 60 | if tableView == searchDisplayController?.searchResultsTableView{ 61 | var todo = resultTodos[indexPath.row]as ToDoModel 62 | }else{ 63 | var todo = todos[indexPath.row]as ToDoModel 64 | } 65 | var imageView = cell.viewWithTag(101)as! UIImageView 66 | 67 | var title = cell.viewWithTag(102)as! UILabel 68 | 69 | var date = cell.viewWithTag(103) as! UILabel 70 | 71 | imageView.image = UIImage(named: todo.image) 72 | 73 | title.text = todo.title 74 | 75 | let location = NSLocale.currentLocale() 76 | 77 | let fomatter = NSDateFormatter.dateFormatFromTemplate("yyyy-MM-dd", options: 0, locale: location) 78 | 79 | let dateFormatter = NSDateFormatter() 80 | 81 | dateFormatter.dateFormat = fomatter 82 | 83 | date.text = dateFormatter.stringFromDate(todo.date) 84 | 85 | return cell 86 | 87 | } 88 | func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 89 | if editingStyle == UITableViewCellEditingStyle.Delete{ 90 | 91 | todos.removeAtIndex(indexPath.row) 92 | 93 | self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic) 94 | 95 | 96 | } 97 | } 98 | func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool { 99 | return editing 100 | } 101 | func tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath) { 102 | let todo = todos.removeAtIndex(sourceIndexPath.row) 103 | todos.insert(todo, atIndex: destinationIndexPath.row) 104 | } 105 | override func setEditing(editing: Bool, animated: Bool) { 106 | super.setEditing(editing, animated: animated) 107 | 108 | self.tableView.setEditing(editing, animated: animated) 109 | 110 | } 111 | //search 112 | func searchDisplayController(controller: UISearchDisplayController, shouldReloadTableForSearchString searchString: String!) -> Bool{ 113 | 114 | self.filterContentForSearchText(searchString) 115 | 116 | return true 117 | } 118 | func filterContentForSearchText(searchText: String) { 119 | 120 | // 使用过滤方法过滤数组 121 | 122 | resultTodos = todos.filter({(todo: ToDoModel) -> Bool in 123 | 124 | let stringMatch = todo.title.rangeOfString(searchText) 125 | 126 | return stringMatch != nil 127 | 128 | }) 129 | 130 | } 131 | @IBAction func close(segue:UIStoryboardSegue){ 132 | println("closed") 133 | tableView.reloadData() 134 | } 135 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 136 | if segue.identifier == "edittodo"{ 137 | var vc = segue.destinationViewController as! AddViewController 138 | var indexPath = tableView.indexPathForSelectedRow() 139 | if let index = indexPath{ 140 | vc.todo = todos[index.row] 141 | 142 | } 143 | 144 | } 145 | } 146 | override func didReceiveMemoryWarning() { 147 | super.didReceiveMemoryWarning() 148 | // Dispose of any resources that can be recreated. 149 | } 150 | 151 | 152 | } 153 | 154 | -------------------------------------------------------------------------------- /ToDoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | lou.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ToDoTests/ToDoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToDoTests.swift 3 | // ToDoTests 4 | // 5 | // Created by missummer on 15/8/11. 6 | // Copyright (c) 2015年 ldf. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class ToDoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------