diff --git a/Meizi.xcodeproj/project.pbxproj b/Meizi.xcodeproj/project.pbxproj index 242fb48..0d2eb1f 100644 --- a/Meizi.xcodeproj/project.pbxproj +++ b/Meizi.xcodeproj/project.pbxproj @@ -10,29 +10,12 @@ 7D4375E21B54FB72001CEBC9 /* MeiziViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375E11B54FB72001CEBC9 /* MeiziViewController.m */; }; 7D4375E51B5508D3001CEBC9 /* MeiziRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375E41B5508D3001CEBC9 /* MeiziRequest.m */; }; 7D4375E81B550BC6001CEBC9 /* MeiziCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375E71B550BC6001CEBC9 /* MeiziCell.m */; }; - 7D4375EE1B551B99001CEBC9 /* RankViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375ED1B551B99001CEBC9 /* RankViewController.m */; }; - 7D4375F31B5520AF001CEBC9 /* RankRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375F21B5520AF001CEBC9 /* RankRequest.m */; }; - 7D4375F61B55210D001CEBC9 /* Rank.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375F51B55210D001CEBC9 /* Rank.m */; }; - 7D4375F91B5522E7001CEBC9 /* RankCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375F81B5522E7001CEBC9 /* RankCell.m */; }; - 7D4375FD1B552695001CEBC9 /* GroupsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D4375FC1B552695001CEBC9 /* GroupsViewController.m */; }; - 7D7510941B565221003CAF34 /* GroupsRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510931B565221003CAF34 /* GroupsRequest.m */; }; - 7D7510971B5652DA003CAF34 /* Groups.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510961B5652DA003CAF34 /* Groups.m */; }; - 7D75109A1B56572A003CAF34 /* GroupsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510991B56572A003CAF34 /* GroupsTableViewCell.m */; }; - 7D75109E1B565CA6003CAF34 /* SearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D75109D1B565CA6003CAF34 /* SearchViewController.m */; }; - 7D7510A11B565D67003CAF34 /* SearchRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510A01B565D67003CAF34 /* SearchRequest.m */; }; - 7D7510A41B565E7D003CAF34 /* Result.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510A31B565E7D003CAF34 /* Result.m */; }; - 7D7510A71B5660AD003CAF34 /* ResultTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510A61B5660AD003CAF34 /* ResultTableViewCell.m */; }; - 7D7510AD1B5672B7003CAF34 /* TopicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510AC1B5672B7003CAF34 /* TopicViewController.m */; }; - 7D7510B01B5672DE003CAF34 /* TopicRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510AF1B5672DE003CAF34 /* TopicRequest.m */; }; - 7D7510B31B5673B0003CAF34 /* Topic.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510B21B5673B0003CAF34 /* Topic.m */; }; - 7D7510B61B56767C003CAF34 /* TopicTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7510B51B56767C003CAF34 /* TopicTableViewCell.m */; }; 7D8A0AA81B58B482001EDD42 /* SettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D8A0AA71B58B482001EDD42 /* SettingViewController.m */; }; 7D93B84F1ACFD7CF00453452 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D93B84E1ACFD7CF00453452 /* main.m */; }; 7D93B8521ACFD7CF00453452 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D93B8511ACFD7CF00453452 /* AppDelegate.m */; }; 7D93B8581ACFD7CF00453452 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7D93B8561ACFD7CF00453452 /* Main.storyboard */; }; 7D93B85A1ACFD7CF00453452 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7D93B8591ACFD7CF00453452 /* Images.xcassets */; }; 7D93B87C1ACFDD2900453452 /* Meizi.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D93B87B1ACFDD2900453452 /* Meizi.m */; }; - 7DFF243D1B5B95800069BB4D /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DFF243C1B5B95800069BB4D /* WebViewController.m */; }; E07A9DDEC7193BA0132EB02F /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 77EACF44A594DBA190E5C5FF /* libPods.a */; }; /* End PBXBuildFile section */ @@ -46,39 +29,7 @@ 7D4375E41B5508D3001CEBC9 /* MeiziRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeiziRequest.m; sourceTree = ""; }; 7D4375E61B550BC6001CEBC9 /* MeiziCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeiziCell.h; sourceTree = ""; }; 7D4375E71B550BC6001CEBC9 /* MeiziCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeiziCell.m; sourceTree = ""; }; - 7D4375EC1B551B99001CEBC9 /* RankViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankViewController.h; sourceTree = ""; }; - 7D4375ED1B551B99001CEBC9 /* RankViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankViewController.m; sourceTree = ""; }; - 7D4375F11B5520AF001CEBC9 /* RankRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankRequest.h; sourceTree = ""; }; - 7D4375F21B5520AF001CEBC9 /* RankRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankRequest.m; sourceTree = ""; }; - 7D4375F41B55210D001CEBC9 /* Rank.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rank.h; sourceTree = ""; }; - 7D4375F51B55210D001CEBC9 /* Rank.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Rank.m; sourceTree = ""; }; - 7D4375F71B5522E7001CEBC9 /* RankCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankCell.h; sourceTree = ""; }; - 7D4375F81B5522E7001CEBC9 /* RankCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankCell.m; sourceTree = ""; }; - 7D4375FB1B552695001CEBC9 /* GroupsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupsViewController.h; sourceTree = ""; }; - 7D4375FC1B552695001CEBC9 /* GroupsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupsViewController.m; sourceTree = ""; }; 7D465E5D1AD03D5F00D68ED7 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; - 7D7510921B565221003CAF34 /* GroupsRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupsRequest.h; sourceTree = ""; }; - 7D7510931B565221003CAF34 /* GroupsRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupsRequest.m; sourceTree = ""; }; - 7D7510951B5652DA003CAF34 /* Groups.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Groups.h; sourceTree = ""; }; - 7D7510961B5652DA003CAF34 /* Groups.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Groups.m; sourceTree = ""; }; - 7D7510981B56572A003CAF34 /* GroupsTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupsTableViewCell.h; sourceTree = ""; }; - 7D7510991B56572A003CAF34 /* GroupsTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupsTableViewCell.m; sourceTree = ""; }; - 7D75109C1B565CA6003CAF34 /* SearchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchViewController.h; sourceTree = ""; }; - 7D75109D1B565CA6003CAF34 /* SearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchViewController.m; sourceTree = ""; }; - 7D75109F1B565D67003CAF34 /* SearchRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchRequest.h; sourceTree = ""; }; - 7D7510A01B565D67003CAF34 /* SearchRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchRequest.m; sourceTree = ""; }; - 7D7510A21B565E7D003CAF34 /* Result.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Result.h; sourceTree = ""; }; - 7D7510A31B565E7D003CAF34 /* Result.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Result.m; sourceTree = ""; }; - 7D7510A51B5660AD003CAF34 /* ResultTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultTableViewCell.h; sourceTree = ""; }; - 7D7510A61B5660AD003CAF34 /* ResultTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultTableViewCell.m; sourceTree = ""; }; - 7D7510AB1B5672B7003CAF34 /* TopicViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopicViewController.h; sourceTree = ""; }; - 7D7510AC1B5672B7003CAF34 /* TopicViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopicViewController.m; sourceTree = ""; }; - 7D7510AE1B5672DE003CAF34 /* TopicRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopicRequest.h; sourceTree = ""; }; - 7D7510AF1B5672DE003CAF34 /* TopicRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopicRequest.m; sourceTree = ""; }; - 7D7510B11B5673B0003CAF34 /* Topic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Topic.h; sourceTree = ""; }; - 7D7510B21B5673B0003CAF34 /* Topic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Topic.m; sourceTree = ""; }; - 7D7510B41B56767C003CAF34 /* TopicTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopicTableViewCell.h; sourceTree = ""; }; - 7D7510B51B56767C003CAF34 /* TopicTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopicTableViewCell.m; sourceTree = ""; }; 7D8A0AA61B58B482001EDD42 /* SettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingViewController.h; sourceTree = ""; }; 7D8A0AA71B58B482001EDD42 /* SettingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingViewController.m; sourceTree = ""; }; 7D93B8491ACFD7CF00453452 /* Meizi.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Meizi.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -91,8 +42,6 @@ 7D93B8761ACFDA1F00453452 /* Constant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constant.h; sourceTree = ""; }; 7D93B87A1ACFDD2900453452 /* Meizi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Meizi.h; sourceTree = ""; }; 7D93B87B1ACFDD2900453452 /* Meizi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Meizi.m; sourceTree = ""; }; - 7DFF243B1B5B95800069BB4D /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewController.h; sourceTree = ""; }; - 7DFF243C1B5B95800069BB4D /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewController.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -115,15 +64,20 @@ name = Frameworks; sourceTree = ""; }; + 7D2221171C780A5C00309078 /* Request */ = { + isa = PBXGroup; + children = ( + 7D4375E31B5508D3001CEBC9 /* MeiziRequest.h */, + 7D4375E41B5508D3001CEBC9 /* MeiziRequest.m */, + ); + name = Request; + sourceTree = ""; + }; 7D4375DC1B54FAFB001CEBC9 /* Module */ = { isa = PBXGroup; children = ( - 7D8A0AAD1B58B783001EDD42 /* WebView */, - 7D8A0AA51B58B46F001EDD42 /* Setting */, - 7D75109B1B565C92003CAF34 /* Search */, - 7D4375FA1B552688001CEBC9 /* Groups */, - 7D4375EA1B551B83001CEBC9 /* Rank */, 7D4375DD1B54FB0F001CEBC9 /* Meizi */, + 7D8A0AA51B58B46F001EDD42 /* Setting */, ); name = Module; sourceTree = ""; @@ -131,6 +85,7 @@ 7D4375DD1B54FB0F001CEBC9 /* Meizi */ = { isa = PBXGroup; children = ( + 7D2221171C780A5C00309078 /* Request */, 7D4375E91B550BCB001CEBC9 /* View */, 7D4375DF1B54FB4F001CEBC9 /* Model */, 7D4375DE1B54FB4A001CEBC9 /* Controller */, @@ -152,8 +107,6 @@ children = ( 7D93B87A1ACFDD2900453452 /* Meizi.h */, 7D93B87B1ACFDD2900453452 /* Meizi.m */, - 7D4375E31B5508D3001CEBC9 /* MeiziRequest.h */, - 7D4375E41B5508D3001CEBC9 /* MeiziRequest.m */, ); name = Model; sourceTree = ""; @@ -167,102 +120,6 @@ name = View; sourceTree = ""; }; - 7D4375EA1B551B83001CEBC9 /* Rank */ = { - isa = PBXGroup; - children = ( - 7D4375F01B551F66001CEBC9 /* Model */, - 7D4375EF1B551F61001CEBC9 /* View */, - 7D4375EB1B551B89001CEBC9 /* Controller */, - ); - name = Rank; - sourceTree = ""; - }; - 7D4375EB1B551B89001CEBC9 /* Controller */ = { - isa = PBXGroup; - children = ( - 7D4375EC1B551B99001CEBC9 /* RankViewController.h */, - 7D4375ED1B551B99001CEBC9 /* RankViewController.m */, - ); - name = Controller; - sourceTree = ""; - }; - 7D4375EF1B551F61001CEBC9 /* View */ = { - isa = PBXGroup; - children = ( - 7D4375F71B5522E7001CEBC9 /* RankCell.h */, - 7D4375F81B5522E7001CEBC9 /* RankCell.m */, - ); - name = View; - sourceTree = ""; - }; - 7D4375F01B551F66001CEBC9 /* Model */ = { - isa = PBXGroup; - children = ( - 7D4375F11B5520AF001CEBC9 /* RankRequest.h */, - 7D4375F21B5520AF001CEBC9 /* RankRequest.m */, - 7D4375F41B55210D001CEBC9 /* Rank.h */, - 7D4375F51B55210D001CEBC9 /* Rank.m */, - ); - name = Model; - sourceTree = ""; - }; - 7D4375FA1B552688001CEBC9 /* Groups */ = { - isa = PBXGroup; - children = ( - 7D7510AA1B5671FD003CAF34 /* View */, - 7D7510A91B5671F6003CAF34 /* Model */, - 7D7510A81B5671ED003CAF34 /* Controller */, - ); - name = Groups; - sourceTree = ""; - }; - 7D75109B1B565C92003CAF34 /* Search */ = { - isa = PBXGroup; - children = ( - 7D8A0AAC1B58B714001EDD42 /* View */, - 7D8A0AAB1B58B70C001EDD42 /* Model */, - 7D8A0AAA1B58B705001EDD42 /* Controller */, - ); - name = Search; - sourceTree = ""; - }; - 7D7510A81B5671ED003CAF34 /* Controller */ = { - isa = PBXGroup; - children = ( - 7D4375FB1B552695001CEBC9 /* GroupsViewController.h */, - 7D4375FC1B552695001CEBC9 /* GroupsViewController.m */, - 7D7510AB1B5672B7003CAF34 /* TopicViewController.h */, - 7D7510AC1B5672B7003CAF34 /* TopicViewController.m */, - ); - name = Controller; - sourceTree = ""; - }; - 7D7510A91B5671F6003CAF34 /* Model */ = { - isa = PBXGroup; - children = ( - 7D7510951B5652DA003CAF34 /* Groups.h */, - 7D7510961B5652DA003CAF34 /* Groups.m */, - 7D7510921B565221003CAF34 /* GroupsRequest.h */, - 7D7510931B565221003CAF34 /* GroupsRequest.m */, - 7D7510AE1B5672DE003CAF34 /* TopicRequest.h */, - 7D7510AF1B5672DE003CAF34 /* TopicRequest.m */, - 7D7510B11B5673B0003CAF34 /* Topic.h */, - 7D7510B21B5673B0003CAF34 /* Topic.m */, - ); - name = Model; - sourceTree = ""; - }; - 7D7510AA1B5671FD003CAF34 /* View */ = { - isa = PBXGroup; - children = ( - 7D7510981B56572A003CAF34 /* GroupsTableViewCell.h */, - 7D7510991B56572A003CAF34 /* GroupsTableViewCell.m */, - 7D7510B41B56767C003CAF34 /* TopicTableViewCell.h */, - 7D7510B51B56767C003CAF34 /* TopicTableViewCell.m */, - ); - name = View; - sourceTree = ""; - }; 7D8A0AA51B58B46F001EDD42 /* Setting */ = { isa = PBXGroup; children = ( @@ -280,44 +137,6 @@ name = Controller; sourceTree = ""; }; - 7D8A0AAA1B58B705001EDD42 /* Controller */ = { - isa = PBXGroup; - children = ( - 7D75109C1B565CA6003CAF34 /* SearchViewController.h */, - 7D75109D1B565CA6003CAF34 /* SearchViewController.m */, - ); - name = Controller; - sourceTree = ""; - }; - 7D8A0AAB1B58B70C001EDD42 /* Model */ = { - isa = PBXGroup; - children = ( - 7D75109F1B565D67003CAF34 /* SearchRequest.h */, - 7D7510A01B565D67003CAF34 /* SearchRequest.m */, - 7D7510A21B565E7D003CAF34 /* Result.h */, - 7D7510A31B565E7D003CAF34 /* Result.m */, - ); - name = Model; - sourceTree = ""; - }; - 7D8A0AAC1B58B714001EDD42 /* View */ = { - isa = PBXGroup; - children = ( - 7D7510A51B5660AD003CAF34 /* ResultTableViewCell.h */, - 7D7510A61B5660AD003CAF34 /* ResultTableViewCell.m */, - ); - name = View; - sourceTree = ""; - }; - 7D8A0AAD1B58B783001EDD42 /* WebView */ = { - isa = PBXGroup; - children = ( - 7DFF243B1B5B95800069BB4D /* WebViewController.h */, - 7DFF243C1B5B95800069BB4D /* WebViewController.m */, - ); - name = WebView; - sourceTree = ""; - }; 7D93B8401ACFD7CF00453452 = { isa = PBXGroup; children = ( @@ -389,6 +208,7 @@ 7D93B8461ACFD7CF00453452 /* Frameworks */, 7D93B8471ACFD7CF00453452 /* Resources */, 152ED65C4E3F94F23828D1F8 /* Copy Pods Resources */, + 2904D6DDAC1B2C5ABAFD918A /* Embed Pods Frameworks */, ); buildRules = ( ); @@ -405,7 +225,7 @@ 7D93B8411ACFD7CF00453452 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0620; + LastUpgradeCheck = 0720; ORGANIZATIONNAME = Sunnyyoung; TargetAttributes = { 7D93B8481ACFD7CF00453452 = { @@ -459,6 +279,21 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; showEnvVarsInLog = 0; }; + 2904D6DDAC1B2C5ABAFD918A /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 30B4BF70FF517833B8A8ECBF /* Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -481,28 +316,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7D7510A71B5660AD003CAF34 /* ResultTableViewCell.m in Sources */, - 7D75109A1B56572A003CAF34 /* GroupsTableViewCell.m in Sources */, - 7D4375F61B55210D001CEBC9 /* Rank.m in Sources */, - 7D7510AD1B5672B7003CAF34 /* TopicViewController.m in Sources */, 7D93B87C1ACFDD2900453452 /* Meizi.m in Sources */, 7D4375E21B54FB72001CEBC9 /* MeiziViewController.m in Sources */, - 7D4375F91B5522E7001CEBC9 /* RankCell.m in Sources */, - 7D7510941B565221003CAF34 /* GroupsRequest.m in Sources */, 7D93B8521ACFD7CF00453452 /* AppDelegate.m in Sources */, - 7D7510B61B56767C003CAF34 /* TopicTableViewCell.m in Sources */, - 7D75109E1B565CA6003CAF34 /* SearchViewController.m in Sources */, - 7D4375EE1B551B99001CEBC9 /* RankViewController.m in Sources */, - 7D7510A41B565E7D003CAF34 /* Result.m in Sources */, - 7D7510B31B5673B0003CAF34 /* Topic.m in Sources */, - 7D7510A11B565D67003CAF34 /* SearchRequest.m in Sources */, 7D93B84F1ACFD7CF00453452 /* main.m in Sources */, - 7D7510971B5652DA003CAF34 /* Groups.m in Sources */, - 7D7510B01B5672DE003CAF34 /* TopicRequest.m in Sources */, - 7D4375F31B5520AF001CEBC9 /* RankRequest.m in Sources */, - 7DFF243D1B5B95800069BB4D /* WebViewController.m in Sources */, 7D4375E81B550BC6001CEBC9 /* MeiziCell.m in Sources */, - 7D4375FD1B552695001CEBC9 /* GroupsViewController.m in Sources */, 7D4375E51B5508D3001CEBC9 /* MeiziRequest.m in Sources */, 7D8A0AA81B58B482001EDD42 /* SettingViewController.m in Sources */, ); @@ -542,6 +360,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -556,7 +375,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -591,7 +410,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; @@ -609,8 +428,9 @@ INFOPLIST_FILE = Meizi/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "net.sunnyyoung.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = 1; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -625,8 +445,9 @@ INFOPLIST_FILE = Meizi/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "net.sunnyyoung.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = 1; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; diff --git a/Meizi/AppDelegate.h b/Meizi/AppDelegate.h index 1dfa258..45f14ca 100644 --- a/Meizi/AppDelegate.h +++ b/Meizi/AppDelegate.h @@ -8,6 +8,7 @@ #import #import +#import #import @interface AppDelegate : UIResponder diff --git a/Meizi/AppDelegate.m b/Meizi/AppDelegate.m index 29a160c..9d1ad7b 100644 --- a/Meizi/AppDelegate.m +++ b/Meizi/AppDelegate.m @@ -12,16 +12,10 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - //Set Background Color - self.window.backgroundColor = [UIColor whiteColor]; - //Set Network [AFNetworkActivityIndicatorManager sharedManager].enabled = YES; [YTKNetworkConfig sharedInstance].baseUrl = BaseURL; - - //Set UserAgent - NSDictionary *userAgent = @{@"UserAgent": @"Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4"}; - [[NSUserDefaults standardUserDefaults] registerDefaults:userAgent]; + [[YTKNetworkAgent sharedInstance] setValue:[NSSet setWithObjects:@"application/json", @"text/plain", @"text/javascript", @"text/json", @"text/html", @"text/css", nil] forKeyPath :@"_manager.responseSerializer.acceptableContentTypes"]; //Set SVProgressHUD [SVProgressHUD setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.9]]; diff --git a/Meizi/Base.lproj/Main.storyboard b/Meizi/Base.lproj/Main.storyboard index b804dd4..4af7315 100644 --- a/Meizi/Base.lproj/Main.storyboard +++ b/Meizi/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -19,7 +20,7 @@ - + @@ -44,7 +45,7 @@ - + @@ -99,354 +100,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -463,7 +117,7 @@ - + @@ -482,17 +136,21 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -681,9 +187,6 @@ - - - @@ -693,17 +196,8 @@ - - - - - - - - - diff --git a/Meizi/Constant.h b/Meizi/Constant.h index 9ff992c..75cf8d1 100644 --- a/Meizi/Constant.h +++ b/Meizi/Constant.h @@ -9,10 +9,10 @@ #ifndef Meizi_Constant_h #define Meizi_Constant_h -#define SCREEN_WIDTH CGRectGetWidth([UIApplication sharedApplication].keyWindow.bounds) -#define SCREEN_HEIGHT CGRectGetHeight([UIApplication sharedApplication].keyWindow.bounds) +#define kScreenWidth CGRectGetWidth([UIApplication sharedApplication].keyWindow.bounds) +#define kScreenHeight CGRectGetHeight([UIApplication sharedApplication].keyWindow.bounds) -static NSString * const BaseURL = @"http://api.xiaojianjian.net"; +static NSString * const BaseURL = @"http://www.dbmeinv.com"; static NSString * const Meizi_All = @"0"; static NSString * const Meizi_DaXiong = @"2"; @@ -22,10 +22,6 @@ static NSString * const Meizi_MeiTui = @"3"; static NSString * const Meizi_QingXin = @"4"; static NSString * const Meizi_ZaHui = @"5"; -static NSString * const DoubanGroupURL = @"http://www.douban.com/group/"; -static NSString * const DoubanTopicURL = @"http://www.douban.com/group/topic/"; -static NSString * const DoubanPeopleURL = @"http://www.douban.com/group/people/"; - #endif diff --git a/Meizi/Groups.h b/Meizi/Groups.h deleted file mode 100644 index d00f4e9..0000000 --- a/Meizi/Groups.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// Group.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface Groups : NSObject - -@property (nonatomic, copy) NSString *c_sort; -@property (nonatomic, copy) NSString *c_group_ab_name; -@property (nonatomic, assign) NSInteger id; -@property (nonatomic, copy) NSString *c_group_name; -@property (nonatomic, assign) long long create_date_time; -@property (nonatomic, copy) NSString *c_group_url; -@property (nonatomic, copy) NSString *c_ico_url; -@property (nonatomic, copy) NSString *c_group_id; -@property (nonatomic, copy) NSString *c_group_intro; -@property (nonatomic, assign) NSInteger b; - -@end diff --git a/Meizi/Groups.m b/Meizi/Groups.m deleted file mode 100644 index ff28fe0..0000000 --- a/Meizi/Groups.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// Group.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "Groups.h" - -@implementation Groups - -@end diff --git a/Meizi/GroupsRequest.h b/Meizi/GroupsRequest.h deleted file mode 100644 index 1032e79..0000000 --- a/Meizi/GroupsRequest.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// GroupRequest.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface GroupsRequest : YTKRequest - -@end diff --git a/Meizi/GroupsRequest.m b/Meizi/GroupsRequest.m deleted file mode 100644 index 46f9ae0..0000000 --- a/Meizi/GroupsRequest.m +++ /dev/null @@ -1,32 +0,0 @@ -// -// GroupRequest.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "GroupsRequest.h" - -@implementation GroupsRequest - -- (instancetype)init { - self = [super init]; - if (self) { - } - return self; -} - -- (NSString *)requestUrl { - return @"/api/dbmeinv.htm"; -} - -- (YTKRequestMethod)requestMethod { - return YTKRequestMethodPost; -} - -- (id)requestArgument { - return @{@"m": @"groups"}; -} - -@end diff --git a/Meizi/GroupsTableViewCell.h b/Meizi/GroupsTableViewCell.h deleted file mode 100644 index 8e90925..0000000 --- a/Meizi/GroupsTableViewCell.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// GroupTableViewCell.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface GroupsTableViewCell : UITableViewCell - -@property (weak, nonatomic) IBOutlet UIImageView *iconImageView; -@property (weak, nonatomic) IBOutlet UILabel *titleLabel; -@property (weak, nonatomic) IBOutlet UILabel *descriptionLabel; - - -@end diff --git a/Meizi/GroupsTableViewCell.m b/Meizi/GroupsTableViewCell.m deleted file mode 100644 index d43f5ba..0000000 --- a/Meizi/GroupsTableViewCell.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// GroupTableViewCell.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "GroupsTableViewCell.h" - -@implementation GroupsTableViewCell - -- (void)awakeFromNib { - self.iconImageView.layer.masksToBounds = YES; - self.iconImageView.layer.cornerRadius = CGRectGetWidth(self.iconImageView.frame)/2; -} - -@end diff --git a/Meizi/GroupsViewController.h b/Meizi/GroupsViewController.h deleted file mode 100644 index e3153b0..0000000 --- a/Meizi/GroupsViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// GroupViewController.h -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface GroupsViewController : UIViewController - -@property (weak, nonatomic) IBOutlet UITableView *tableView; - -@end diff --git a/Meizi/GroupsViewController.m b/Meizi/GroupsViewController.m deleted file mode 100644 index 7fb5dcc..0000000 --- a/Meizi/GroupsViewController.m +++ /dev/null @@ -1,103 +0,0 @@ -// -// GroupViewController.m -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "GroupsViewController.h" -#import "TopicViewController.h" -#import "GroupsTableViewCell.h" -#import "GroupsRequest.h" -#import "Groups.h" - -@interface GroupsViewController () - -@property (nonatomic, assign) NSInteger page; -@property (nonatomic, strong) NSMutableArray *groupArray; - -@end - -@implementation GroupsViewController - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - _page = 1; - _groupArray = [[NSMutableArray alloc] init]; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self setupRefreshHeaderAndFooter]; -} - -- (void)setupRefreshHeaderAndFooter { - MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshGroup)]; - header.autoChangeAlpha = YES; - self.tableView.header = header; - self.tableView.tableFooterView = [[UIView alloc] init]; - [self.tableView.header beginRefreshing]; -} - -- (void)refreshGroup { - self.page = 1; - GroupsRequest *request = [[GroupsRequest alloc] init]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - [self.groupArray removeAllObjects]; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *groupArray = [Groups objectArrayWithKeyValuesArray:data]; - - [self.groupArray addObjectsFromArray:groupArray]; - [self.tableView reloadData]; - [self.tableView.header endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.groupArray removeAllObjects]; - [self.tableView reloadData]; - [self.tableView.header endRefreshing]; - - }]; -} - -#pragma mark - TableView DataSource && Delegate -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - tableView.footer.hidden = self.groupArray.count == 0; - return self.groupArray.count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - GroupsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GroupsCell" forIndexPath:indexPath]; - Groups *group = self.groupArray[indexPath.row]; - [cell.iconImageView setImageWithURL:[NSURL URLWithString:group.c_ico_url] - usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - cell.titleLabel.text = group.c_group_name; - cell.descriptionLabel.text = group.c_group_ab_name; - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [tableView deselectRowAtIndexPath:indexPath animated:YES]; - Groups *group = [self.groupArray objectAtIndex:indexPath.row]; - [self performSegueWithIdentifier:@"toGroupViewSection" sender:@{@"title": group.c_group_name, - @"groupID": group.c_group_id}]; -} - -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqualToString:@"toGroupViewSection"]) { - TopicViewController *destination = segue.destinationViewController; - destination.title = sender[@"title"]; - destination.groupID = sender[@"groupID"]; - } -} - -@end diff --git a/Meizi/Images.xcassets/AppIcon.appiconset/Contents.json b/Meizi/Images.xcassets/AppIcon.appiconset/Contents.json index b34946a..fd45fec 100644 --- a/Meizi/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Meizi/Images.xcassets/AppIcon.appiconset/Contents.json @@ -35,6 +35,41 @@ "idiom" : "iphone", "filename" : "Meizi_60pt_@3x.png", "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" } ], "info" : { diff --git a/Meizi/Info.plist b/Meizi/Info.plist index be95c78..bb3619e 100644 --- a/Meizi/Info.plist +++ b/Meizi/Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - net.sunnyyoung.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -17,13 +17,18 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.0 + 2.1 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + UIMainStoryboardFile Main UIRequiredDeviceCapabilities @@ -33,6 +38,9 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight diff --git a/Meizi/Meizi.h b/Meizi/Meizi.h index f11a5eb..c7527f8 100644 --- a/Meizi/Meizi.h +++ b/Meizi/Meizi.h @@ -10,10 +10,7 @@ @interface Meizi : NSObject -@property (nonatomic, copy) NSString *topic_id; -@property (nonatomic, copy) NSString *topic_title; -@property (nonatomic, copy) NSString *douban_group_id; -@property (nonatomic, copy) NSString *douban_topic_id; -@property (nonatomic, copy) NSString *img_url; +@property (nonatomic, copy) NSString *title; +@property (nonatomic, copy) NSString *src; @end diff --git a/Meizi/MeiziCell.h b/Meizi/MeiziCell.h index a1813b2..2df55c6 100644 --- a/Meizi/MeiziCell.h +++ b/Meizi/MeiziCell.h @@ -8,8 +8,10 @@ #import +@class Meizi; + @interface MeiziCell : UICollectionViewCell -@property (weak, nonatomic) IBOutlet UIImageView *imageView; +- (void)setMeizi:(Meizi *)meizi; @end diff --git a/Meizi/MeiziCell.m b/Meizi/MeiziCell.m index f30220c..72fa1a2 100644 --- a/Meizi/MeiziCell.m +++ b/Meizi/MeiziCell.m @@ -7,7 +7,21 @@ // #import "MeiziCell.h" +#import "Meizi.h" + +@interface MeiziCell () + +@property (weak, nonatomic) IBOutlet UIImageView *imageView; + +@end @implementation MeiziCell +#pragma mark - Public method + +- (void)setMeizi:(Meizi *)meizi { + NSURL *imageURL = [NSURL URLWithString:meizi.src]; + [self.imageView setImageWithURL:imageURL usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; +} + @end diff --git a/Meizi/MeiziRequest.h b/Meizi/MeiziRequest.h index 23c5921..334165b 100644 --- a/Meizi/MeiziRequest.h +++ b/Meizi/MeiziRequest.h @@ -7,6 +7,9 @@ // #import +#import + +@class Meizi; typedef NS_ENUM(NSUInteger, MeiziType) { MeiziTypeAll = 0, @@ -20,6 +23,9 @@ typedef NS_ENUM(NSUInteger, MeiziType) { @interface MeiziRequest : YTKRequest -- (instancetype)initWithPage:(NSInteger)page meiziType:(MeiziType)type; ++ (MeiziRequest *)requestWithPage:(NSInteger)page + meiziType:(MeiziType)type + success:(void (^)(NSArray *meiziArray))success + failure:(void (^)(NSString *message))failure; @end diff --git a/Meizi/MeiziRequest.m b/Meizi/MeiziRequest.m index 5d33e68..6a2f82f 100644 --- a/Meizi/MeiziRequest.m +++ b/Meizi/MeiziRequest.m @@ -7,6 +7,7 @@ // #import "MeiziRequest.h" +#import "Meizi.h" @interface MeiziRequest() @@ -26,18 +27,47 @@ - (instancetype)initWithPage:(NSInteger)page meiziType:(MeiziType)type { return self; } ++ (MeiziRequest *)requestWithPage:(NSInteger)page meiziType:(MeiziType)type success:(void (^)(NSArray *))success failure:(void (^)(NSString *))failure { + MeiziRequest *request = [[MeiziRequest alloc] initWithPage:page meiziType:type]; + [request startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest *request) { + MeiziRequest *meiziRequest = (MeiziRequest *)request; + success?success([meiziRequest meiziArray]):nil; + } failure:^(__kindof YTKBaseRequest *request) { + MeiziRequest *meiziRequest = (MeiziRequest *)request; + failure?failure(@(meiziRequest.responseStatusCode).stringValue):nil; + }]; + return request; +} + - (NSString *)requestUrl { - return @"/api/dbmeinv.htm"; + return @"/dbgroup/show.htm"; } - (YTKRequestMethod)requestMethod { - return YTKRequestMethodPost; + return YTKRequestMethodGet; } - (id)requestArgument { - return @{@"m": @"images", - @"pageIndex": @(_page), - @"cagegoryId": @(_type)}; + return @{@"pager_offset": @(_page), + @"cid": @(_type)}; +} + +- (NSArray *)meiziArray { + NSString *htmlString = self.responseString; + TFHpple *rootDocument = [TFHpple hppleWithHTMLData:[htmlString dataUsingEncoding:NSUTF8StringEncoding]]; + NSArray *liElements = [rootDocument searchWithXPathQuery:@"//*[@id=\"main\"]/div[3]/div[2]/ul/li"]; + NSMutableArray *meiziArray = [NSMutableArray array]; + for (TFHppleElement *liElement in liElements) { + TFHppleElement *imageElement = [[[[liElement firstChildWithClassName:@"thumbnail"] + firstChildWithClassName:@"img_single"] + firstChildWithClassName:@"link"] + firstChildWithTagName:@"img"]; + Meizi *meizi = [Meizi mj_objectWithKeyValues:imageElement.attributes]; + if (meizi != nil) { + [meiziArray addObject:meizi]; + } + } + return meiziArray; } @end diff --git a/Meizi/MeiziViewController.m b/Meizi/MeiziViewController.m index 42a7aad..0b07af7 100644 --- a/Meizi/MeiziViewController.m +++ b/Meizi/MeiziViewController.m @@ -21,6 +21,8 @@ @interface MeiziViewController () *meiziArray) { + [self.collectionView.mj_header endRefreshing]; + [self reloadDataWithMeiziArray:meiziArray emptyBeforeReload:YES]; + } failure:^(NSString *message) { + [SVProgressHUD showWithStatus:message]; + [self.collectionView.mj_header endRefreshing]; }]; } - (void)loadMoreMeizi { - MeiziRequest *request = [[MeiziRequest alloc] initWithPage:self.page+1 meiziType:self.type]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - self.page++; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *meiziArray = [Meizi objectArrayWithKeyValuesArray:data]; - - [self.meiziArray addObjectsFromArray:meiziArray]; - [self.collectionView reloadData]; - [self.collectionView.footer endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.meiziArray removeAllObjects]; - [self.collectionView reloadData]; - [self.collectionView.footer endRefreshing]; - + [MeiziRequest requestWithPage:self.page meiziType:self.type+1 success:^(NSArray *meiziArray) { + [self.collectionView.mj_footer endRefreshing]; + [self reloadDataWithMeiziArray:meiziArray emptyBeforeReload:NO]; + } failure:^(NSString *message) { + [SVProgressHUD showWithStatus:message]; + [self.collectionView.mj_footer endRefreshing]; }]; } -#pragma mark - CollectionView DataSource && Delegate +- (void)reloadDataWithMeiziArray:(NSArray *)meiziArray emptyBeforeReload:(BOOL)emptyBeforeReload { + if (emptyBeforeReload) { + self.page = 1; + [self.meiziArray removeAllObjects]; + [self.meiziArray addObjectsFromArray:meiziArray]; + [self.collectionView.mj_footer resetNoMoreData]; + } else { + if (meiziArray.count) { + [self.meiziArray addObjectsFromArray:meiziArray]; + self.page++; + } else { + [self.collectionView.mj_footer endRefreshingWithNoMoreData]; + } + } + [self.collectionView reloadData]; +} + +#pragma mark - CollectionView DataSource + - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - collectionView.footer.hidden = self.meiziArray.count == 0; + collectionView.mj_footer.hidden = self.meiziArray.count == 0; return self.meiziArray.count; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - return CGSizeMake(SCREEN_WIDTH/3-1, SCREEN_WIDTH/3-1); + NSInteger perLine = UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)?3:5; + return CGSizeMake(kScreenWidth/perLine-1, kScreenWidth/perLine-1); } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { MeiziCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MeiziCell" forIndexPath:indexPath]; - Meizi *meizi = [self.meiziArray objectAtIndex:indexPath.row]; - NSURL *imageURL = [NSURL URLWithString:meizi.img_url]; - [cell.imageView setImageWithURL:imageURL usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; + [cell setMeizi:self.meiziArray[indexPath.row]]; return cell; } +#pragma mark - Orientation method + +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + [coordinator animateAlongsideTransition:nil completion:^(id context) { + [self.collectionView performBatchUpdates:^{ + [self.collectionView setCollectionViewLayout:self.collectionView.collectionViewLayout animated:YES]; + } completion:nil]; + }]; +} + +#pragma mark - CollectionView Delegate + - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { NSMutableArray *photoArray = [NSMutableArray array]; for (Meizi *meizi in self.meiziArray) { - MWPhoto *photo = [MWPhoto photoWithURL:[NSURL URLWithString:meizi.img_url]]; - photo.caption = meizi.topic_title; + MWPhoto *photo = [MWPhoto photoWithURL:[NSURL URLWithString:meizi.src]]; + photo.caption = meizi.title; [photoArray addObject:photo]; } MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithPhotos:photoArray]; diff --git a/Meizi/Rank.h b/Meizi/Rank.h deleted file mode 100644 index 9b41287..0000000 --- a/Meizi/Rank.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Rank.h -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface Rank : NSObject - -@property (nonatomic, copy) NSString *topic_id; -@property (nonatomic, copy) NSString *topic_title; -@property (nonatomic, copy) NSString *douban_group_id; -@property (nonatomic, copy) NSString *douban_topic_id; -@property (nonatomic, copy) NSString *img_url; - -@end diff --git a/Meizi/Rank.m b/Meizi/Rank.m deleted file mode 100644 index 3ca38b1..0000000 --- a/Meizi/Rank.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// Rank.m -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "Rank.h" - -@implementation Rank - -@end diff --git a/Meizi/RankCell.h b/Meizi/RankCell.h deleted file mode 100644 index 7b9de08..0000000 --- a/Meizi/RankCell.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// RankCell.h -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface RankCell : UICollectionViewCell - -@property (weak, nonatomic) IBOutlet UIImageView *imageView; - -@end diff --git a/Meizi/RankCell.m b/Meizi/RankCell.m deleted file mode 100644 index 72535f5..0000000 --- a/Meizi/RankCell.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// RankCell.m -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "RankCell.h" - -@implementation RankCell - -@end diff --git a/Meizi/RankRequest.h b/Meizi/RankRequest.h deleted file mode 100644 index cd75fcd..0000000 --- a/Meizi/RankRequest.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// RankRequest.h -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface RankRequest : YTKRequest - -- (instancetype)initWithPage:(NSInteger)page; - -@end diff --git a/Meizi/RankRequest.m b/Meizi/RankRequest.m deleted file mode 100644 index 9484e7d..0000000 --- a/Meizi/RankRequest.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// RankRequest.m -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "RankRequest.h" - -@interface RankRequest() - -@property (nonatomic) NSInteger page; - -@end - -@implementation RankRequest - -- (instancetype)initWithPage:(NSInteger)page { - self = [super init]; - if (self) { - _page = page; - } - return self; -} - -- (NSString *)requestUrl { - return @"/api/dbmeinv.htm"; -} - -- (YTKRequestMethod)requestMethod { - return YTKRequestMethodPost; -} - -- (id)requestArgument { - return @{@"m": @"images", - @"queryType": @"rank", - @"pageIndex": @(_page)}; -} - -@end diff --git a/Meizi/RankViewController.h b/Meizi/RankViewController.h deleted file mode 100644 index 1cef332..0000000 --- a/Meizi/RankViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// RankViewController.h -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface RankViewController : UIViewController - -@property (weak, nonatomic) IBOutlet UICollectionView *collectionView; - -@end diff --git a/Meizi/RankViewController.m b/Meizi/RankViewController.m deleted file mode 100644 index 048df1b..0000000 --- a/Meizi/RankViewController.m +++ /dev/null @@ -1,125 +0,0 @@ -// -// RankViewController.m -// Meizi -// -// Created by Sunnyyoung on 15/7/14. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "RankViewController.h" -#import "RankRequest.h" -#import "RankCell.h" -#import "Rank.h" - -@interface RankViewController () - -@property (nonatomic, assign) NSInteger page; -@property (nonatomic, strong) NSMutableArray *rankArray; - -@end - -@implementation RankViewController - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - _page = 1; - _rankArray = [[NSMutableArray alloc] init]; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self setupRefreshHeaderAndFooter]; -} - -- (void)setupRefreshHeaderAndFooter { - MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshRank)]; - MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreRank)]; - header.autoChangeAlpha = YES; - footer.automaticallyRefresh = NO; - self.collectionView.header = header; - self.collectionView.footer = footer; - [self.collectionView.header beginRefreshing]; -} - -- (void)refreshRank { - self.page = 1; - RankRequest *request = [[RankRequest alloc] initWithPage:self.page]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - [self.rankArray removeAllObjects]; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *meiziArray = [Rank objectArrayWithKeyValuesArray:data]; - - [self.rankArray addObjectsFromArray:meiziArray]; - [self.collectionView reloadData]; - [self.collectionView.header endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.rankArray removeAllObjects]; - [self.collectionView reloadData]; - [self.collectionView.header endRefreshing]; - - }]; -} - -- (void)loadMoreRank { - RankRequest *request = [[RankRequest alloc] initWithPage:self.page+1]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - self.page++; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *meiziArray = [Rank objectArrayWithKeyValuesArray:data]; - - [self.rankArray addObjectsFromArray:meiziArray]; - [self.collectionView reloadData]; - [self.collectionView.footer endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.rankArray removeAllObjects]; - [self.collectionView reloadData]; - [self.collectionView.footer endRefreshing]; - - }]; -} - -#pragma mark - CollectionView DataSource && Delegate -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { - return 1; -} - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { - collectionView.footer.hidden = self.rankArray.count == 0; - return self.rankArray.count; -} - -- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { - return CGSizeMake(SCREEN_WIDTH/3-1, SCREEN_WIDTH/3-1); -} - -- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - RankCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RankCell" forIndexPath:indexPath]; - Rank *rank = [self.rankArray objectAtIndex:indexPath.row]; - NSURL *imageURL = [NSURL URLWithString:rank.img_url]; - [cell.imageView setImageWithURL:imageURL usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - return cell; -} - -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - NSMutableArray *photoArray = [NSMutableArray array]; - for (Rank *rank in self.rankArray) { - MWPhoto *photo = [MWPhoto photoWithURL:[NSURL URLWithString:rank.img_url]]; - photo.caption = rank.topic_title; - [photoArray addObject:photo]; - } - MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithPhotos:photoArray]; - browser.alwaysShowControls = YES; - [browser setCurrentPhotoIndex:indexPath.row]; - [self.navigationController pushViewController:browser animated:YES]; -} - -@end diff --git a/Meizi/Result.h b/Meizi/Result.h deleted file mode 100644 index ac00037..0000000 --- a/Meizi/Result.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Result.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface Result : NSObject - -@property (nonatomic, copy) NSString *c_head_url; -@property (nonatomic, copy) NSString *c_people_url; -@property (nonatomic, assign) NSInteger id; -@property (nonatomic, copy) NSString *c_head_original_url; -@property (nonatomic, copy) NSString *c_user_district; -@property (nonatomic, assign) long long create_time; -@property (nonatomic, copy) NSString *c_user_id; -@property (nonatomic, assign) NSInteger topic_n; -@property (nonatomic, copy) NSString *c_nick_name; - -@end diff --git a/Meizi/Result.m b/Meizi/Result.m deleted file mode 100644 index 556e69a..0000000 --- a/Meizi/Result.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// Result.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "Result.h" - -@implementation Result - -@end diff --git a/Meizi/ResultTableViewCell.h b/Meizi/ResultTableViewCell.h deleted file mode 100644 index daad7d2..0000000 --- a/Meizi/ResultTableViewCell.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ResultTableViewCell.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface ResultTableViewCell : UITableViewCell - -@property (weak, nonatomic) IBOutlet UIImageView *avatarImageView; -@property (weak, nonatomic) IBOutlet UILabel *nicknameLabel; -@property (weak, nonatomic) IBOutlet UILabel *idLabel; -@property (weak, nonatomic) IBOutlet UILabel *hometownLabel; - -@end diff --git a/Meizi/ResultTableViewCell.m b/Meizi/ResultTableViewCell.m deleted file mode 100644 index 5211ba9..0000000 --- a/Meizi/ResultTableViewCell.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// ResultTableViewCell.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "ResultTableViewCell.h" - -@implementation ResultTableViewCell - -- (void)awakeFromNib { - self.avatarImageView.layer.masksToBounds = YES; - self.avatarImageView.layer.cornerRadius = 4.0; -} - -@end diff --git a/Meizi/SearchRequest.h b/Meizi/SearchRequest.h deleted file mode 100644 index 6ee4844..0000000 --- a/Meizi/SearchRequest.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// SearchRequest.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface SearchRequest : YTKRequest - -- (instancetype)initWithPage:(NSInteger)page key:(NSString *)key; - -@end diff --git a/Meizi/SearchRequest.m b/Meizi/SearchRequest.m deleted file mode 100644 index a1d65f7..0000000 --- a/Meizi/SearchRequest.m +++ /dev/null @@ -1,43 +0,0 @@ -// -// SearchRequest.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "SearchRequest.h" - -@interface SearchRequest() - -@property (nonatomic) NSInteger page; -@property (nonatomic) NSString *key; - -@end - -@implementation SearchRequest - -- (instancetype)initWithPage:(NSInteger)page key:(NSString *)key { - self = [super init]; - if (self) { - _page = page; - _key = key?key:@""; - } - return self; -} - -- (NSString *)requestUrl { - return @"/api/dbmeinv.htm"; -} - -- (YTKRequestMethod)requestMethod { - return YTKRequestMethodPost; -} - -- (id)requestArgument { - return @{@"m": @"topic_users", - @"pageIndex": @(_page), - @"key": _key}; -} - -@end diff --git a/Meizi/SearchViewController.h b/Meizi/SearchViewController.h deleted file mode 100644 index 51e4e11..0000000 --- a/Meizi/SearchViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// SearchViewController.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface SearchViewController : UIViewController - -@property (weak, nonatomic) IBOutlet UISearchBar *searchBar; -@property (weak, nonatomic) IBOutlet UITableView *tableView; - -@end diff --git a/Meizi/SearchViewController.m b/Meizi/SearchViewController.m deleted file mode 100644 index 9d48838..0000000 --- a/Meizi/SearchViewController.m +++ /dev/null @@ -1,152 +0,0 @@ -// -// SearchViewController.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "SearchViewController.h" -#import "WebViewController.h" -#import "ResultTableViewCell.h" -#import "SearchRequest.h" -#import "Result.h" - -@interface SearchViewController () - -@property (nonatomic, assign) NSInteger page; -@property (nonatomic, copy) NSString *key; -@property (nonatomic, strong) NSMutableArray *resultArray; - -@end - -@implementation SearchViewController - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - _page = 1; - _resultArray = [[NSMutableArray alloc] init]; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self setupRefreshHeaderAndFooter]; - [self refreshResult]; -} - -- (void)setupRefreshHeaderAndFooter { - MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshResult)]; - MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreResult)]; - header.autoChangeAlpha = YES; - footer.automaticallyRefresh = NO; - self.tableView.header = header; - self.tableView.footer = footer; -} - -- (void)refreshResult { - self.page = 1; - SearchRequest *request = [[SearchRequest alloc] initWithPage:self.page key:self.key]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - [self.resultArray removeAllObjects]; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *resultArray = [Result objectArrayWithKeyValuesArray:data]; - - [self.resultArray addObjectsFromArray:resultArray]; - [self.tableView reloadData]; - [self.tableView.header endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.resultArray removeAllObjects]; - [self.tableView reloadData]; - [self.tableView.header endRefreshing]; - - }]; -} - -- (void)loadMoreResult { - SearchRequest *request = [[SearchRequest alloc] initWithPage:self.page+1 key:self.key]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - self.page++; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *resultArray = [Result objectArrayWithKeyValuesArray:data]; - - [self.resultArray addObjectsFromArray:resultArray]; - [self.tableView reloadData]; - [self.tableView.footer endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.resultArray removeAllObjects]; - [self.tableView reloadData]; - [self.tableView.footer endRefreshing]; - - }]; -} - -#pragma mark - TableView DataSource && Delegate -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - tableView.footer.hidden = self.resultArray.count == 0; - return self.resultArray.count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - ResultTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ResultCell" forIndexPath:indexPath]; - Result *result = self.resultArray[indexPath.row]; - [cell.avatarImageView setImageWithURL:[NSURL URLWithString:result.c_head_url] - usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - cell.nicknameLabel.text = result.c_nick_name; - cell.idLabel.text = result.c_user_id; - cell.hometownLabel.text = result.c_user_district; - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [tableView deselectRowAtIndexPath:indexPath animated:YES]; - Result *result = [self.resultArray objectAtIndex:indexPath.row]; - NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/", DoubanPeopleURL, result.c_user_id]]; - [self performSegueWithIdentifier:@"toWebViewSection" sender:@{@"title": result.c_nick_name, - @"url": url}]; -} - -#pragma mark - SearchBar Delegate -- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - [_searchBar resignFirstResponder]; -} - -- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { - searchBar.showsCancelButton = YES; -} - -- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar { - searchBar.showsCancelButton = NO; -} - -- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { - searchBar.showsCancelButton = NO; - [searchBar resignFirstResponder]; -} - -- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { - self.key = searchText; - [self refreshResult]; -} - -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqualToString:@"toWebViewSection"]) { - WebViewController *webViewController = segue.destinationViewController; - webViewController.title = sender[@"title"]; - webViewController.url = sender[@"url"]; - } -} - -@end diff --git a/Meizi/Topic.h b/Meizi/Topic.h deleted file mode 100644 index b026ae7..0000000 --- a/Meizi/Topic.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// Topic.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface User : NSObject - -@property (nonatomic, copy) NSString *nick_name; -@property (nonatomic, copy) NSString *head_user; -@property (nonatomic, copy) NSString *people_url; -@property (nonatomic, copy) NSString *user_district; - -@end - -@interface Topic : NSObject - -@property (nonatomic, copy) NSString *topic_title; -@property (nonatomic, strong) User *user; -@property (nonatomic, copy) NSString *douban_group_id; -@property (nonatomic, assign) NSInteger douban_topic_id; -@property (nonatomic, copy) NSString *create_time; -@property (nonatomic, assign) NSInteger topic_id; - -@end \ No newline at end of file diff --git a/Meizi/Topic.m b/Meizi/Topic.m deleted file mode 100644 index fb32700..0000000 --- a/Meizi/Topic.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// Topic.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "Topic.h" - -@implementation Topic - -@end - -@implementation User - -@end diff --git a/Meizi/TopicRequest.h b/Meizi/TopicRequest.h deleted file mode 100644 index 3568444..0000000 --- a/Meizi/TopicRequest.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// TopicRequest.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface TopicRequest : YTKRequest - -- (instancetype)initWithPage:(NSInteger)page groupdID:(NSString *)groupID; - -@end diff --git a/Meizi/TopicRequest.m b/Meizi/TopicRequest.m deleted file mode 100644 index c227931..0000000 --- a/Meizi/TopicRequest.m +++ /dev/null @@ -1,43 +0,0 @@ -// -// TopicRequest.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "TopicRequest.h" - -@interface TopicRequest() - -@property (nonatomic) NSInteger page; -@property (nonatomic) NSString *groupID; - -@end - -@implementation TopicRequest - -- (instancetype)initWithPage:(NSInteger)page groupdID:(NSString *)groupID { - self = [super init]; - if (self) { - _page = page; - _groupID = groupID?groupID:@""; - } - return self; -} - -- (NSString *)requestUrl { - return @"/api/dbmeinv.htm"; -} - -- (YTKRequestMethod)requestMethod { - return YTKRequestMethodPost; -} - -- (id)requestArgument { - return @{@"m": @"topics", - @"pageIndex": @(_page), - @"groupId": _groupID}; -} - -@end diff --git a/Meizi/TopicTableViewCell.h b/Meizi/TopicTableViewCell.h deleted file mode 100644 index e9b78c2..0000000 --- a/Meizi/TopicTableViewCell.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// TopicTableViewCell.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface TopicTableViewCell : UITableViewCell - -@property (weak, nonatomic) IBOutlet UILabel *titleLabel; -@property (weak, nonatomic) IBOutlet UIImageView *avatarImageView; -@property (weak, nonatomic) IBOutlet UILabel *usernameLabel; -@property (weak, nonatomic) IBOutlet UILabel *timeLabel; - -@end diff --git a/Meizi/TopicTableViewCell.m b/Meizi/TopicTableViewCell.m deleted file mode 100644 index 6f29aa7..0000000 --- a/Meizi/TopicTableViewCell.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// TopicTableViewCell.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "TopicTableViewCell.h" - -@implementation TopicTableViewCell - -- (void)awakeFromNib { - self.avatarImageView.layer.masksToBounds = YES; - self.avatarImageView.layer.cornerRadius = CGRectGetWidth(self.avatarImageView.frame)/2; -} - -@end diff --git a/Meizi/TopicViewController.h b/Meizi/TopicViewController.h deleted file mode 100644 index 471c822..0000000 --- a/Meizi/TopicViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// TopicViewController.h -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface TopicViewController : UIViewController - -@property (nonatomic, copy) NSString *groupID; -@property (weak, nonatomic) IBOutlet UITableView *tableView; - -@end diff --git a/Meizi/TopicViewController.m b/Meizi/TopicViewController.m deleted file mode 100644 index 962d97b..0000000 --- a/Meizi/TopicViewController.m +++ /dev/null @@ -1,132 +0,0 @@ -// -// TopicViewController.m -// Meizi -// -// Created by Sunnyyoung on 15/7/15. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "TopicViewController.h" -#import "WebViewController.h" -#import "TopicTableViewCell.h" -#import "TopicRequest.h" -#import "Topic.h" - -@interface TopicViewController () - -@property (nonatomic, assign) NSInteger page; -@property (nonatomic, strong) NSMutableArray *topicArray; - -@end - -@implementation TopicViewController - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - _page = 1; - _topicArray = [[NSMutableArray alloc] init]; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - [self setupRefreshHeaderAndFooter]; -} - -- (void)setupRefreshHeaderAndFooter { - MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(refreshTopic)]; - MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreTopic)]; - header.autoChangeAlpha = YES; - footer.automaticallyRefresh = NO; - self.tableView.header = header; - self.tableView.footer = footer; - [self.tableView.header beginRefreshing]; -} - -- (void)refreshTopic { - self.page = 1; - TopicRequest *request = [[TopicRequest alloc] initWithPage:self.page groupdID:self.groupID]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - [self.topicArray removeAllObjects]; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *topicArray = [Topic objectArrayWithKeyValuesArray:data]; - - [self.topicArray addObjectsFromArray:topicArray]; - [self.tableView reloadData]; - [self.tableView.header endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.topicArray removeAllObjects]; - [self.tableView reloadData]; - [self.tableView.header endRefreshing]; - - }]; -} - -- (void)loadMoreTopic { - TopicRequest *request = [[TopicRequest alloc] initWithPage:self.page+1 groupdID:self.groupID]; - [request startWithCompletionBlockWithSuccess:^(YTKBaseRequest *request) { - - self.page++; - NSDictionary *data = [request.responseJSONObject objectForKey:@"data"]; - NSArray *topicArray = [Topic objectArrayWithKeyValuesArray:data]; - - [self.topicArray addObjectsFromArray:topicArray]; - [self.tableView reloadData]; - [self.tableView.footer endRefreshing]; - - } failure:^(YTKBaseRequest *request) { - - [self.topicArray removeAllObjects]; - [self.tableView reloadData]; - [self.tableView.footer endRefreshing]; - - }]; -} - -#pragma mark - TableView DataSource && Delegate -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - tableView.footer.hidden = self.topicArray.count == 0; - return self.topicArray.count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - TopicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TopicCell" forIndexPath:indexPath]; - Topic *topic = [self.topicArray objectAtIndex:indexPath.row]; - cell.titleLabel.text = topic.topic_title; - cell.usernameLabel.text = topic.user.nick_name; - cell.timeLabel.text = topic.create_time; - [cell.avatarImageView setImageWithURL:[NSURL URLWithString:topic.user.head_user] - placeholderImage:[UIImage imageNamed:@"Avatar"] - usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [tableView deselectRowAtIndexPath:indexPath animated:YES]; - Topic *topic = [self.topicArray objectAtIndex:indexPath.row]; - NSString *referer = [DoubanGroupURL stringByAppendingString:topic.douban_group_id]; - NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/", DoubanTopicURL, @(topic.douban_topic_id)]]; - [self performSegueWithIdentifier:@"toWebViewSection" sender:@{@"title": topic.topic_title, - @"referer": referer, - @"url": url}]; -} - -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqualToString:@"toWebViewSection"]) { - WebViewController *webViewController = segue.destinationViewController; - webViewController.title = sender[@"title"]; - webViewController.url = sender[@"url"]; - webViewController.referer = sender[@"referer"]; - } -} - -@end diff --git a/Meizi/WebViewController.h b/Meizi/WebViewController.h deleted file mode 100644 index af10d8a..0000000 --- a/Meizi/WebViewController.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// WebViewController.h -// Meizi -// -// Created by Sunnyyoung on 15/7/19. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import - -@interface WebViewController : UIViewController - -@property (weak, nonatomic) IBOutlet UIBarButtonItem *goBackButton; -@property (weak, nonatomic) IBOutlet UIBarButtonItem *goForwardButton; - -@property (nonatomic, strong) NSURL *url; -@property (nonatomic, copy) NSString *referer; -@property (weak, nonatomic) IBOutlet UIWebView *webView; - -@end diff --git a/Meizi/WebViewController.m b/Meizi/WebViewController.m deleted file mode 100644 index b6bf7e8..0000000 --- a/Meizi/WebViewController.m +++ /dev/null @@ -1,77 +0,0 @@ -// -// WebViewController.m -// Meizi -// -// Created by Sunnyyoung on 15/7/19. -// Copyright (c) 2015年 Sunnyyoung. All rights reserved. -// - -#import "WebViewController.h" - -@interface WebViewController () - -@end - -@implementation WebViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - self.webView.scrollView.contentInset = UIEdgeInsetsMake(0, 0, 44, 0); - [SVProgressHUD showWithStatus:@"加载中"]; - [self.webView loadRequest:[NSURLRequest requestWithURL:self.url]]; -} - -- (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; - [SVProgressHUD dismiss]; -} - -#pragma mark UIWebView Delegate -- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { - NSLog(@"%@", request.URL.absoluteString); - NSDictionary *headers = [request allHTTPHeaderFields]; - BOOL hasReferer = [headers objectForKey:@"Referer"] != nil; - if (!hasReferer) { - // relaunch with a modified request - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - dispatch_async(dispatch_get_main_queue(), ^{ - NSURL *url = [request URL]; - NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url]; - [request setHTTPMethod:@"GET"]; - [request setValue:weakSelf.referer?:@"" forHTTPHeaderField: @"Referer"]; - [weakSelf.webView loadRequest:request]; - }); - }); - return NO; - } else { - return YES; - } -} - -- (void)webViewDidStartLoad:(UIWebView *)webView { - [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; -} - -- (void)webViewDidFinishLoad:(UIWebView *)webView { - [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; - //Enable the ToolBar buttons - if (!self.goBackButton.isEnabled || !self.goForwardButton.isEnabled) { - self.goBackButton.enabled = YES; - self.goForwardButton.enabled = YES; - } - NSString *htmlString = [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"]; - if ([htmlString containsString:@"你想要的东西不在这儿"]) { - [self.navigationController popViewControllerAnimated:YES]; - [SVProgressHUD showErrorWithStatus:@"帖子已经被删除啦~"]; - } else { - [SVProgressHUD dismiss]; - } -} - -- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { - [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; - [SVProgressHUD showErrorWithStatus:@"加载失败"]; -} - -@end diff --git a/Podfile b/Podfile index 4912455..35e1875 100644 --- a/Podfile +++ b/Podfile @@ -2,6 +2,7 @@ platform :ios, '8.0' inhibit_all_warnings! pod 'AFNetworking' +pod 'hpple' pod 'MJRefresh' pod 'MJExtension' pod 'SDWebImage' diff --git a/Podfile.lock b/Podfile.lock index b480a12..81903c8 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,50 +1,52 @@ PODS: - AFDownloadRequestOperation (2.0.1): - AFNetworking (~> 2.0) - - AFNetworking (2.5.4): - - AFNetworking/NSURLConnection (= 2.5.4) - - AFNetworking/NSURLSession (= 2.5.4) - - AFNetworking/Reachability (= 2.5.4) - - AFNetworking/Security (= 2.5.4) - - AFNetworking/Serialization (= 2.5.4) - - AFNetworking/UIKit (= 2.5.4) - - AFNetworking/NSURLConnection (2.5.4): + - AFNetworking (2.6.3): + - AFNetworking/NSURLConnection (= 2.6.3) + - AFNetworking/NSURLSession (= 2.6.3) + - AFNetworking/Reachability (= 2.6.3) + - AFNetworking/Security (= 2.6.3) + - AFNetworking/Serialization (= 2.6.3) + - AFNetworking/UIKit (= 2.6.3) + - AFNetworking/NSURLConnection (2.6.3): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/NSURLSession (2.5.4): + - AFNetworking/NSURLSession (2.6.3): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/Reachability (2.5.4) - - AFNetworking/Security (2.5.4) - - AFNetworking/Serialization (2.5.4) - - AFNetworking/UIKit (2.5.4): + - AFNetworking/Reachability (2.6.3) + - AFNetworking/Security (2.6.3) + - AFNetworking/Serialization (2.6.3) + - AFNetworking/UIKit (2.6.3): - AFNetworking/NSURLConnection - AFNetworking/NSURLSession - DACircularProgress (2.3.1) - HMSegmentedControl (1.5.2) - - MBProgressHUD (0.9.1) - - MJExtension (2.5.2) - - MJRefresh (2.3.1) + - hpple (0.2.0) + - MBProgressHUD (0.9.2) + - MJExtension (3.0.10) + - MJRefresh (3.1.0) - MWPhotoBrowser (2.1.1): - DACircularProgress (~> 2.3) - MBProgressHUD (~> 0.9) - SDWebImage (!= 3.7.2, ~> 3.7) - NHBalancedFlowLayout (0.2) - - SDWebImage (3.7.3): - - SDWebImage/Core (= 3.7.3) - - SDWebImage/Core (3.7.3) + - SDWebImage (3.7.5): + - SDWebImage/Core (= 3.7.5) + - SDWebImage/Core (3.7.5) - SVProgressHUD (1.1.3) - UIActivityIndicator-for-SDWebImage (1.2): - SDWebImage (~> 3.7) - - YTKNetwork (0.5.0): + - YTKNetwork (0.6.0): - AFDownloadRequestOperation (~> 2.0) - AFNetworking (~> 2.0) DEPENDENCIES: - AFNetworking - HMSegmentedControl + - hpple - MJExtension - MJRefresh - MWPhotoBrowser @@ -56,17 +58,18 @@ DEPENDENCIES: SPEC CHECKSUMS: AFDownloadRequestOperation: 748a1643423e1ddb23f2178f778087d4f0ae8ac7 - AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e + AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 DACircularProgress: 4dd437c0fc3da5161cb289e07ac449493d41db71 HMSegmentedControl: 83b9686022d2176fb6457d2bdb61e5d6393fed7d - MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad - MJExtension: 73e812aca0846e4a7b4d7aca34cfacf48d1f3310 - MJRefresh: fa22d5d753aaceb4e76232ce264cb2dca90b323f + hpple: 3b765f96fc2cd56ad1a49aef6f7be5cb2aa64b57 + MBProgressHUD: 1569cf7ace17a8bac47aabfbb8580a49690386d1 + MJExtension: d86aacb740c87519d20e3cca55b6fa4be6cc7548 + MJRefresh: 743e6404967d1c2c688472ea3ecfde247d872db4 MWPhotoBrowser: ba0d0c09ffda3a7ea10093518738c502c1c7141c NHBalancedFlowLayout: fd253023c6754e605acdb180d50123e582cc62bb - SDWebImage: 1d2b1a1efda1ade1b00b6f8498865f8ddedc8a84 + SDWebImage: 69c6303e3348fba97e03f65d65d4fbc26740f461 SVProgressHUD: 748080e4f36e603f6c02aec292664239df5279c1 UIActivityIndicator-for-SDWebImage: 7bf7ebbf0ed1747dedc0d6e949c4603a6d0f9e0c - YTKNetwork: 3f163c181ce5f03d52cf88f39d6757f46894280c + YTKNetwork: 988660d5fab310a55895239751ecfa74c3224a77 -COCOAPODS: 0.37.2 +COCOAPODS: 0.39.0 diff --git a/README.md b/README.md index 7f7dca2..85a2b5f 100644 --- a/README.md +++ b/README.md @@ -5,21 +5,12 @@ ##Discription 图片来源: -- ~~http://www.dbmeinv.com~~ **该网站API已被加密** +- http://www.dbmeinv.com - ~~http://www.dbmeizi.com~~ **该网站已挂掉** ##Update -- 2015-01-22 直接写死一种样式了,其他样式感觉不好看= =,支持横屏并改变Cell的大小 -- 2015-01-23 此App无法上架,增加**排行榜** -- 2015-02-15 **大更新** - 1. 全新接口 - 2. JSON数据格式的解析 - 3. 清除图片缓存优化 - 4. 细节优化 -- 2015-05-24 **网站挂掉,等待更新** -- 2015-07-14 **更新API,丰富内容** -- 2015-07-19 新的WebView显示内容 -- 2015-08-?? **API已被加密,等待更新** + +- 2016-02-20 采用传统HTML解析方式获取资源,暂时砍掉大部分功能,仅保留看妹子功能(大部分人的主要需求) ##Screen Shot ![](https://raw.githubusercontent.com/Sunnyyoung/Meizi/master/ScreenShot/One.png) @@ -56,5 +47,19 @@ cd Meizi pod install ``` +##History + +- 2015-01-22 直接写死一种样式了,其他样式感觉不好看= =,支持横屏并改变Cell的大小 +- 2015-01-23 此App无法上架,增加**排行榜** +- 2015-02-15 **大更新** + 1. 全新接口 + 2. JSON数据格式的解析 + 3. 清除图片缓存优化 + 4. 细节优化 +- 2015-05-24 **网站挂掉,等待更新** +- 2015-07-14 **更新API,丰富内容** +- 2015-07-19 新的WebView显示内容 +- 2015-08-?? **API已被加密,等待更新** + ##License The [MIT License](LICENSE).