├── NewsDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── NewsDemo.xccheckout │ └── xcuserdata │ │ ├── apple.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── yiying.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── apple.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── NewsDemo.xcscheme │ │ └── xcschememanagement.plist │ └── yiying.xcuserdatad │ └── xcschemes │ ├── NewsDemo.xcscheme │ └── xcschememanagement.plist ├── NewsDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Header.h ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── NewsDemo.xcdatamodeld │ ├── .xccurrentversion │ └── NewsDemo.xcdatamodel │ │ └── contents ├── NewsTableViewCell.h ├── NewsTableViewCell.m ├── SwitchView.h ├── SwitchView.m ├── ViewController.h ├── ViewController.m ├── image │ ├── l1.png │ ├── l2.png │ ├── l3.png │ ├── t1.png │ ├── t2.png │ └── t3.png └── main.m ├── NewsDemoTests ├── Info.plist └── NewsDemoTests.m └── README.md /NewsDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1879D5091A88B747006AD683 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1879D5081A88B747006AD683 /* main.m */; }; 11 | 1879D50C1A88B747006AD683 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1879D50B1A88B747006AD683 /* AppDelegate.m */; }; 12 | 1879D50F1A88B747006AD683 /* NewsDemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1879D50D1A88B747006AD683 /* NewsDemo.xcdatamodeld */; }; 13 | 1879D5121A88B747006AD683 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1879D5111A88B747006AD683 /* ViewController.m */; }; 14 | 1879D5151A88B747006AD683 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1879D5131A88B747006AD683 /* Main.storyboard */; }; 15 | 1879D5171A88B747006AD683 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1879D5161A88B747006AD683 /* Images.xcassets */; }; 16 | 1879D51A1A88B747006AD683 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1879D5181A88B747006AD683 /* LaunchScreen.xib */; }; 17 | 1879D5261A88B748006AD683 /* NewsDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1879D5251A88B748006AD683 /* NewsDemoTests.m */; }; 18 | 18D30CB01A89FEEE00C0052D /* SwitchView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D30CAF1A89FEEE00C0052D /* SwitchView.m */; }; 19 | A1BABDA71A8A50BA0020F4C5 /* NewsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A1BABDA61A8A50BA0020F4C5 /* NewsTableViewCell.m */; }; 20 | A1BABDBF1A8A5CA20020F4C5 /* l1.png in Resources */ = {isa = PBXBuildFile; fileRef = A1BABDB91A8A5CA20020F4C5 /* l1.png */; }; 21 | A1BABDC01A8A5CA20020F4C5 /* l2.png in Resources */ = {isa = PBXBuildFile; fileRef = A1BABDBA1A8A5CA20020F4C5 /* l2.png */; }; 22 | A1BABDC11A8A5CA20020F4C5 /* l3.png in Resources */ = {isa = PBXBuildFile; fileRef = A1BABDBB1A8A5CA20020F4C5 /* l3.png */; }; 23 | A1BABDC21A8A5CA20020F4C5 /* t1.png in Resources */ = {isa = PBXBuildFile; fileRef = A1BABDBC1A8A5CA20020F4C5 /* t1.png */; }; 24 | A1BABDC31A8A5CA20020F4C5 /* t2.png in Resources */ = {isa = PBXBuildFile; fileRef = A1BABDBD1A8A5CA20020F4C5 /* t2.png */; }; 25 | A1BABDC41A8A5CA20020F4C5 /* t3.png in Resources */ = {isa = PBXBuildFile; fileRef = A1BABDBE1A8A5CA20020F4C5 /* t3.png */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 1879D5201A88B747006AD683 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 1879D4FB1A88B747006AD683 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 1879D5021A88B747006AD683; 34 | remoteInfo = NewsDemo; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1879D5031A88B747006AD683 /* NewsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NewsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 1879D5071A88B747006AD683 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 1879D5081A88B747006AD683 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | 1879D50A1A88B747006AD683 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | 1879D50B1A88B747006AD683 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | 1879D50E1A88B747006AD683 /* NewsDemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = NewsDemo.xcdatamodel; sourceTree = ""; }; 45 | 1879D5101A88B747006AD683 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 46 | 1879D5111A88B747006AD683 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 47 | 1879D5141A88B747006AD683 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 1879D5161A88B747006AD683 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 49 | 1879D5191A88B747006AD683 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 50 | 1879D51F1A88B747006AD683 /* NewsDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NewsDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 1879D5241A88B748006AD683 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | 1879D5251A88B748006AD683 /* NewsDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NewsDemoTests.m; sourceTree = ""; }; 53 | 1879D5321A88BB74006AD683 /* Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Header.h; sourceTree = ""; }; 54 | 18D30CAE1A89FEEE00C0052D /* SwitchView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwitchView.h; sourceTree = ""; }; 55 | 18D30CAF1A89FEEE00C0052D /* SwitchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SwitchView.m; sourceTree = ""; }; 56 | A1BABDA51A8A50BA0020F4C5 /* NewsTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewsTableViewCell.h; sourceTree = ""; }; 57 | A1BABDA61A8A50BA0020F4C5 /* NewsTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewsTableViewCell.m; sourceTree = ""; }; 58 | A1BABDB91A8A5CA20020F4C5 /* l1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = l1.png; sourceTree = ""; }; 59 | A1BABDBA1A8A5CA20020F4C5 /* l2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = l2.png; sourceTree = ""; }; 60 | A1BABDBB1A8A5CA20020F4C5 /* l3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = l3.png; sourceTree = ""; }; 61 | A1BABDBC1A8A5CA20020F4C5 /* t1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = t1.png; sourceTree = ""; }; 62 | A1BABDBD1A8A5CA20020F4C5 /* t2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = t2.png; sourceTree = ""; }; 63 | A1BABDBE1A8A5CA20020F4C5 /* t3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = t3.png; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 1879D5001A88B747006AD683 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | 1879D51C1A88B747006AD683 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 1879D4FA1A88B747006AD683 = { 85 | isa = PBXGroup; 86 | children = ( 87 | 1879D5051A88B747006AD683 /* NewsDemo */, 88 | 1879D5221A88B748006AD683 /* NewsDemoTests */, 89 | 1879D5041A88B747006AD683 /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 1879D5041A88B747006AD683 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 1879D5031A88B747006AD683 /* NewsDemo.app */, 97 | 1879D51F1A88B747006AD683 /* NewsDemoTests.xctest */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 1879D5051A88B747006AD683 /* NewsDemo */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | A1BABDB81A8A5CA20020F4C5 /* image */, 106 | 1879D50A1A88B747006AD683 /* AppDelegate.h */, 107 | 1879D50B1A88B747006AD683 /* AppDelegate.m */, 108 | 1879D5101A88B747006AD683 /* ViewController.h */, 109 | 1879D5111A88B747006AD683 /* ViewController.m */, 110 | 18D30CAE1A89FEEE00C0052D /* SwitchView.h */, 111 | 18D30CAF1A89FEEE00C0052D /* SwitchView.m */, 112 | A1BABDA51A8A50BA0020F4C5 /* NewsTableViewCell.h */, 113 | A1BABDA61A8A50BA0020F4C5 /* NewsTableViewCell.m */, 114 | 1879D5131A88B747006AD683 /* Main.storyboard */, 115 | 1879D5161A88B747006AD683 /* Images.xcassets */, 116 | 1879D5181A88B747006AD683 /* LaunchScreen.xib */, 117 | 1879D50D1A88B747006AD683 /* NewsDemo.xcdatamodeld */, 118 | 1879D5061A88B747006AD683 /* Supporting Files */, 119 | 1879D5321A88BB74006AD683 /* Header.h */, 120 | ); 121 | path = NewsDemo; 122 | sourceTree = ""; 123 | }; 124 | 1879D5061A88B747006AD683 /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 1879D5071A88B747006AD683 /* Info.plist */, 128 | 1879D5081A88B747006AD683 /* main.m */, 129 | ); 130 | name = "Supporting Files"; 131 | sourceTree = ""; 132 | }; 133 | 1879D5221A88B748006AD683 /* NewsDemoTests */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 1879D5251A88B748006AD683 /* NewsDemoTests.m */, 137 | 1879D5231A88B748006AD683 /* Supporting Files */, 138 | ); 139 | path = NewsDemoTests; 140 | sourceTree = ""; 141 | }; 142 | 1879D5231A88B748006AD683 /* Supporting Files */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 1879D5241A88B748006AD683 /* Info.plist */, 146 | ); 147 | name = "Supporting Files"; 148 | sourceTree = ""; 149 | }; 150 | A1BABDB81A8A5CA20020F4C5 /* image */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | A1BABDB91A8A5CA20020F4C5 /* l1.png */, 154 | A1BABDBA1A8A5CA20020F4C5 /* l2.png */, 155 | A1BABDBB1A8A5CA20020F4C5 /* l3.png */, 156 | A1BABDBC1A8A5CA20020F4C5 /* t1.png */, 157 | A1BABDBD1A8A5CA20020F4C5 /* t2.png */, 158 | A1BABDBE1A8A5CA20020F4C5 /* t3.png */, 159 | ); 160 | path = image; 161 | sourceTree = ""; 162 | }; 163 | /* End PBXGroup section */ 164 | 165 | /* Begin PBXNativeTarget section */ 166 | 1879D5021A88B747006AD683 /* NewsDemo */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = 1879D5291A88B748006AD683 /* Build configuration list for PBXNativeTarget "NewsDemo" */; 169 | buildPhases = ( 170 | 1879D4FF1A88B747006AD683 /* Sources */, 171 | 1879D5001A88B747006AD683 /* Frameworks */, 172 | 1879D5011A88B747006AD683 /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | ); 178 | name = NewsDemo; 179 | productName = NewsDemo; 180 | productReference = 1879D5031A88B747006AD683 /* NewsDemo.app */; 181 | productType = "com.apple.product-type.application"; 182 | }; 183 | 1879D51E1A88B747006AD683 /* NewsDemoTests */ = { 184 | isa = PBXNativeTarget; 185 | buildConfigurationList = 1879D52C1A88B748006AD683 /* Build configuration list for PBXNativeTarget "NewsDemoTests" */; 186 | buildPhases = ( 187 | 1879D51B1A88B747006AD683 /* Sources */, 188 | 1879D51C1A88B747006AD683 /* Frameworks */, 189 | 1879D51D1A88B747006AD683 /* Resources */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | 1879D5211A88B747006AD683 /* PBXTargetDependency */, 195 | ); 196 | name = NewsDemoTests; 197 | productName = NewsDemoTests; 198 | productReference = 1879D51F1A88B747006AD683 /* NewsDemoTests.xctest */; 199 | productType = "com.apple.product-type.bundle.unit-test"; 200 | }; 201 | /* End PBXNativeTarget section */ 202 | 203 | /* Begin PBXProject section */ 204 | 1879D4FB1A88B747006AD683 /* Project object */ = { 205 | isa = PBXProject; 206 | attributes = { 207 | LastUpgradeCheck = 0610; 208 | ORGANIZATIONNAME = coderyi; 209 | TargetAttributes = { 210 | 1879D5021A88B747006AD683 = { 211 | CreatedOnToolsVersion = 6.1.1; 212 | }; 213 | 1879D51E1A88B747006AD683 = { 214 | CreatedOnToolsVersion = 6.1.1; 215 | TestTargetID = 1879D5021A88B747006AD683; 216 | }; 217 | }; 218 | }; 219 | buildConfigurationList = 1879D4FE1A88B747006AD683 /* Build configuration list for PBXProject "NewsDemo" */; 220 | compatibilityVersion = "Xcode 3.2"; 221 | developmentRegion = English; 222 | hasScannedForEncodings = 0; 223 | knownRegions = ( 224 | en, 225 | Base, 226 | ); 227 | mainGroup = 1879D4FA1A88B747006AD683; 228 | productRefGroup = 1879D5041A88B747006AD683 /* Products */; 229 | projectDirPath = ""; 230 | projectRoot = ""; 231 | targets = ( 232 | 1879D5021A88B747006AD683 /* NewsDemo */, 233 | 1879D51E1A88B747006AD683 /* NewsDemoTests */, 234 | ); 235 | }; 236 | /* End PBXProject section */ 237 | 238 | /* Begin PBXResourcesBuildPhase section */ 239 | 1879D5011A88B747006AD683 /* Resources */ = { 240 | isa = PBXResourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | A1BABDC41A8A5CA20020F4C5 /* t3.png in Resources */, 244 | A1BABDC01A8A5CA20020F4C5 /* l2.png in Resources */, 245 | A1BABDC21A8A5CA20020F4C5 /* t1.png in Resources */, 246 | 1879D5151A88B747006AD683 /* Main.storyboard in Resources */, 247 | 1879D51A1A88B747006AD683 /* LaunchScreen.xib in Resources */, 248 | A1BABDBF1A8A5CA20020F4C5 /* l1.png in Resources */, 249 | A1BABDC11A8A5CA20020F4C5 /* l3.png in Resources */, 250 | 1879D5171A88B747006AD683 /* Images.xcassets in Resources */, 251 | A1BABDC31A8A5CA20020F4C5 /* t2.png in Resources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | 1879D51D1A88B747006AD683 /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXResourcesBuildPhase section */ 263 | 264 | /* Begin PBXSourcesBuildPhase section */ 265 | 1879D4FF1A88B747006AD683 /* Sources */ = { 266 | isa = PBXSourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | 18D30CB01A89FEEE00C0052D /* SwitchView.m in Sources */, 270 | 1879D50C1A88B747006AD683 /* AppDelegate.m in Sources */, 271 | A1BABDA71A8A50BA0020F4C5 /* NewsTableViewCell.m in Sources */, 272 | 1879D50F1A88B747006AD683 /* NewsDemo.xcdatamodeld in Sources */, 273 | 1879D5121A88B747006AD683 /* ViewController.m in Sources */, 274 | 1879D5091A88B747006AD683 /* main.m in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 1879D51B1A88B747006AD683 /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 1879D5261A88B748006AD683 /* NewsDemoTests.m in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | /* End PBXSourcesBuildPhase section */ 287 | 288 | /* Begin PBXTargetDependency section */ 289 | 1879D5211A88B747006AD683 /* PBXTargetDependency */ = { 290 | isa = PBXTargetDependency; 291 | target = 1879D5021A88B747006AD683 /* NewsDemo */; 292 | targetProxy = 1879D5201A88B747006AD683 /* PBXContainerItemProxy */; 293 | }; 294 | /* End PBXTargetDependency section */ 295 | 296 | /* Begin PBXVariantGroup section */ 297 | 1879D5131A88B747006AD683 /* Main.storyboard */ = { 298 | isa = PBXVariantGroup; 299 | children = ( 300 | 1879D5141A88B747006AD683 /* Base */, 301 | ); 302 | name = Main.storyboard; 303 | sourceTree = ""; 304 | }; 305 | 1879D5181A88B747006AD683 /* LaunchScreen.xib */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 1879D5191A88B747006AD683 /* Base */, 309 | ); 310 | name = LaunchScreen.xib; 311 | sourceTree = ""; 312 | }; 313 | /* End PBXVariantGroup section */ 314 | 315 | /* Begin XCBuildConfiguration section */ 316 | 1879D5271A88B748006AD683 /* Debug */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | ALWAYS_SEARCH_USER_PATHS = NO; 320 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 321 | CLANG_CXX_LIBRARY = "libc++"; 322 | CLANG_ENABLE_MODULES = YES; 323 | CLANG_ENABLE_OBJC_ARC = YES; 324 | CLANG_WARN_BOOL_CONVERSION = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_EMPTY_BODY = YES; 328 | CLANG_WARN_ENUM_CONVERSION = YES; 329 | CLANG_WARN_INT_CONVERSION = YES; 330 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | GCC_C_LANGUAGE_STANDARD = gnu99; 337 | GCC_DYNAMIC_NO_PIC = NO; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 344 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 345 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 346 | GCC_WARN_UNDECLARED_SELECTOR = YES; 347 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 348 | GCC_WARN_UNUSED_FUNCTION = YES; 349 | GCC_WARN_UNUSED_VARIABLE = YES; 350 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 351 | MTL_ENABLE_DEBUG_INFO = YES; 352 | ONLY_ACTIVE_ARCH = YES; 353 | SDKROOT = iphoneos; 354 | }; 355 | name = Debug; 356 | }; 357 | 1879D5281A88B748006AD683 /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 362 | CLANG_CXX_LIBRARY = "libc++"; 363 | CLANG_ENABLE_MODULES = YES; 364 | CLANG_ENABLE_OBJC_ARC = YES; 365 | CLANG_WARN_BOOL_CONVERSION = YES; 366 | CLANG_WARN_CONSTANT_CONVERSION = YES; 367 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 368 | CLANG_WARN_EMPTY_BODY = YES; 369 | CLANG_WARN_ENUM_CONVERSION = YES; 370 | CLANG_WARN_INT_CONVERSION = YES; 371 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 372 | CLANG_WARN_UNREACHABLE_CODE = YES; 373 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 374 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 375 | COPY_PHASE_STRIP = YES; 376 | ENABLE_NS_ASSERTIONS = NO; 377 | ENABLE_STRICT_OBJC_MSGSEND = YES; 378 | GCC_C_LANGUAGE_STANDARD = gnu99; 379 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 380 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 381 | GCC_WARN_UNDECLARED_SELECTOR = YES; 382 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 383 | GCC_WARN_UNUSED_FUNCTION = YES; 384 | GCC_WARN_UNUSED_VARIABLE = YES; 385 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 386 | MTL_ENABLE_DEBUG_INFO = NO; 387 | SDKROOT = iphoneos; 388 | VALIDATE_PRODUCT = YES; 389 | }; 390 | name = Release; 391 | }; 392 | 1879D52A1A88B748006AD683 /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 396 | GCC_PREFIX_HEADER = NewsDemo/Header.h; 397 | INFOPLIST_FILE = NewsDemo/Info.plist; 398 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 399 | PRODUCT_NAME = "$(TARGET_NAME)"; 400 | }; 401 | name = Debug; 402 | }; 403 | 1879D52B1A88B748006AD683 /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 407 | GCC_PREFIX_HEADER = NewsDemo/Header.h; 408 | INFOPLIST_FILE = NewsDemo/Info.plist; 409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 410 | PRODUCT_NAME = "$(TARGET_NAME)"; 411 | }; 412 | name = Release; 413 | }; 414 | 1879D52D1A88B748006AD683 /* Debug */ = { 415 | isa = XCBuildConfiguration; 416 | buildSettings = { 417 | BUNDLE_LOADER = "$(TEST_HOST)"; 418 | FRAMEWORK_SEARCH_PATHS = ( 419 | "$(SDKROOT)/Developer/Library/Frameworks", 420 | "$(inherited)", 421 | ); 422 | GCC_PREPROCESSOR_DEFINITIONS = ( 423 | "DEBUG=1", 424 | "$(inherited)", 425 | ); 426 | INFOPLIST_FILE = NewsDemoTests/Info.plist; 427 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NewsDemo.app/NewsDemo"; 430 | }; 431 | name = Debug; 432 | }; 433 | 1879D52E1A88B748006AD683 /* Release */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | BUNDLE_LOADER = "$(TEST_HOST)"; 437 | FRAMEWORK_SEARCH_PATHS = ( 438 | "$(SDKROOT)/Developer/Library/Frameworks", 439 | "$(inherited)", 440 | ); 441 | INFOPLIST_FILE = NewsDemoTests/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NewsDemo.app/NewsDemo"; 445 | }; 446 | name = Release; 447 | }; 448 | /* End XCBuildConfiguration section */ 449 | 450 | /* Begin XCConfigurationList section */ 451 | 1879D4FE1A88B747006AD683 /* Build configuration list for PBXProject "NewsDemo" */ = { 452 | isa = XCConfigurationList; 453 | buildConfigurations = ( 454 | 1879D5271A88B748006AD683 /* Debug */, 455 | 1879D5281A88B748006AD683 /* Release */, 456 | ); 457 | defaultConfigurationIsVisible = 0; 458 | defaultConfigurationName = Release; 459 | }; 460 | 1879D5291A88B748006AD683 /* Build configuration list for PBXNativeTarget "NewsDemo" */ = { 461 | isa = XCConfigurationList; 462 | buildConfigurations = ( 463 | 1879D52A1A88B748006AD683 /* Debug */, 464 | 1879D52B1A88B748006AD683 /* Release */, 465 | ); 466 | defaultConfigurationIsVisible = 0; 467 | defaultConfigurationName = Release; 468 | }; 469 | 1879D52C1A88B748006AD683 /* Build configuration list for PBXNativeTarget "NewsDemoTests" */ = { 470 | isa = XCConfigurationList; 471 | buildConfigurations = ( 472 | 1879D52D1A88B748006AD683 /* Debug */, 473 | 1879D52E1A88B748006AD683 /* Release */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | /* End XCConfigurationList section */ 479 | 480 | /* Begin XCVersionGroup section */ 481 | 1879D50D1A88B747006AD683 /* NewsDemo.xcdatamodeld */ = { 482 | isa = XCVersionGroup; 483 | children = ( 484 | 1879D50E1A88B747006AD683 /* NewsDemo.xcdatamodel */, 485 | ); 486 | currentVersion = 1879D50E1A88B747006AD683 /* NewsDemo.xcdatamodel */; 487 | path = NewsDemo.xcdatamodeld; 488 | sourceTree = ""; 489 | versionGroupType = wrapper.xcdatamodel; 490 | }; 491 | /* End XCVersionGroup section */ 492 | }; 493 | rootObject = 1879D4FB1A88B747006AD683 /* Project object */; 494 | } 495 | -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/project.xcworkspace/xcshareddata/NewsDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | EDF967EF-7B8C-43C5-B0F9-7E1D667DE8CA 9 | IDESourceControlProjectName 10 | NewsDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 7630BACE68E0A9D1D8EB5261DA288547E0C13870 14 | https://github.com/coderyi/NewsDemo.git 15 | 16 | IDESourceControlProjectPath 17 | NewsDemo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 7630BACE68E0A9D1D8EB5261DA288547E0C13870 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/coderyi/NewsDemo.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 7630BACE68E0A9D1D8EB5261DA288547E0C13870 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 7630BACE68E0A9D1D8EB5261DA288547E0C13870 36 | IDESourceControlWCCName 37 | NewsDemo 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/project.xcworkspace/xcuserdata/yiying.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo.xcodeproj/project.xcworkspace/xcuserdata/yiying.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/NewsDemo.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 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NewsDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1879D5021A88B747006AD683 16 | 17 | primary 18 | 19 | 20 | 1879D51E1A88B747006AD683 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/xcuserdata/yiying.xcuserdatad/xcschemes/NewsDemo.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 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /NewsDemo.xcodeproj/xcuserdata/yiying.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NewsDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 1879D5021A88B747006AD683 16 | 17 | primary 18 | 19 | 20 | 1879D51E1A88B747006AD683 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /NewsDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/9. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; 17 | @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; 18 | @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; 19 | 20 | - (void)saveContext; 21 | - (NSURL *)applicationDocumentsDirectory; 22 | 23 | 24 | @end 25 | 26 | -------------------------------------------------------------------------------- /NewsDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/9. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | ViewController *VC=[[ViewController alloc] init]; 21 | UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:VC]; 22 | self.window.rootViewController=nav; 23 | [nav.navigationBar setBarTintColor:[UIColor colorWithRed:0.86 green:0.2 blue:0.22 alpha:1]]; 24 | 25 | return YES; 26 | } 27 | 28 | - (void)applicationWillResignActive:(UIApplication *)application { 29 | // 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. 30 | // 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. 31 | } 32 | 33 | - (void)applicationDidEnterBackground:(UIApplication *)application { 34 | // 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. 35 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 36 | } 37 | 38 | - (void)applicationWillEnterForeground:(UIApplication *)application { 39 | // 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. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application { 43 | // 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. 44 | } 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | // Saves changes in the application's managed object context before the application terminates. 49 | [self saveContext]; 50 | } 51 | 52 | #pragma mark - Core Data stack 53 | 54 | @synthesize managedObjectContext = _managedObjectContext; 55 | @synthesize managedObjectModel = _managedObjectModel; 56 | @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; 57 | 58 | - (NSURL *)applicationDocumentsDirectory { 59 | // The directory the application uses to store the Core Data store file. This code uses a directory named "coderyi.NewsDemo" in the application's documents directory. 60 | return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; 61 | } 62 | 63 | - (NSManagedObjectModel *)managedObjectModel { 64 | // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. 65 | if (_managedObjectModel != nil) { 66 | return _managedObjectModel; 67 | } 68 | NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"NewsDemo" withExtension:@"momd"]; 69 | _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; 70 | return _managedObjectModel; 71 | } 72 | 73 | - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { 74 | // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. 75 | if (_persistentStoreCoordinator != nil) { 76 | return _persistentStoreCoordinator; 77 | } 78 | 79 | // Create the coordinator and store 80 | 81 | _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; 82 | NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"NewsDemo.sqlite"]; 83 | NSError *error = nil; 84 | NSString *failureReason = @"There was an error creating or loading the application's saved data."; 85 | if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) { 86 | // Report any error we got. 87 | NSMutableDictionary *dict = [NSMutableDictionary dictionary]; 88 | dict[NSLocalizedDescriptionKey] = @"Failed to initialize the application's saved data"; 89 | dict[NSLocalizedFailureReasonErrorKey] = failureReason; 90 | dict[NSUnderlyingErrorKey] = error; 91 | error = [NSError errorWithDomain:@"YOUR_ERROR_DOMAIN" code:9999 userInfo:dict]; 92 | // Replace this with code to handle the error appropriately. 93 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 94 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 95 | abort(); 96 | } 97 | 98 | return _persistentStoreCoordinator; 99 | } 100 | 101 | 102 | - (NSManagedObjectContext *)managedObjectContext { 103 | // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) 104 | if (_managedObjectContext != nil) { 105 | return _managedObjectContext; 106 | } 107 | 108 | NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; 109 | if (!coordinator) { 110 | return nil; 111 | } 112 | _managedObjectContext = [[NSManagedObjectContext alloc] init]; 113 | [_managedObjectContext setPersistentStoreCoordinator:coordinator]; 114 | return _managedObjectContext; 115 | } 116 | 117 | #pragma mark - Core Data Saving support 118 | 119 | - (void)saveContext { 120 | NSManagedObjectContext *managedObjectContext = self.managedObjectContext; 121 | if (managedObjectContext != nil) { 122 | NSError *error = nil; 123 | if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) { 124 | // Replace this implementation with code to handle the error appropriately. 125 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 126 | NSLog(@"Unresolved error %@, %@", error, [error userInfo]); 127 | abort(); 128 | } 129 | } 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /NewsDemo/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 | -------------------------------------------------------------------------------- /NewsDemo/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 | -------------------------------------------------------------------------------- /NewsDemo/Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Header.h 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/9. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #ifndef NewsDemo_Header_h 10 | #define NewsDemo_Header_h 11 | 12 | 13 | #endif 14 | 15 | #define HScreen [[UIScreen mainScreen] bounds].size.height 16 | #define WScreen [[UIScreen mainScreen] bounds].size.width 17 | #define iOS7 [[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0 -------------------------------------------------------------------------------- /NewsDemo/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 | } -------------------------------------------------------------------------------- /NewsDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | coderyi.$(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 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /NewsDemo/NewsDemo.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | NewsDemo.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /NewsDemo/NewsDemo.xcdatamodeld/NewsDemo.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NewsDemo/NewsTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // NewsTableViewCell.h 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/10. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NewsTableViewCell : UITableViewCell 12 | @property UIImageView *mainIV; 13 | @property UILabel *mainLabel; 14 | @property UILabel *detailLabel; 15 | @end 16 | -------------------------------------------------------------------------------- /NewsDemo/NewsTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // NewsTableViewCell.m 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/10. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "NewsTableViewCell.h" 10 | 11 | @implementation NewsTableViewCell 12 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 13 | { 14 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 15 | if (self) { 16 | 17 | float CellHeight=100-1; 18 | float orginY=10; 19 | float orginX=10; 20 | float spaceImageAndTitle=10; 21 | 22 | float imageWidth=100; 23 | float imageHeight=CellHeight-orginY*2; 24 | float mainHeight=imageHeight/3; 25 | float detailHeight=mainHeight*2; 26 | float labelWidth=WScreen-imageWidth-2*orginX-spaceImageAndTitle; 27 | self.contentView.backgroundColor=[UIColor colorWithRed:0.91f green:0.91f blue:0.91f alpha:1.00f]; 28 | // self.contentView.backgroundColor=[UIColor redColor]; 29 | UIView *bgView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, WScreen, CellHeight)]; 30 | 31 | [self.contentView addSubview:bgView]; 32 | 33 | bgView.backgroundColor=[UIColor colorWithRed:0.96f green:0.96f blue:0.96f alpha:1.00f]; 34 | 35 | _mainIV=[[UIImageView alloc] initWithFrame:CGRectMake(orginX, orginY+4, imageWidth,imageHeight-8 )]; 36 | [bgView addSubview:_mainIV]; 37 | 38 | 39 | _mainLabel=[[UILabel alloc] initWithFrame:CGRectMake(orginX+imageWidth+spaceImageAndTitle, orginY, labelWidth, mainHeight)]; 40 | [bgView addSubview:_mainLabel]; 41 | 42 | 43 | _detailLabel=[[UILabel alloc] initWithFrame:CGRectMake(orginX+imageWidth+spaceImageAndTitle, orginY+mainHeight, labelWidth, detailHeight)]; 44 | [bgView addSubview:_detailLabel]; 45 | 46 | _mainLabel.font=[UIFont systemFontOfSize:18]; 47 | 48 | _mainLabel.backgroundColor=[UIColor colorWithRed:0.96f green:0.96f blue:0.96f alpha:1.00f]; 49 | _detailLabel.backgroundColor=[UIColor colorWithRed:0.96f green:0.96f blue:0.96f alpha:1.00f]; 50 | _detailLabel.font=[UIFont systemFontOfSize:14]; 51 | _detailLabel.numberOfLines=0; 52 | _detailLabel.textColor=[UIColor colorWithRed:0.73f green:0.73f blue:0.73f alpha:1.00f]; 53 | 54 | 55 | 56 | 57 | } 58 | 59 | return self; 60 | 61 | } 62 | - (void)awakeFromNib { 63 | // Initialization code 64 | } 65 | 66 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 67 | [super setSelected:selected animated:animated]; 68 | 69 | // Configure the view for the selected state 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /NewsDemo/SwitchView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwitchView.h 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/10. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SwitchView : UIView 12 | @property UIButton *button1; 13 | @property UIButton *button2; 14 | @property UIButton *button3; 15 | @property UIButton *button4; 16 | @property ( strong) void (^ButtonActionBlock)(int buttonTag); 17 | -(void)swipeAction:(int)tag; 18 | @end 19 | -------------------------------------------------------------------------------- /NewsDemo/SwitchView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SwitchView.m 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/10. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "SwitchView.h" 10 | 11 | @implementation SwitchView 12 | int currentTag; 13 | UIColor *black; 14 | UIColor *light; 15 | UIFont *normalFont; 16 | UIFont *lightFont; 17 | - (id)initWithFrame:(CGRect)frame 18 | { 19 | self = [super initWithFrame:frame]; 20 | if (self) { 21 | // Initialization code 22 | self.backgroundColor=[UIColor colorWithRed:0.96 green:0.96 blue:0.96 alpha:1]; 23 | float h=35; 24 | float space=30; 25 | float width=35; 26 | float height=h; 27 | float w=space+width; 28 | black=[UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1]; 29 | light=[UIColor colorWithRed:0.86 green:0.2 blue:0.22 alpha:1]; 30 | 31 | normalFont=[UIFont boldSystemFontOfSize:15]; 32 | lightFont=[UIFont boldSystemFontOfSize:17]; 33 | 34 | _button1=[UIButton buttonWithType:UIButtonTypeCustom]; 35 | [self addSubview:_button1]; 36 | _button1.frame=CGRectMake(space, (h-height)/2, width, height); 37 | [_button1 setTitle:@"头条" forState:UIControlStateNormal]; 38 | _button1.titleLabel.font = normalFont; 39 | 40 | [_button1 setTitleColor:black forState:UIControlStateNormal]; 41 | _button1.tag=101; 42 | [_button1 addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside]; 43 | 44 | 45 | _button2=[UIButton buttonWithType:UIButtonTypeCustom]; 46 | [self addSubview:_button2]; 47 | _button2.frame=CGRectMake(w+space, (h-height)/2, width, height); 48 | [_button2 setTitle:@"段子" forState:UIControlStateNormal]; 49 | _button2.titleLabel.font = normalFont; 50 | [_button2 setTitleColor:black forState:UIControlStateNormal]; 51 | _button2.tag=102; 52 | [_button2 addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside]; 53 | 54 | 55 | _button3=[UIButton buttonWithType:UIButtonTypeCustom]; 56 | [self addSubview:_button3]; 57 | _button3.frame=CGRectMake(w*2+space, (h-height)/2, width, height); 58 | [_button3 setTitle:@"科技" forState:UIControlStateNormal]; 59 | _button3.titleLabel.font = normalFont; 60 | [_button3 setTitleColor:black forState:UIControlStateNormal]; 61 | _button3.tag=103; 62 | [_button3 addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside]; 63 | 64 | _button4=[UIButton buttonWithType:UIButtonTypeCustom]; 65 | [self addSubview:_button4]; 66 | _button4.frame=CGRectMake(w*3+space, (h-height)/2, width, height); 67 | [_button4 setTitle:@"军事" forState:UIControlStateNormal]; 68 | _button4.titleLabel.font = normalFont; 69 | [_button4 setTitleColor:black forState:UIControlStateNormal]; 70 | _button4.tag=104; 71 | [_button4 addTarget:self action:@selector(btAction:) forControlEvents:UIControlEventTouchUpInside]; 72 | 73 | 74 | 75 | // 默认情况 76 | currentTag=101; 77 | 78 | [_button1 setTitleColor:light forState:UIControlStateNormal]; 79 | _button1.titleLabel.font = lightFont; 80 | } 81 | return self; 82 | } 83 | -(void)swipeAction:(int)tag{ 84 | UIColor *black=[UIColor blackColor]; 85 | switch (tag) { 86 | case 101: 87 | currentTag=101; 88 | [_button1 setTitleColor:light forState:UIControlStateNormal]; 89 | [_button2 setTitleColor:black forState:UIControlStateNormal]; 90 | [_button3 setTitleColor:black forState:UIControlStateNormal]; 91 | [_button4 setTitleColor:black forState:UIControlStateNormal]; 92 | 93 | _button1.titleLabel.font = lightFont; 94 | _button2.titleLabel.font = normalFont; 95 | _button3.titleLabel.font = normalFont; 96 | _button4.titleLabel.font = normalFont; 97 | break; 98 | case 102: 99 | 100 | currentTag=102; 101 | [_button1 setTitleColor:black forState:UIControlStateNormal]; 102 | [_button2 setTitleColor:light forState:UIControlStateNormal]; 103 | [_button3 setTitleColor:black forState:UIControlStateNormal]; 104 | [_button4 setTitleColor:black forState:UIControlStateNormal]; 105 | 106 | _button1.titleLabel.font = normalFont; 107 | _button2.titleLabel.font = lightFont; 108 | _button3.titleLabel.font = normalFont; 109 | _button4.titleLabel.font = normalFont; 110 | 111 | 112 | break; 113 | case 103: 114 | 115 | currentTag=103; 116 | [_button1 setTitleColor:black forState:UIControlStateNormal]; 117 | [_button2 setTitleColor:black forState:UIControlStateNormal]; 118 | [_button3 setTitleColor:light forState:UIControlStateNormal]; 119 | [_button4 setTitleColor:black forState:UIControlStateNormal]; 120 | 121 | _button1.titleLabel.font = normalFont; 122 | _button2.titleLabel.font = normalFont; 123 | _button3.titleLabel.font = lightFont; 124 | _button4.titleLabel.font = normalFont; 125 | 126 | 127 | break; 128 | case 104: 129 | 130 | currentTag=104; 131 | [_button1 setTitleColor:black forState:UIControlStateNormal]; 132 | [_button2 setTitleColor:black forState:UIControlStateNormal]; 133 | [_button3 setTitleColor:black forState:UIControlStateNormal]; 134 | [_button4 setTitleColor:light forState:UIControlStateNormal]; 135 | 136 | _button1.titleLabel.font = normalFont; 137 | _button2.titleLabel.font = normalFont; 138 | _button3.titleLabel.font = normalFont; 139 | _button4.titleLabel.font = lightFont; 140 | break; 141 | default: 142 | break; 143 | } 144 | if (_ButtonActionBlock) { 145 | _ButtonActionBlock(currentTag); 146 | } 147 | 148 | } 149 | -(void)btAction:(UIButton *)button{ 150 | [self swipeAction:button.tag]; 151 | } 152 | 153 | @end 154 | -------------------------------------------------------------------------------- /NewsDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/9. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /NewsDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/9. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SwitchView.h" 11 | #import "NewsTableViewCell.h" 12 | @interface ViewController (){ 13 | UIScrollView *scrollView; 14 | int currentIndex; 15 | UITableView *tableView1; 16 | UITableView *tableView2; 17 | UITableView *tableView3; 18 | UITableView *tableView4; 19 | float titleHeight; 20 | float bgViewHeight; 21 | SwitchView *switchView; 22 | 23 | } 24 | 25 | @end 26 | 27 | @implementation ViewController 28 | 29 | - (void)viewDidLoad { 30 | [super viewDidLoad]; 31 | // Do any additional setup after loading the view, typically from a nib. 32 | 33 | 34 | [self initTitle]; 35 | 36 | titleHeight=35; 37 | bgViewHeight=HScreen-64-titleHeight; 38 | if (iOS7) { 39 | self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight; 40 | 41 | } 42 | self.view.backgroundColor=[UIColor colorWithRed:0.96 green:0.96 blue:0.96 alpha:1]; 43 | 44 | 45 | switchView=[[SwitchView alloc] initWithFrame:CGRectMake(0, 0, WScreen, titleHeight)]; 46 | [self.view addSubview:switchView]; 47 | 48 | [self initScroll]; 49 | [self initTable]; 50 | 51 | 52 | } 53 | -(void)initTitle{ 54 | UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 44)]; 55 | 56 | titleLabel.backgroundColor = [UIColor clearColor]; 57 | 58 | titleLabel.font = [UIFont boldSystemFontOfSize:20]; 59 | 60 | titleLabel.textColor = [UIColor whiteColor]; 61 | 62 | titleLabel.textAlignment = NSTextAlignmentCenter; 63 | 64 | titleLabel.text = @"新闻"; 65 | self.navigationItem.titleView = titleLabel; 66 | } 67 | -(void)initScroll{ 68 | 69 | 70 | scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, titleHeight, WScreen, bgViewHeight)]; 71 | scrollView.alwaysBounceHorizontal=YES; 72 | scrollView.bounces = YES; 73 | scrollView.pagingEnabled = YES; 74 | scrollView.delegate = self; 75 | scrollView.userInteractionEnabled = YES; 76 | scrollView.showsHorizontalScrollIndicator = NO; 77 | scrollView.showsVerticalScrollIndicator = NO; 78 | [self.view addSubview:scrollView]; 79 | 80 | [scrollView setContentSize:CGSizeMake(WScreen * (4), bgViewHeight)]; 81 | [scrollView setContentOffset:CGPointMake(0, 0)]; 82 | [scrollView scrollRectToVisible:CGRectMake(0,0,WScreen,bgViewHeight) animated:NO]; 83 | 84 | } 85 | 86 | -(void)initTable{ 87 | 88 | 89 | tableView1=[[UITableView alloc] initWithFrame:CGRectMake(0, 0, WScreen, bgViewHeight) style:UITableViewStylePlain]; 90 | [scrollView addSubview:tableView1]; 91 | tableView1.showsVerticalScrollIndicator = NO; 92 | 93 | tableView1.dataSource=self; 94 | tableView1.delegate=self; 95 | tableView1.tag=11; 96 | tableView1.separatorStyle=UITableViewCellSeparatorStyleNone; 97 | 98 | UIImageView *title1=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WScreen, 185)]; 99 | title1.image=[UIImage imageNamed:@"t1"]; 100 | [tableView1 setTableHeaderView:title1]; 101 | 102 | 103 | switchView.ButtonActionBlock=^(int buttonTag){ 104 | 105 | currentIndex=buttonTag-100; 106 | [scrollView scrollRectToVisible:CGRectMake(WScreen * (currentIndex-1),0,WScreen,bgViewHeight) animated:NO]; 107 | [scrollView setContentOffset:CGPointMake(WScreen* (currentIndex-1),0)]; 108 | 109 | if (currentIndex==1) { 110 | 111 | 112 | }else if (currentIndex==2){ 113 | if (tableView2==nil) { 114 | tableView2=[[UITableView alloc] initWithFrame:CGRectMake(WScreen, 0, WScreen, bgViewHeight) style:UITableViewStylePlain]; 115 | [scrollView addSubview:tableView2]; 116 | tableView2.showsVerticalScrollIndicator = NO; 117 | 118 | tableView2.tag=12; 119 | tableView2.dataSource=self; 120 | tableView2.delegate=self; 121 | tableView2.separatorStyle=UITableViewCellSeparatorStyleNone; 122 | 123 | 124 | } 125 | 126 | }else if (currentIndex==3){ 127 | if (tableView3==nil) { 128 | tableView3=[[UITableView alloc] initWithFrame:CGRectMake(WScreen*2, 0, WScreen, bgViewHeight) style:UITableViewStylePlain]; 129 | [scrollView addSubview:tableView3]; 130 | tableView3.showsVerticalScrollIndicator = NO; 131 | 132 | UIImageView *title3=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WScreen, 185)]; 133 | title3.image=[UIImage imageNamed:@"t2"]; 134 | [tableView3 setTableHeaderView:title3]; 135 | tableView3.tag=13; 136 | 137 | tableView3.dataSource=self; 138 | tableView3.delegate=self; 139 | tableView3.separatorStyle=UITableViewCellSeparatorStyleNone; 140 | 141 | 142 | } 143 | 144 | }else if (currentIndex==4){ 145 | if (tableView4==nil) { 146 | tableView4=[[UITableView alloc] initWithFrame:CGRectMake(WScreen*3, 0, WScreen, bgViewHeight) style:UITableViewStylePlain]; 147 | [scrollView addSubview:tableView4]; 148 | tableView4.showsVerticalScrollIndicator = NO; 149 | 150 | UIImageView *title4=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WScreen, 185)]; 151 | title4.image=[UIImage imageNamed:@"t3"]; 152 | [tableView4 setTableHeaderView:title4]; 153 | 154 | 155 | tableView4.tag=14; 156 | 157 | tableView4.dataSource=self; 158 | tableView4.delegate=self; 159 | tableView4.separatorStyle=UITableViewCellSeparatorStyleNone; 160 | 161 | } 162 | 163 | } 164 | 165 | 166 | }; 167 | 168 | currentIndex=1; 169 | 170 | 171 | } 172 | 173 | 174 | #pragma mark scrollView 175 | 176 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView1 177 | { 178 | CGFloat pagewidth = scrollView.frame.size.width; 179 | int currentPage = floor((scrollView.contentOffset.x - pagewidth/ (4)) / pagewidth) + 1; 180 | 181 | if (currentPage==0) 182 | { 183 | 184 | [scrollView scrollRectToVisible:CGRectMake(0,0,WScreen,bgViewHeight) animated:NO]; 185 | [scrollView setContentOffset:CGPointMake(0,0)]; 186 | } 187 | else if (currentPage==(3)) 188 | { 189 | 190 | [scrollView scrollRectToVisible:CGRectMake(WScreen * 3,0,WScreen,bgViewHeight) animated:NO]; 191 | [scrollView setContentOffset:CGPointMake(WScreen* 3,0)]; 192 | } 193 | 194 | currentIndex=currentPage+1; 195 | 196 | [switchView swipeAction:(100+currentPage+1)]; 197 | 198 | } 199 | 200 | #pragma mark tableView 201 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 202 | if (tableView.tag==11) { 203 | return 22; 204 | }else if (tableView.tag==12){ 205 | return 31; 206 | 207 | }else if (tableView.tag==13){ 208 | return 41; 209 | 210 | }else if (tableView.tag==14){ 211 | 212 | return 21; 213 | } 214 | return 11; 215 | } 216 | 217 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 218 | if (tableView.tag==11) { 219 | NewsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id1"]; 220 | 221 | 222 | if (cell == nil) { 223 | cell = [[NewsTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"id1"]; 224 | cell.selectionStyle=UITableViewCellSelectionStyleNone; 225 | 226 | 227 | } 228 | // Configure the cell... 229 | cell.mainIV.image=[UIImage imageNamed:@"l1"]; 230 | cell.mainLabel.text=@"塞浦路斯将为俄供海外基地"; 231 | cell.detailLabel.text=@"该基地距离英军安克罗蒂里空军基地仅50公里。"; 232 | return cell; 233 | 234 | }else if (tableView.tag==12){ 235 | 236 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id2"]; 237 | if (cell == nil) { 238 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"id2"]; 239 | cell.contentView.backgroundColor=[UIColor colorWithRed:0.96f green:0.96f blue:0.96f alpha:1.00f]; 240 | cell.selectionStyle=UITableViewCellSelectionStyleNone; 241 | UIView *lineView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, WScreen, 8)]; 242 | [cell.contentView addSubview:lineView]; 243 | lineView.backgroundColor=[UIColor colorWithRed:0.91f green:0.91f blue:0.91f alpha:1.00f]; 244 | } 245 | // Configure the cell... 246 | cell.textLabel.text=@"我小时偷西瓜,爪农来了。大一点的跑了,我也要跑,可太小跳不过水沟,刚哭,爪农就说不要跳,小心掉下去。后来还是爪农抱我过去,还把我偷的不熟西瓜拿了,换了个好的给我。谢谢了哈"; 247 | cell.textLabel.numberOfLines=0; 248 | return cell; 249 | 250 | 251 | 252 | }else if (tableView.tag==13){ 253 | 254 | NewsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id1"]; 255 | 256 | 257 | if (cell == nil) { 258 | cell = [[NewsTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"id1"]; 259 | cell.selectionStyle=UITableViewCellSelectionStyleNone; 260 | 261 | 262 | } 263 | // Configure the cell... 264 | cell.mainIV.image=[UIImage imageNamed:@"l2"]; 265 | cell.mainLabel.text=@"日:疑似朝5枚导弹坠入日本海"; 266 | cell.detailLabel.text=@"该导弹发射前无需注入燃料,外界事前较难掌握动向。"; 267 | return cell; 268 | 269 | 270 | 271 | }else if (tableView.tag==14){ 272 | 273 | 274 | NewsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id1"]; 275 | 276 | 277 | if (cell == nil) { 278 | cell = [[NewsTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"id1"]; 279 | cell.selectionStyle=UITableViewCellSelectionStyleNone; 280 | 281 | 282 | } 283 | // Configure the cell... 284 | cell.mainIV.image=[UIImage imageNamed:@"l3"]; 285 | cell.mainLabel.text=@"美公布高超声速武器失败原因"; 286 | cell.detailLabel.text=@"调查组认为用于调节发动机温度的设备发生故障。"; 287 | return cell; 288 | 289 | 290 | 291 | } 292 | return nil; 293 | 294 | } 295 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ 296 | if (tableView.tag==11) { 297 | return 100; 298 | }else if (tableView.tag==12){ 299 | return 170; 300 | 301 | }else if (tableView.tag==13){ 302 | return 100; 303 | 304 | }else if (tableView.tag==14){ 305 | 306 | return 100; 307 | } 308 | return 11; 309 | } 310 | - (void)didReceiveMemoryWarning { 311 | [super didReceiveMemoryWarning]; 312 | // Dispose of any resources that can be recreated. 313 | } 314 | 315 | @end 316 | -------------------------------------------------------------------------------- /NewsDemo/image/l1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo/image/l1.png -------------------------------------------------------------------------------- /NewsDemo/image/l2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo/image/l2.png -------------------------------------------------------------------------------- /NewsDemo/image/l3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo/image/l3.png -------------------------------------------------------------------------------- /NewsDemo/image/t1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo/image/t1.png -------------------------------------------------------------------------------- /NewsDemo/image/t2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo/image/t2.png -------------------------------------------------------------------------------- /NewsDemo/image/t3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/NewsDemo/6a8b985bc4269c5ebe10144924bf65f28237609f/NewsDemo/image/t3.png -------------------------------------------------------------------------------- /NewsDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NewsDemo 4 | // 5 | // Created by apple on 15/2/9. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /NewsDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | coderyi.$(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 | -------------------------------------------------------------------------------- /NewsDemoTests/NewsDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NewsDemoTests.m 3 | // NewsDemoTests 4 | // 5 | // Created by apple on 15/2/9. 6 | // Copyright (c) 2015年 coderyi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NewsDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation NewsDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NewsDemo 2 | 模仿网易新闻客户端首页,实现滑动选择菜单。 3 | 4 | 5 | 6 | 7 | ![newsdemo](http://7u2k5i.com1.z0.glb.clouddn.com/github_newsdemo1.png?imageMogr2/thumbnail/370x662!) 8 | --------------------------------------------------------------------------------