diff --git a/Ash_AWord.xcodeproj/project.pbxproj b/Ash_AWord.xcodeproj/project.pbxproj index e0899cf..ce61ce6 100644 --- a/Ash_AWord.xcodeproj/project.pbxproj +++ b/Ash_AWord.xcodeproj/project.pbxproj @@ -34,6 +34,30 @@ A955109B1AC39E6A0006D16F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A95510991AC39E6A0006D16F /* Main.storyboard */; }; A955109D1AC39E6A0006D16F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A955109C1AC39E6A0006D16F /* Images.xcassets */; }; A95510A01AC39E6A0006D16F /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A955109E1AC39E6A0006D16F /* LaunchScreen.xib */; }; + A9617A4F1ACC0D0F0024AE4A /* NoteViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A9617A4E1ACC0D0F0024AE4A /* NoteViewModel.m */; }; + A9617A541ACC27860024AE4A /* SetUpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9617A521ACC27860024AE4A /* SetUpViewController.m */; }; + A9617A551ACC27860024AE4A /* SetUpViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9617A531ACC27860024AE4A /* SetUpViewController.xib */; }; + A9617A581ACC2EBC0024AE4A /* mine-setting-icon-click@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9617A561ACC2EBC0024AE4A /* mine-setting-icon-click@2x.png */; }; + A9617A591ACC2EBC0024AE4A /* mine-setting-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9617A571ACC2EBC0024AE4A /* mine-setting-icon@2x.png */; }; + A97559A01ACB88FE004ADA42 /* AWordDefault.m in Sources */ = {isa = PBXBuildFile; fileRef = A975599F1ACB88FE004ADA42 /* AWordDefault.m */; }; + A97559A31ACB8CE0004ADA42 /* AWordUser.m in Sources */ = {isa = PBXBuildFile; fileRef = A97559A21ACB8CE0004ADA42 /* AWordUser.m */; }; + A97559A51ACB9748004ADA42 /* setup-head-default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559A41ACB9748004ADA42 /* setup-head-default@2x.png */; }; + A97559A81ACB9DE4004ADA42 /* navigationButtonPublish@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559A61ACB9DE4004ADA42 /* navigationButtonPublish@2x.png */; }; + A97559A91ACB9DE4004ADA42 /* navigationButtonPublishClick@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559A71ACB9DE4004ADA42 /* navigationButtonPublishClick@2x.png */; }; + A97559AC1ACB9DF0004ADA42 /* navigationButtonRefresh@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559AA1ACB9DF0004ADA42 /* navigationButtonRefresh@2x.png */; }; + A97559AD1ACB9DF0004ADA42 /* navigationButtonRefreshClick@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559AB1ACB9DF0004ADA42 /* navigationButtonRefreshClick@2x.png */; }; + A97559B21ACBC683004ADA42 /* NotePublishViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A97559B01ACBC683004ADA42 /* NotePublishViewController.m */; }; + A97559B31ACBC683004ADA42 /* NotePublishViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A97559B11ACBC683004ADA42 /* NotePublishViewController.xib */; }; + A97559B71ACBD99E004ADA42 /* UIPlaceHolderTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = A97559B61ACBD99E004ADA42 /* UIPlaceHolderTextView.m */; }; + A97559BF1ACBE6C6004ADA42 /* NotePublishViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A97559BE1ACBE6C6004ADA42 /* NotePublishViewModel.m */; }; + A97559C41ACBEE99004ADA42 /* NoteTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A97559C21ACBEE99004ADA42 /* NoteTableViewCell.m */; }; + A97559C51ACBEE99004ADA42 /* NoteTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A97559C31ACBEE99004ADA42 /* NoteTableViewCell.xib */; }; + A97559CC1ACBF0BC004ADA42 /* btn_bad_clicked@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559C61ACBF0BC004ADA42 /* btn_bad_clicked@2x.png */; }; + A97559CD1ACBF0BC004ADA42 /* btn_bad@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559C71ACBF0BC004ADA42 /* btn_bad@2x.png */; }; + A97559CE1ACBF0BC004ADA42 /* btn_good_clicked@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559C81ACBF0BC004ADA42 /* btn_good_clicked@2x.png */; }; + A97559CF1ACBF0BC004ADA42 /* btn_good@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559C91ACBF0BC004ADA42 /* btn_good@2x.png */; }; + A97559D01ACBF0BC004ADA42 /* btn_share_clicked@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559CA1ACBF0BC004ADA42 /* btn_share_clicked@2x.png */; }; + A97559D11ACBF0BC004ADA42 /* btn_share@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559CB1ACBF0BC004ADA42 /* btn_share@2x.png */; }; A97C54CD1AC8F10F0038818A /* BaseViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54BD1AC8F10F0038818A /* BaseViewModel.m */; }; A97C54CF1AC8F10F0038818A /* NSString+HXAddtions.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54C11AC8F10F0038818A /* NSString+HXAddtions.m */; }; A97C54D01AC8F10F0038818A /* PropertyEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54C31AC8F10F0038818A /* PropertyEntity.m */; }; @@ -130,6 +154,38 @@ A955109F1AC39E6A0006D16F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; A95510AA1AC39E6A0006D16F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A95510AB1AC39E6A0006D16F /* Ash_AWordTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Ash_AWordTests.m; sourceTree = ""; }; + A9617A4D1ACC0D0F0024AE4A /* NoteViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoteViewModel.h; sourceTree = ""; }; + A9617A4E1ACC0D0F0024AE4A /* NoteViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoteViewModel.m; sourceTree = ""; }; + A9617A511ACC27860024AE4A /* SetUpViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetUpViewController.h; sourceTree = ""; }; + A9617A521ACC27860024AE4A /* SetUpViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SetUpViewController.m; sourceTree = ""; }; + A9617A531ACC27860024AE4A /* SetUpViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SetUpViewController.xib; sourceTree = ""; }; + A9617A561ACC2EBC0024AE4A /* mine-setting-icon-click@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mine-setting-icon-click@2x.png"; sourceTree = ""; }; + A9617A571ACC2EBC0024AE4A /* mine-setting-icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mine-setting-icon@2x.png"; sourceTree = ""; }; + A975599E1ACB88FE004ADA42 /* AWordDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AWordDefault.h; sourceTree = ""; }; + A975599F1ACB88FE004ADA42 /* AWordDefault.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AWordDefault.m; sourceTree = ""; }; + A97559A11ACB8CE0004ADA42 /* AWordUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AWordUser.h; sourceTree = ""; }; + A97559A21ACB8CE0004ADA42 /* AWordUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AWordUser.m; sourceTree = ""; }; + A97559A41ACB9748004ADA42 /* setup-head-default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "setup-head-default@2x.png"; sourceTree = ""; }; + A97559A61ACB9DE4004ADA42 /* navigationButtonPublish@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "navigationButtonPublish@2x.png"; sourceTree = ""; }; + A97559A71ACB9DE4004ADA42 /* navigationButtonPublishClick@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "navigationButtonPublishClick@2x.png"; sourceTree = ""; }; + A97559AA1ACB9DF0004ADA42 /* navigationButtonRefresh@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "navigationButtonRefresh@2x.png"; sourceTree = ""; }; + A97559AB1ACB9DF0004ADA42 /* navigationButtonRefreshClick@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "navigationButtonRefreshClick@2x.png"; sourceTree = ""; }; + A97559AF1ACBC683004ADA42 /* NotePublishViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotePublishViewController.h; sourceTree = ""; }; + A97559B01ACBC683004ADA42 /* NotePublishViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotePublishViewController.m; sourceTree = ""; }; + A97559B11ACBC683004ADA42 /* NotePublishViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NotePublishViewController.xib; sourceTree = ""; }; + A97559B51ACBD99E004ADA42 /* UIPlaceHolderTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIPlaceHolderTextView.h; sourceTree = ""; }; + A97559B61ACBD99E004ADA42 /* UIPlaceHolderTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIPlaceHolderTextView.m; sourceTree = ""; }; + A97559BD1ACBE6C6004ADA42 /* NotePublishViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotePublishViewModel.h; sourceTree = ""; }; + A97559BE1ACBE6C6004ADA42 /* NotePublishViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotePublishViewModel.m; sourceTree = ""; }; + A97559C11ACBEE99004ADA42 /* NoteTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoteTableViewCell.h; sourceTree = ""; }; + A97559C21ACBEE99004ADA42 /* NoteTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoteTableViewCell.m; sourceTree = ""; }; + A97559C31ACBEE99004ADA42 /* NoteTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NoteTableViewCell.xib; sourceTree = ""; }; + A97559C61ACBF0BC004ADA42 /* btn_bad_clicked@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_bad_clicked@2x.png"; sourceTree = ""; }; + A97559C71ACBF0BC004ADA42 /* btn_bad@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_bad@2x.png"; sourceTree = ""; }; + A97559C81ACBF0BC004ADA42 /* btn_good_clicked@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_good_clicked@2x.png"; sourceTree = ""; }; + A97559C91ACBF0BC004ADA42 /* btn_good@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_good@2x.png"; sourceTree = ""; }; + A97559CA1ACBF0BC004ADA42 /* btn_share_clicked@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_share_clicked@2x.png"; sourceTree = ""; }; + A97559CB1ACBF0BC004ADA42 /* btn_share@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_share@2x.png"; sourceTree = ""; }; A97C54BC1AC8F10F0038818A /* BaseViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewModel.h; sourceTree = ""; }; A97C54BD1AC8F10F0038818A /* BaseViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewModel.m; sourceTree = ""; }; A97C54C01AC8F10F0038818A /* NSString+HXAddtions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+HXAddtions.h"; sourceTree = ""; }; @@ -323,9 +379,61 @@ name = "Supporting Files"; sourceTree = ""; }; + A9617A501ACC274C0024AE4A /* My */ = { + isa = PBXGroup; + children = ( + A9617A511ACC27860024AE4A /* SetUpViewController.h */, + A9617A521ACC27860024AE4A /* SetUpViewController.m */, + A9617A531ACC27860024AE4A /* SetUpViewController.xib */, + ); + path = My; + sourceTree = ""; + }; + A97559AE1ACBC615004ADA42 /* Note */ = { + isa = PBXGroup; + children = ( + A97559AF1ACBC683004ADA42 /* NotePublishViewController.h */, + A97559B01ACBC683004ADA42 /* NotePublishViewController.m */, + A97559B11ACBC683004ADA42 /* NotePublishViewController.xib */, + ); + path = Note; + sourceTree = ""; + }; + A97559B41ACBD99E004ADA42 /* UIPlaceHolderTextView */ = { + isa = PBXGroup; + children = ( + A97559B51ACBD99E004ADA42 /* UIPlaceHolderTextView.h */, + A97559B61ACBD99E004ADA42 /* UIPlaceHolderTextView.m */, + ); + path = UIPlaceHolderTextView; + sourceTree = ""; + }; + A97559BC1ACBE6B7004ADA42 /* Note */ = { + isa = PBXGroup; + children = ( + A97559BD1ACBE6C6004ADA42 /* NotePublishViewModel.h */, + A97559BE1ACBE6C6004ADA42 /* NotePublishViewModel.m */, + A9617A4D1ACC0D0F0024AE4A /* NoteViewModel.h */, + A9617A4E1ACC0D0F0024AE4A /* NoteViewModel.m */, + ); + path = Note; + sourceTree = ""; + }; + A97559C01ACBEE71004ADA42 /* Note */ = { + isa = PBXGroup; + children = ( + A97559C11ACBEE99004ADA42 /* NoteTableViewCell.h */, + A97559C21ACBEE99004ADA42 /* NoteTableViewCell.m */, + A97559C31ACBEE99004ADA42 /* NoteTableViewCell.xib */, + ); + path = Note; + sourceTree = ""; + }; A97C54B71AC8F0370038818A /* ViewControllers */ = { isa = PBXGroup; children = ( + A9617A501ACC274C0024AE4A /* My */, + A97559AE1ACBC615004ADA42 /* Note */, A97DBE2F1ACAE0F100705682 /* Login */, A98F98671ACA2F27007C4594 /* Common */, A9FAD41E1AC92293007ADC10 /* Main */, @@ -336,6 +444,7 @@ A97C54B81AC8F0370038818A /* ViewModels */ = { isa = PBXGroup; children = ( + A97559BC1ACBE6B7004ADA42 /* Note */, A9FAD4331AC925AC007ADC10 /* LoginViewModel.h */, A9FAD4341AC925AC007ADC10 /* LoginViewModel.m */, ); @@ -345,6 +454,7 @@ A97C54B91AC8F0370038818A /* Views */ = { isa = PBXGroup; children = ( + A97559C01ACBEE71004ADA42 /* Note */, ); path = Views; sourceTree = ""; @@ -391,6 +501,10 @@ isa = PBXGroup; children = ( A97C54D61AC8FB6C0038818A /* Common.h */, + A975599E1ACB88FE004ADA42 /* AWordDefault.h */, + A975599F1ACB88FE004ADA42 /* AWordDefault.m */, + A97559A11ACB8CE0004ADA42 /* AWordUser.h */, + A97559A21ACB8CE0004ADA42 /* AWordUser.m */, ); path = Config; sourceTree = ""; @@ -398,6 +512,7 @@ A97C54D91AC9014D0038818A /* Vender */ = { isa = PBXGroup; children = ( + A97559B41ACBD99E004ADA42 /* UIPlaceHolderTextView */, A98F98461ACA29B5007C4594 /* UMSocial_Sdk_Extra_Frameworks */, A9B4E39B1AC9908E00A1DBDF /* UMAnalytics_Sdk_3.4.6 */, A97C54E31AC933AD0038818A /* UMSocial_Sdk_4.2.1 */, @@ -429,6 +544,19 @@ A97C54E21AC91FD70038818A /* Resource */ = { isa = PBXGroup; children = ( + A9617A561ACC2EBC0024AE4A /* mine-setting-icon-click@2x.png */, + A9617A571ACC2EBC0024AE4A /* mine-setting-icon@2x.png */, + A97559C61ACBF0BC004ADA42 /* btn_bad_clicked@2x.png */, + A97559C71ACBF0BC004ADA42 /* btn_bad@2x.png */, + A97559C81ACBF0BC004ADA42 /* btn_good_clicked@2x.png */, + A97559C91ACBF0BC004ADA42 /* btn_good@2x.png */, + A97559CA1ACBF0BC004ADA42 /* btn_share_clicked@2x.png */, + A97559CB1ACBF0BC004ADA42 /* btn_share@2x.png */, + A97559AA1ACB9DF0004ADA42 /* navigationButtonRefresh@2x.png */, + A97559AB1ACB9DF0004ADA42 /* navigationButtonRefreshClick@2x.png */, + A97559A61ACB9DE4004ADA42 /* navigationButtonPublish@2x.png */, + A97559A71ACB9DE4004ADA42 /* navigationButtonPublishClick@2x.png */, + A97559A41ACB9748004ADA42 /* setup-head-default@2x.png */, A97DBE4D1ACAED4900705682 /* camera-close-select@2x.png */, A97DBE471ACAE7F600705682 /* smalliconWeixin@2x.png */, A97DBE451ACAE7B500705682 /* iconWeixin@2x.png */, @@ -682,17 +810,23 @@ A9FAD4321AC923FC007ADC10 /* MyViewController.xib in Resources */, A93441FF1ACA919F00A6B233 /* tabbarVoice@2x.png in Resources */, A93441FA1ACA919500A6B233 /* tabbarQuotation-dark@2x.png in Resources */, + A97559D01ACBF0BC004ADA42 /* btn_share_clicked@2x.png in Resources */, A955109B1AC39E6A0006D16F /* Main.storyboard in Resources */, + A97559A51ACB9748004ADA42 /* setup-head-default@2x.png in Resources */, A97DBE3F1ACAE29E00705682 /* Icon.png in Resources */, A97DBE3D1ACAE29E00705682 /* Icon-Small.png in Resources */, A93441ED1ACA8C8F00A6B233 /* defaultUserIcon.png in Resources */, + A97559CF1ACBF0BC004ADA42 /* btn_good@2x.png in Resources */, + A97559CC1ACBF0BC004ADA42 /* btn_bad_clicked@2x.png in Resources */, A97DBE461ACAE7B500705682 /* iconWeixin@2x.png in Resources */, A97C55071AC933AD0038818A /* UMSShareListController.xib in Resources */, A93441EE1ACA8C8F00A6B233 /* defaultUserIcon@2x.png in Resources */, + A97559AC1ACB9DF0004ADA42 /* navigationButtonRefresh@2x.png in Resources */, A97C54FE1AC933AD0038818A /* UMSocialLocalizable.strings in Resources */, A93441E91ACA8AD200A6B233 /* Profile_filter_ImageIcon@2x.png in Resources */, A97C55041AC933AD0038818A /* UMShareEditViewControlleriPad.xib in Resources */, A98F98541ACA29B5007C4594 /* TencentOpenApi_IOS_Bundle.bundle in Resources */, + A9617A591ACC2EBC0024AE4A /* mine-setting-icon@2x.png in Resources */, A95510A01AC39E6A0006D16F /* LaunchScreen.xib in Resources */, A93442041ACA981D00A6B233 /* Default@2x.png in Resources */, A97DBE401ACAE29E00705682 /* Icon@2x.png in Resources */, @@ -704,17 +838,27 @@ A97DBE4C1ACAEBE300705682 /* first-login-sina@2x.png in Resources */, A9FAD4281AC922BE007ADC10 /* NoteViewController.xib in Resources */, A93441E61ACA8AC400A6B233 /* Profile_filter_contentIconClick@2x.png in Resources */, + A97559C51ACBEE99004ADA42 /* NoteTableViewCell.xib in Resources */, + A9617A551ACC27860024AE4A /* SetUpViewController.xib in Resources */, + A97559D11ACBF0BC004ADA42 /* btn_share@2x.png in Resources */, A93441E11ACA89AA00A6B233 /* Profile_filter_voiceIcon@2x.png in Resources */, A97C55031AC933AD0038818A /* UMShareEditViewController.xib in Resources */, A97DBE4E1ACAED4900705682 /* camera-close-select@2x.png in Resources */, + A97559A91ACB9DE4004ADA42 /* navigationButtonPublishClick@2x.png in Resources */, A93441E21ACA89AA00A6B233 /* Profile_filter_voiceIconClick@2x.png in Resources */, + A97559A81ACB9DE4004ADA42 /* navigationButtonPublish@2x.png in Resources */, + A97559CE1ACBF0BC004ADA42 /* btn_good_clicked@2x.png in Resources */, A97DBE3C1ACAE29E00705682 /* Icon-Small-50@2x.png in Resources */, A97C55061AC933AD0038818A /* UMSnsAccountViewController.xib in Resources */, + A97559CD1ACBF0BC004ADA42 /* btn_bad@2x.png in Resources */, A93441F71ACA918100A6B233 /* tabbarSetup@2x.png in Resources */, A97C55011AC933AD0038818A /* UMSCommentInputController.xib in Resources */, + A97559AD1ACB9DF0004ADA42 /* navigationButtonRefreshClick@2x.png in Resources */, A93441F81ACA918100A6B233 /* tabbarSetupClick@2x.png in Resources */, A93441FE1ACA919F00A6B233 /* tabbarVoice-dark@2x.png in Resources */, + A9617A581ACC2EBC0024AE4A /* mine-setting-icon-click@2x.png in Resources */, A93441E51ACA8AC400A6B233 /* Profile_filter_contentIcon@2x.png in Resources */, + A97559B31ACBC683004ADA42 /* NotePublishViewController.xib in Resources */, A9FAD4231AC922A5007ADC10 /* MainViewController.xib in Resources */, A93441F61ACA918100A6B233 /* tabbarSetup-dark@2x.png in Resources */, A97DBE421ACAE4E300705682 /* first-login-icon.png in Resources */, @@ -770,21 +914,29 @@ buildActionMask = 2147483647; files = ( A9FAD4271AC922BE007ADC10 /* NoteViewController.m in Sources */, + A97559A01ACB88FE004ADA42 /* AWordDefault.m in Sources */, A97C54D31AC8F10F0038818A /* XiaoYuAPIClient.m in Sources */, + A97559C41ACBEE99004ADA42 /* NoteTableViewCell.m in Sources */, A9FAD4311AC923FC007ADC10 /* MyViewController.m in Sources */, + A97559BF1ACBE6C6004ADA42 /* NotePublishViewModel.m in Sources */, + A97559B21ACBC683004ADA42 /* NotePublishViewController.m in Sources */, A97C54DD1AC901980038818A /* MBProgressHUD+Util.m in Sources */, A97DBE331ACAE10800705682 /* LoginViewController.m in Sources */, + A97559A31ACB8CE0004ADA42 /* AWordUser.m in Sources */, A95510981AC39E6A0006D16F /* ViewController.m in Sources */, A98F986B1ACA2FA9007C4594 /* BaseRefreshViewController.m in Sources */, + A9617A541ACC27860024AE4A /* SetUpViewController.m in Sources */, A97C54D21AC8F10F0038818A /* AFgzipResponseSerializer.m in Sources */, A9FAD4221AC922A5007ADC10 /* MainViewController.m in Sources */, A9FAD42C1AC923E2007ADC10 /* MessageViewController.m in Sources */, A97C54CD1AC8F10F0038818A /* BaseViewModel.m in Sources */, + A9617A4F1ACC0D0F0024AE4A /* NoteViewModel.m in Sources */, A97C54CF1AC8F10F0038818A /* NSString+HXAddtions.m in Sources */, A95510951AC39E6A0006D16F /* AppDelegate.m in Sources */, A97C54D11AC8F10F0038818A /* RequireEngine.m in Sources */, A97C54D01AC8F10F0038818A /* PropertyEntity.m in Sources */, A93441DE1ACA311700A6B233 /* Ash_UIUtil.m in Sources */, + A97559B71ACBD99E004ADA42 /* UIPlaceHolderTextView.m in Sources */, A97C54D41AC8F10F0038818A /* XMFishBaseCode.m in Sources */, A97C54E11AC91DA10038818A /* CommonUtil.m in Sources */, A9FAD4351AC925AC007ADC10 /* LoginViewModel.m in Sources */, diff --git a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 3da2e4f..42ad4cb 100644 --- a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -22,7 +22,7 @@ @@ -73,13 +73,253 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "Ash_AWord/ViewControllers/Main/MyViewController.m" - timestampString = "449488902.786326" + filePath = "Ash_AWord/ViewControllers/Login/LoginViewController.m" + timestampString = "449549149.00937" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "109" - endingLineNumber = "109" - landmarkName = "-tableView:didSelectRowAtIndexPath:" + startingLineNumber = "80" + endingLineNumber = "80" + landmarkName = "-weixinLoginBtnClick:" + landmarkType = "5"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/Config/AWordDefault.h b/Ash_AWord/Config/AWordDefault.h new file mode 100644 index 0000000..6e679f8 --- /dev/null +++ b/Ash_AWord/Config/AWordDefault.h @@ -0,0 +1,32 @@ +// +// AWordDefault.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import + +@interface AWordDefault : NSObject + +//获取用户是否登录 ++(void)setIsLogin:(BOOL)isLogin; ++(BOOL)getIsLogin; + +//获取用户名 ++(void)setUserName:(NSString*)userName; ++(NSString*)getUserName; + +//获取uid ++(void)setUid:(NSString*)uid; ++(NSString*)getUid; + +//获取用户头像 ++(void)setUserAvatar:(NSString*)userAvatar; ++(NSString*)getUserAvatar; + +//获取用户性别 ++(void)setUserGender:(NSString*)userGender; ++(NSString*)getUserGender; +@end diff --git a/Ash_AWord/Config/AWordDefault.m b/Ash_AWord/Config/AWordDefault.m new file mode 100644 index 0000000..2cced1d --- /dev/null +++ b/Ash_AWord/Config/AWordDefault.m @@ -0,0 +1,64 @@ +// +// AWordDefault.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "AWordDefault.h" + +@implementation AWordDefault + ++(void)setIsLogin:(BOOL)isLogin +{ + [[NSUserDefaults standardUserDefaults] setBool:isLogin forKey:@"islogin"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(BOOL)getIsLogin +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:@"islogin"]; +} + ++(void)setUid:(NSString *)uid +{ + [[NSUserDefaults standardUserDefaults] setObject:uid forKey:@"uid"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUid +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"uid"]; +} + ++(void)setUserName:(NSString *)userName +{ + [[NSUserDefaults standardUserDefaults] setObject:userName forKey:@"username"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUserName +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"username"]; +} + ++(void)setUserAvatar:(NSString *)userAvatar +{ + [[NSUserDefaults standardUserDefaults] setObject:userAvatar forKey:@"useravatar"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUserAvatar +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"useravatar"]; + +} + ++(void)setUserGender:(NSString *)userGender +{ + [[NSUserDefaults standardUserDefaults] setObject:userGender forKey:@"usergender"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUserGender +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"usergender"]; + +} +@end diff --git a/Ash_AWord/Config/AWordUser.h b/Ash_AWord/Config/AWordUser.h new file mode 100644 index 0000000..17214b9 --- /dev/null +++ b/Ash_AWord/Config/AWordUser.h @@ -0,0 +1,20 @@ +// +// AWordUser.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import + +@interface AWordUser : NSObject + +@property (nonatomic, strong) NSString *uid; +@property (nonatomic, strong) NSString *userName; +@property (nonatomic, assign) BOOL isLogin; +@property (nonatomic, strong) NSString *userAvatar; +@property (nonatomic, strong) NSString* userGender; ++(AWordUser*)sharedInstance; + +@end diff --git a/Ash_AWord/Config/AWordUser.m b/Ash_AWord/Config/AWordUser.m new file mode 100644 index 0000000..e30f21c --- /dev/null +++ b/Ash_AWord/Config/AWordUser.m @@ -0,0 +1,53 @@ +// +// AWordUser.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "AWordUser.h" +static AWordUser *sharedObj = nil; +@implementation AWordUser + ++(AWordUser*)sharedInstance +{ + if (!sharedObj) + { + sharedObj = [[self alloc] init]; + sharedObj.uid = [AWordDefault getUid]; + sharedObj.isLogin = [AWordDefault getIsLogin]; + sharedObj.userName = [AWordDefault getUserName]; + sharedObj.userAvatar = [AWordDefault getUserAvatar]; + sharedObj.userGender = [AWordDefault getUserGender]; + } + return sharedObj; +} + +-(void)setUserName:(NSString *)userName +{ + _userName = userName; + [AWordDefault setUserName:userName]; +} +-(void)setUid:(NSString *)uid +{ + _uid = uid; + [AWordDefault setUid:uid]; + +} +-(void)setIsLogin:(BOOL)isLogin +{ + _isLogin = isLogin; + [AWordDefault setIsLogin:isLogin]; +} +-(void)setUserGender:(NSString *)userGender +{ + _userGender = userGender; + [AWordDefault setUserGender:userGender]; +} +-(void)setUserAvatar:(NSString *)userAvatar +{ + _userAvatar = userAvatar; + [AWordDefault setUserAvatar:userAvatar]; +} +@end diff --git a/Ash_AWord/Config/Common.h b/Ash_AWord/Config/Common.h index 4a65b64..e0a59ad 100644 --- a/Ash_AWord/Config/Common.h +++ b/Ash_AWord/Config/Common.h @@ -43,13 +43,21 @@ #define kMainScreenFrame ([[UIScreen mainScreen] bounds]) -#define kNetworkErrorTips @"网络连接失败" +//通知名 +#define kLoginSuccessNotificationName @"kLoginSuccessNotificationName" +#define kLogoutSuccessNotificationName @"kLogoutSuccessNotificationName" + +//文字标签 +#define kNetworkErrorTips @"网络连接失败" +#define kSSoErrorTips @"授权失败,请重新授权" +#define kLoginTips @"登录中" /** * 接口地址 */ #define Ash_AWord_API_URL @"http://121.43.150.13/QuestionServer" +//#define Ash_AWord_API_URL @"http://192.168.1.3:8080/QuestionServer" /** * 微信开放平台信息 @@ -65,5 +73,9 @@ #define kUmengAppkey @"551958aafd98c5cc010006d8" +/** + * 调整图片的宽度 + */ +#define NEWIMAGE_SIZE 700.f #endif diff --git a/Ash_AWord/Info.plist b/Ash_AWord/Info.plist index 1a19649..1004acd 100644 --- a/Ash_AWord/Info.plist +++ b/Ash_AWord/Info.plist @@ -45,6 +45,14 @@ tencent1104070329 + + CFBundleURLName + weixin + CFBundleURLSchemes + + wx8fbd37e4da758bbd + + LSRequiresIPhoneOS diff --git a/Ash_AWord/PrefixHeader.pch b/Ash_AWord/PrefixHeader.pch index 764733f..fe5b6fd 100644 --- a/Ash_AWord/PrefixHeader.pch +++ b/Ash_AWord/PrefixHeader.pch @@ -28,6 +28,14 @@ #import "Ash_UIUtil.h" #import "PropertyEntity.h" #import "RequireEngine.h" + #import "AWordUser.h" +#import "AWordDefault.h" +#import "UIImageView+WebCache.h" +#import "UIButton+WebCache.h" +#import "SDImageCache.h" +#import "Ash_UIUtil.h" +#import "Mantle.h" + #endif #endif diff --git a/Ash_AWord/Resource/btn_bad@2x.png b/Ash_AWord/Resource/btn_bad@2x.png new file mode 100644 index 0000000..6c97f36 Binary files /dev/null and b/Ash_AWord/Resource/btn_bad@2x.png differ diff --git a/Ash_AWord/Resource/btn_bad_clicked@2x.png b/Ash_AWord/Resource/btn_bad_clicked@2x.png new file mode 100644 index 0000000..3e5901f Binary files /dev/null and b/Ash_AWord/Resource/btn_bad_clicked@2x.png differ diff --git a/Ash_AWord/Resource/btn_good@2x.png b/Ash_AWord/Resource/btn_good@2x.png new file mode 100644 index 0000000..171c784 Binary files /dev/null and b/Ash_AWord/Resource/btn_good@2x.png differ diff --git a/Ash_AWord/Resource/btn_good_clicked@2x.png b/Ash_AWord/Resource/btn_good_clicked@2x.png new file mode 100644 index 0000000..9269584 Binary files /dev/null and b/Ash_AWord/Resource/btn_good_clicked@2x.png differ diff --git a/Ash_AWord/Resource/btn_share@2x.png b/Ash_AWord/Resource/btn_share@2x.png new file mode 100644 index 0000000..d9dd633 Binary files /dev/null and b/Ash_AWord/Resource/btn_share@2x.png differ diff --git a/Ash_AWord/Resource/btn_share_clicked@2x.png b/Ash_AWord/Resource/btn_share_clicked@2x.png new file mode 100644 index 0000000..73d6d76 Binary files /dev/null and b/Ash_AWord/Resource/btn_share_clicked@2x.png differ diff --git a/Ash_AWord/Resource/mine-setting-icon-click@2x.png b/Ash_AWord/Resource/mine-setting-icon-click@2x.png new file mode 100644 index 0000000..e16616f Binary files /dev/null and b/Ash_AWord/Resource/mine-setting-icon-click@2x.png differ diff --git a/Ash_AWord/Resource/mine-setting-icon@2x.png b/Ash_AWord/Resource/mine-setting-icon@2x.png new file mode 100644 index 0000000..6c46c3c Binary files /dev/null and b/Ash_AWord/Resource/mine-setting-icon@2x.png differ diff --git a/Ash_AWord/Resource/navigationButtonPublish@2x.png b/Ash_AWord/Resource/navigationButtonPublish@2x.png new file mode 100644 index 0000000..be180a9 Binary files /dev/null and b/Ash_AWord/Resource/navigationButtonPublish@2x.png differ diff --git a/Ash_AWord/Resource/navigationButtonPublishClick@2x.png b/Ash_AWord/Resource/navigationButtonPublishClick@2x.png new file mode 100644 index 0000000..c4ba352 Binary files /dev/null and b/Ash_AWord/Resource/navigationButtonPublishClick@2x.png differ diff --git a/Ash_AWord/Resource/navigationButtonRefresh@2x.png b/Ash_AWord/Resource/navigationButtonRefresh@2x.png new file mode 100644 index 0000000..02753e7 Binary files /dev/null and b/Ash_AWord/Resource/navigationButtonRefresh@2x.png differ diff --git a/Ash_AWord/Resource/navigationButtonRefreshClick@2x.png b/Ash_AWord/Resource/navigationButtonRefreshClick@2x.png new file mode 100644 index 0000000..07c4b8a Binary files /dev/null and b/Ash_AWord/Resource/navigationButtonRefreshClick@2x.png differ diff --git a/Ash_AWord/Resource/setup-head-default@2x.png b/Ash_AWord/Resource/setup-head-default@2x.png new file mode 100644 index 0000000..3c95968 Binary files /dev/null and b/Ash_AWord/Resource/setup-head-default@2x.png differ diff --git a/Ash_AWord/Utility/Network/PropertyEntity.m b/Ash_AWord/Utility/Network/PropertyEntity.m index 84222af..5cbcf44 100644 --- a/Ash_AWord/Utility/Network/PropertyEntity.m +++ b/Ash_AWord/Utility/Network/PropertyEntity.m @@ -30,7 +30,17 @@ // [key stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; // NSDictionary *dic = @{@"mkey":key}; - return _pro; + NSMutableDictionary* dic; + if (_pro) { + dic = [NSMutableDictionary dictionaryWithDictionary:_pro]; + }else{ + dic = [NSMutableDictionary dictionary]; + } + if ([AWordUser sharedInstance].isLogin && [AWordUser sharedInstance].uid) { + [dic setObject:[AWordUser sharedInstance].uid forKey:@"uid"]; + + } + return dic; } @end diff --git a/Ash_AWord/Utility/Network/RequireEngine.m b/Ash_AWord/Utility/Network/RequireEngine.m index 40ab272..d8c549f 100644 --- a/Ash_AWord/Utility/Network/RequireEngine.m +++ b/Ash_AWord/Utility/Network/RequireEngine.m @@ -47,7 +47,7 @@ if (proper.requireType == HTTPRequestTypeWithGET) { return [[XiaoYuAPIClient sharedClient] GET:[proper reqURL] - parameters:[proper url] ? [proper encodePro] : [proper pro] + parameters: [proper encodePro] success:^(AFHTTPRequestOperation * __unused task, id json) { DLog(@"%@", json); @@ -87,7 +87,7 @@ }]; } else if(proper.requireType == HTTPRequestTypeWithPOST){ return [[XiaoYuAPIClient sharedClient] POST:[proper reqURL] - parameters:[proper url] ? [proper encodePro] : [proper pro] + parameters:[proper encodePro] success:^(AFHTTPRequestOperation * __unused task, id JSON) { DLog(@"%@", JSON); @@ -112,7 +112,7 @@ }]; } else if(proper.requireType == HTTPRequestTypeWithPOSTDATA){ return [[XiaoYuAPIClient sharedClient] POST:[proper reqURL] - parameters:[proper url] ? [proper encodePro] : [proper pro] + parameters:[proper encodePro] constructingBodyWithBlock:^(id formData) { for (int i = 0; i < proper.pFile.img.count; i++) { UIImage *uploadImage = proper.pFile.img[i]; diff --git a/Ash_AWord/Utility/Tool/Ash_UIUtil.h b/Ash_AWord/Utility/Tool/Ash_UIUtil.h index 9593bcb..96fb046 100644 --- a/Ash_AWord/Utility/Tool/Ash_UIUtil.h +++ b/Ash_AWord/Utility/Tool/Ash_UIUtil.h @@ -9,6 +9,8 @@ #import @interface Ash_UIUtil : NSObject + ++(CGSize)downloadImageSizeWithURL:(id)imageURL; /** * 通过类名出创建xib类 */ @@ -32,12 +34,12 @@ /** * 创建自定义UIBarButtonItem,用于右边 */ -+ (UIBarButtonItem *)rightBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image; ++ (UIBarButtonItem *)rightBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image highlightedImage:(UIImage*)highlightedImage; /** * 创建自定义UIBarButtonItem,用于左边 */ -+ (UIBarButtonItem *)leftBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image; ++ (UIBarButtonItem *)leftBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image highlightedImage:(UIImage*)highlightedImage; + (CGFloat)currentScreenSizeRate; @@ -66,6 +68,8 @@ * @return 压缩后的图片 */ +(UIImage*)compressImageDownToPhoneScreenSize:(UIImage*)originImage; + + @end @interface UIFont (CustomFont) diff --git a/Ash_AWord/Utility/Tool/Ash_UIUtil.m b/Ash_AWord/Utility/Tool/Ash_UIUtil.m index bad9893..1e2d6ab 100644 --- a/Ash_AWord/Utility/Tool/Ash_UIUtil.m +++ b/Ash_AWord/Utility/Tool/Ash_UIUtil.m @@ -10,6 +10,156 @@ @implementation Ash_UIUtil +//讨厌警告 +-(id)diskImageDataBySearchingAllPathsForKey:(id)key{return nil;} ++(CGSize)downloadImageSizeWithURL:(id)imageURL +{ + NSURL* URL = nil; + if([imageURL isKindOfClass:[NSURL class]]){ + URL = imageURL; + } + if([imageURL isKindOfClass:[NSString class]]){ + URL = [NSURL URLWithString:imageURL]; + } + if(URL == nil) + return CGSizeZero; + + NSString* absoluteString = URL.absoluteString; + +#ifdef dispatch_main_sync_safe + if([[SDImageCache sharedImageCache] diskImageExistsWithKey:absoluteString]) + { + UIImage* image = [[SDImageCache sharedImageCache] imageFromMemoryCacheForKey:absoluteString]; + if(!image) + { + NSData* data = [[SDImageCache sharedImageCache] performSelector:@selector(diskImageDataBySearchingAllPathsForKey:) withObject:URL.absoluteString]; + image = [UIImage imageWithData:data]; + } + if(image) + { + return image.size; + } + } +#endif + + NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL]; + NSString* pathExtendsion = [URL.pathExtension lowercaseString]; + + CGSize size = CGSizeZero; + if([pathExtendsion isEqualToString:@"png"]){ + size = [self downloadPNGImageSizeWithRequest:request]; + } + else if([pathExtendsion isEqual:@"gif"]) + { + size = [self downloadGIFImageSizeWithRequest:request]; + } + else{ + size = [self downloadJPGImageSizeWithRequest:request]; + } + if(CGSizeEqualToSize(CGSizeZero, size)) + { + NSData* data = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:URL] returningResponse:nil error:nil]; + UIImage* image = [UIImage imageWithData:data]; + if(image) + { +#ifdef dispatch_main_sync_safe + [[SDImageCache sharedImageCache] storeImage:image recalculateFromImage:YES imageData:data forKey:URL.absoluteString toDisk:YES]; +#endif + size = image.size; + } + } + return size; +} ++(CGSize)downloadPNGImageSizeWithRequest:(NSMutableURLRequest*)request +{ + [request setValue:@"bytes=16-23" forHTTPHeaderField:@"Range"]; + NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; + if(data.length == 8) + { + int w1 = 0, w2 = 0, w3 = 0, w4 = 0; + [data getBytes:&w1 range:NSMakeRange(0, 1)]; + [data getBytes:&w2 range:NSMakeRange(1, 1)]; + [data getBytes:&w3 range:NSMakeRange(2, 1)]; + [data getBytes:&w4 range:NSMakeRange(3, 1)]; + int w = (w1 << 24) + (w2 << 16) + (w3 << 8) + w4; + int h1 = 0, h2 = 0, h3 = 0, h4 = 0; + [data getBytes:&h1 range:NSMakeRange(4, 1)]; + [data getBytes:&h2 range:NSMakeRange(5, 1)]; + [data getBytes:&h3 range:NSMakeRange(6, 1)]; + [data getBytes:&h4 range:NSMakeRange(7, 1)]; + int h = (h1 << 24) + (h2 << 16) + (h3 << 8) + h4; + return CGSizeMake(w, h); + } + return CGSizeZero; +} ++(CGSize)downloadGIFImageSizeWithRequest:(NSMutableURLRequest*)request +{ + [request setValue:@"bytes=6-9" forHTTPHeaderField:@"Range"]; + NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; + if(data.length == 4) + { + short w1 = 0, w2 = 0; + [data getBytes:&w1 range:NSMakeRange(0, 1)]; + [data getBytes:&w2 range:NSMakeRange(1, 1)]; + short w = w1 + (w2 << 8); + short h1 = 0, h2 = 0; + [data getBytes:&h1 range:NSMakeRange(2, 1)]; + [data getBytes:&h2 range:NSMakeRange(3, 1)]; + short h = h1 + (h2 << 8); + return CGSizeMake(w, h); + } + return CGSizeZero; +} ++(CGSize)downloadJPGImageSizeWithRequest:(NSMutableURLRequest*)request +{ + [request setValue:@"bytes=0-209" forHTTPHeaderField:@"Range"]; + NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; + + if ([data length] <= 0x58) { + return CGSizeZero; + } + + if ([data length] < 210) {// 肯定只有一个DQT字段 + short w1 = 0, w2 = 0; + [data getBytes:&w1 range:NSMakeRange(0x60, 0x1)]; + [data getBytes:&w2 range:NSMakeRange(0x61, 0x1)]; + short w = (w1 << 8) + w2; + short h1 = 0, h2 = 0; + [data getBytes:&h1 range:NSMakeRange(0x5e, 0x1)]; + [data getBytes:&h2 range:NSMakeRange(0x5f, 0x1)]; + short h = (h1 << 8) + h2; + return CGSizeMake(w, h); + } else { + short word = 0x0; + [data getBytes:&word range:NSMakeRange(0x15, 0x1)]; + if (word == 0xdb) { + [data getBytes:&word range:NSMakeRange(0x5a, 0x1)]; + if (word == 0xdb) {// 两个DQT字段 + short w1 = 0, w2 = 0; + [data getBytes:&w1 range:NSMakeRange(0xa5, 0x1)]; + [data getBytes:&w2 range:NSMakeRange(0xa6, 0x1)]; + short w = (w1 << 8) + w2; + short h1 = 0, h2 = 0; + [data getBytes:&h1 range:NSMakeRange(0xa3, 0x1)]; + [data getBytes:&h2 range:NSMakeRange(0xa4, 0x1)]; + short h = (h1 << 8) + h2; + return CGSizeMake(w, h); + } else {// 一个DQT字段 + short w1 = 0, w2 = 0; + [data getBytes:&w1 range:NSMakeRange(0x60, 0x1)]; + [data getBytes:&w2 range:NSMakeRange(0x61, 0x1)]; + short w = (w1 << 8) + w2; + short h1 = 0, h2 = 0; + [data getBytes:&h1 range:NSMakeRange(0x5e, 0x1)]; + [data getBytes:&h2 range:NSMakeRange(0x5f, 0x1)]; + short h = (h1 << 8) + h2; + return CGSizeMake(w, h); + } + } else { + return CGSizeZero; + } + } +} + (id)instanceXibView:(NSString*)xibName { NSArray* nibView = [[NSBundle mainBundle] loadNibNamed:xibName owner:nil options:nil]; @@ -55,11 +205,13 @@ } } -+ (UIBarButtonItem *)rightBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image ++ (UIBarButtonItem *)rightBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage { UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)]; [btn setImage:image forState:UIControlStateNormal]; - [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; + if (highlightedImage) { + [btn setImage:highlightedImage forState:UIControlStateHighlighted]; + } [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; if (iOSVersion >= 7.0) { @@ -70,10 +222,13 @@ return barItem; } -+ (UIBarButtonItem *)leftBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image ++ (UIBarButtonItem *)leftBarButtonItemWithTarget:(id)target action:(SEL)action image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage { UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)]; [btn setImage:image forState:UIControlStateNormal]; + if (highlightedImage) { + [btn setImage:highlightedImage forState:UIControlStateHighlighted]; + } [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; if (iOSVersion >= 7.0) @@ -227,6 +382,7 @@ //RETURN return theImage; } + /** * 获取当前屏幕与4寸屏幕比例 * 4寸返回1.0 diff --git a/Ash_AWord/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.h b/Ash_AWord/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.h new file mode 100644 index 0000000..179495c --- /dev/null +++ b/Ash_AWord/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.h @@ -0,0 +1,25 @@ +// +// UIPlaceHolderTextView.h +// WangsuTraffic +// +// Created by 华桂 陈 on 12-2-23. +// Copyright (c) 2012年 ChinaNetCenter. All rights reserved. +// + +#import + +@interface UIPlaceHolderTextView : UITextView +{ +@private + NSString *placeholder_; + UIColor *placeholderColor_; + UILabel *placeHolderLabel_; +} + +@property (nonatomic, retain) UILabel *placeHolderLabel; +@property (nonatomic, copy) NSString *placeholder; +@property (nonatomic, retain) UIColor *placeholderColor; + +-(void)textChanged:(NSNotification*)notification; + +@end \ No newline at end of file diff --git a/Ash_AWord/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.m b/Ash_AWord/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.m new file mode 100644 index 0000000..0500e27 --- /dev/null +++ b/Ash_AWord/Vender/UIPlaceHolderTextView/UIPlaceHolderTextView.m @@ -0,0 +1,87 @@ +// +// UIPlaceHolderTextView.m +// WangsuTraffic +// +// Created by 华桂 陈 on 12-2-23. +// Copyright (c) 2012年 ChinaNetCenter. All rights reserved. +// + +#import "UIPlaceHolderTextView.h" + +@implementation UIPlaceHolderTextView + +@synthesize placeHolderLabel = placeHolderLabel_; +@synthesize placeholder = placeholder_; +@synthesize placeholderColor = placeholderColor_; + +- (void)awakeFromNib +{ + [super awakeFromNib]; + [self setPlaceholder:@""]; + [self setPlaceholderColor:[UIColor lightGrayColor]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil]; +} + +- (id)initWithFrame:(CGRect)frame +{ + if( (self = [super initWithFrame:frame]) ) + { + [self setPlaceholder:@""]; + [self setPlaceholderColor:[UIColor lightGrayColor]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChanged:) name:UITextViewTextDidChangeNotification object:nil]; + } + return self; +} + +- (void)textChanged:(NSNotification *)notification +{ + if([[self placeholder] length] == 0) + { + return; + } + + if([[self text] length] == 0) + { + [[self viewWithTag:999] setAlpha:1]; + } + else + { + [[self viewWithTag:999] setAlpha:0]; + } +} + +- (void)setText:(NSString *)text { + [super setText:text]; + [self textChanged:nil]; +} + +- (void)drawRect:(CGRect)rect +{ + if( [[self placeholder] length] > 0 ) + { + if ( placeHolderLabel_ == nil ) + { + placeHolderLabel_ = [[UILabel alloc] initWithFrame:CGRectMake(4,8,self.bounds.size.width,0)]; + placeHolderLabel_.lineBreakMode = NSLineBreakByWordWrapping; + placeHolderLabel_.numberOfLines = 0; + placeHolderLabel_.font = self.font; + placeHolderLabel_.backgroundColor = [UIColor clearColor]; + placeHolderLabel_.textColor = self.placeholderColor; + placeHolderLabel_.alpha = 0; + placeHolderLabel_.tag = 999; + [self addSubview:placeHolderLabel_]; + } + + placeHolderLabel_.text = self.placeholder; + [placeHolderLabel_ sizeToFit]; + [self sendSubviewToBack:placeHolderLabel_]; + } + + if( [[self text] length] == 0 && [[self placeholder] length] > 0 ) + { + [[self viewWithTag:999] setAlpha:1]; + } + + [super drawRect:rect]; +} +@end diff --git a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.h b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.h index b2edf4e..6c8404e 100644 --- a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.h +++ b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.h @@ -7,7 +7,7 @@ // #import "ViewController.h" - +#import "MJRefresh.h" @interface BaseRefreshViewController : ViewController @property (weak, nonatomic) IBOutlet UITableView *tableView; diff --git a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m index 94a4e90..58bbb88 100644 --- a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m +++ b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m @@ -7,7 +7,7 @@ // #import "BaseRefreshViewController.h" -#import "MJRefresh.h" + @interface BaseRefreshViewController () diff --git a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.xib b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.xib index edacb5d..02553f7 100644 --- a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.xib +++ b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.xib @@ -18,7 +18,7 @@ - + diff --git a/Ash_AWord/ViewControllers/Login/LoginViewController.h b/Ash_AWord/ViewControllers/Login/LoginViewController.h index 4b119ea..9889a1c 100644 --- a/Ash_AWord/ViewControllers/Login/LoginViewController.h +++ b/Ash_AWord/ViewControllers/Login/LoginViewController.h @@ -9,5 +9,8 @@ #import @interface LoginViewController : UIViewController +- (IBAction)qqLoginBtnClick:(id)sender; +- (IBAction)weixinLoginBtnClick:(id)sender; +- (IBAction)closeBtnClick:(id)sender; @end diff --git a/Ash_AWord/ViewControllers/Login/LoginViewController.m b/Ash_AWord/ViewControllers/Login/LoginViewController.m index 7b4e10d..2c6a330 100644 --- a/Ash_AWord/ViewControllers/Login/LoginViewController.m +++ b/Ash_AWord/ViewControllers/Login/LoginViewController.m @@ -7,7 +7,8 @@ // #import "LoginViewController.h" - +#import "LoginViewModel.h" +#import "UMSocial.h" @interface LoginViewController () @end @@ -18,7 +19,11 @@ [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } - +-(void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + self.navigationController.navigationBarHidden = YES; +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. @@ -34,4 +39,91 @@ } */ +- (IBAction)qqLoginBtnClick:(id)sender +{ + UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToQQ]; + + snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){ + + // 获取微博用户名、uid、token等 + + if (response.responseCode == UMSResponseCodeSuccess) { + + UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToQQ]; + [MBProgressHUD hudWithView:self.view label:kLoginTips]; + DLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL); + [[UMSocialDataService defaultDataService] requestSnsInformation:UMShareToQQ completion:^(UMSocialResponseEntity *response){ + DLog(@"SnsInformation is %@",response.data); + if (response.data) { + [self loginWithOpenId:[response.data objectForKey:@"openid"] withName:[response.data objectForKey:@"screen_name"] withGender:[response.data objectForKey:@"gender"] withFigureUrl:[response.data objectForKey:@"profile_image_url"]]; + }else{ + [MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0]; + } + }]; + + }}); + +} + +- (IBAction)weixinLoginBtnClick:(id)sender +{ + UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatSession]; + + snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){ + + if (response.responseCode == UMSResponseCodeSuccess) { + [MBProgressHUD hudWithView:self.view label:kLoginTips]; + UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary]valueForKey:UMShareToWechatSession]; + + DLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL); + [[UMSocialDataService defaultDataService] requestSnsInformation:UMShareToWechatSession completion:^(UMSocialResponseEntity *response){ + DLog(@"SnsInformation is %@",response.data); + if (response.data) { + NSString* gender = @"男"; + if ([[response.data objectForKey:@"gender"] integerValue]==0) { + gender = @"女"; + } + [self loginWithOpenId:[response.data objectForKey:@"openid"] withName:[response.data objectForKey:@"screen_name"] withGender:gender withFigureUrl:[response.data objectForKey:@"profile_image_url"]]; + }else{ + [MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0]; + } + }]; + } + + }); +} + +- (IBAction)closeBtnClick:(id)sender +{ + [self.navigationController dismissViewControllerAnimated:YES completion:nil]; +} +-(void)loginWithOpenId:(NSString*)openId withName:(NSString*)name withGender:(NSString*)gender withFigureUrl:(NSString*)figureUrl; +{ + if ([gender isEqualToString:@"1"] ) { + gender = @"男"; + } + if ([gender isEqualToString:@"0"]) { + gender = @"女"; + } + PropertyEntity* loginViewModel = [LoginViewModel requireLoginWithOpenId:openId withName:name withGender:gender withFigureUrl:figureUrl]; + [RequireEngine requireWithProperty:loginViewModel completionBlock:^(id viewModel) { + LoginViewModel* loginViewModel = (LoginViewModel*)viewModel; + [MBProgressHUD hideAllHUDsForView:self.view animated:YES]; + + if ([loginViewModel success]) { + + [AWordUser sharedInstance].isLogin = YES; + [AWordUser sharedInstance].uid = loginViewModel.uId; + [AWordUser sharedInstance].userName = name; + [AWordUser sharedInstance].userAvatar = figureUrl; + [AWordUser sharedInstance].userGender = gender; + [self closeBtnClick:nil]; + [[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessNotificationName object:nil]; + }else{ + [MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0]; + } + } failedBlock:^(NSError *error) { + + }]; +} @end diff --git a/Ash_AWord/ViewControllers/Login/LoginViewController.xib b/Ash_AWord/ViewControllers/Login/LoginViewController.xib index 2579e37..3d186f6 100644 --- a/Ash_AWord/ViewControllers/Login/LoginViewController.xib +++ b/Ash_AWord/ViewControllers/Login/LoginViewController.xib @@ -16,14 +16,14 @@ - + - + - - + + diff --git a/Ash_AWord/ViewControllers/Main/MainViewController.m b/Ash_AWord/ViewControllers/Main/MainViewController.m index eaf9523..75cf450 100644 --- a/Ash_AWord/ViewControllers/Main/MainViewController.m +++ b/Ash_AWord/ViewControllers/Main/MainViewController.m @@ -45,6 +45,9 @@ [[UITableViewHeaderFooterView appearance] setTintColor:[UIColor clearColor]]; [[UITabBar appearance] setTintColor:[UIColor blackColor]]; + + [UIBarButtonItem.appearance setTintColor:[UIColor blackColor]]; + [[UINavigationBar appearance] setTintColor:[UIColor blackColor]]; } - (void)didReceiveMemoryWarning diff --git a/Ash_AWord/ViewControllers/Main/MessageViewController.m b/Ash_AWord/ViewControllers/Main/MessageViewController.m index 0841e30..8993add 100644 --- a/Ash_AWord/ViewControllers/Main/MessageViewController.m +++ b/Ash_AWord/ViewControllers/Main/MessageViewController.m @@ -27,8 +27,17 @@ { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. -} + [self customViewDidLoad]; + + self.navigationItem.title = @"声音"; + self.navigationItem.leftBarButtonItem = [Ash_UIUtil leftBarButtonItemWithTarget:self action:@selector(publish) image:[UIImage imageNamed:@"navigationButtonPublish"] highlightedImage:[UIImage imageNamed:@"navigationButtonPublishClick"]]; +} +#pragma publish +-(void)publish +{ + +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/Ash_AWord/ViewControllers/Main/MyViewController.m b/Ash_AWord/ViewControllers/Main/MyViewController.m index b75e64c..e20e2ee 100644 --- a/Ash_AWord/ViewControllers/Main/MyViewController.m +++ b/Ash_AWord/ViewControllers/Main/MyViewController.m @@ -9,6 +9,8 @@ #import "MyViewController.h" #import "UMSocial.h" #import "LoginViewModel.h" +#import "LoginViewController.h" +#import "SetUpViewController.h" @interface MyViewController () { NSArray* cellTitleArr; @@ -31,19 +33,41 @@ { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. + [self customViewDidLoad]; + self.navigationItem.title = @"我的"; _tableView.delegate = self; _tableView.dataSource = self; + + + self.navigationItem.rightBarButtonItem = [Ash_UIUtil leftBarButtonItemWithTarget:self action:@selector(goSetUp) image:[UIImage imageNamed:@"mine-setting-icon"] highlightedImage:[UIImage imageNamed:@"mine-setting-icon-click"]]; + + //注册通知的观察者 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:kLoginSuccessNotificationName object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:kLogoutSuccessNotificationName object:nil]; } +-(void)goSetUp +{ + SetUpViewController* setUpViewController = [[SetUpViewController alloc] init]; + setUpViewController.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:setUpViewController animated:YES]; +} +-(void)loginSuccess +{ + [self.tableView reloadData]; +} #pragma mark UITableViewDelegate -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 5; + return 2; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (section == 1) { + return 2; + } return 1; } -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath @@ -56,25 +80,28 @@ switch (indexPath.section) { case 0: { - cell.textLabel.text = @"登录"; + if ([AWordUser sharedInstance].isLogin) { + cell.textLabel.text = [AWordUser sharedInstance].userName; + [cell.imageView sd_setImageWithURL:[NSURL URLWithString:[AWordUser sharedInstance].userAvatar] placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]]; + + }else{ + cell.textLabel.text = @"登录"; + [cell.imageView setImage:[UIImage imageNamed:@"defaultUserIcon"]]; + } + } break; case 1: { - cell.textLabel.text = @"我发表的文字"; + if (indexPath.row == 0 ) { + cell.textLabel.text = @"我发表的图片"; + } + if (indexPath.row == 1) { + cell.textLabel.text = @"我发表的声音"; + } } break; case 2: - { - cell.textLabel.text = @"我发表的声音"; - } - break; - case 3: - { - cell.textLabel.text = @"清楚缓存"; - } - break; - case 4: { cell.textLabel.text = @"推荐给朋友"; } @@ -90,27 +117,12 @@ switch (indexPath.section) { case 0: { - UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToQQ]; - - snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){ - - // 获取微博用户名、uid、token等 - - if (response.responseCode == UMSResponseCodeSuccess) { - - UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary] valueForKey:UMShareToQQ]; - [MBProgressHUD hudWithView:self.view label:@"登录中"]; - NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL); - [[UMSocialDataService defaultDataService] requestSnsInformation:UMShareToQQ completion:^(UMSocialResponseEntity *response){ - NSLog(@"SnsInformation is %@",response.data); - if (response.data) { - [self loginWithOpenId:[response.data objectForKey:@"openid"] withName:[response.data objectForKey:@"screen_name"] withGender:[response.data objectForKey:@"gender"] withFigureUrl:[response.data objectForKey:@"profile_image_url"]]; - }else{ - [MBProgressHUD errorHudWithView:self.view label:@"信息获取失败,重新授权" hidesAfter:1.0]; - } - }]; - - }}); + if (![AWordUser sharedInstance].isLogin) + { + LoginViewController* loginViewController = [[LoginViewController alloc] init]; + [self.navigationController presentViewController:[[UINavigationController alloc] initWithRootViewController:loginViewController] animated:YES completion:nil]; + } + } break; @@ -119,16 +131,7 @@ } } --(void)loginWithOpenId:(NSString*)openId withName:(NSString*)name withGender:(NSString*)gender withFigureUrl:(NSString*)figureUrl; -{ - PropertyEntity* loginViewModel = [LoginViewModel requireLoginWithOpenId:openId withName:name withGender:gender withFigureUrl:figureUrl]; - [RequireEngine requireWithProperty:loginViewModel completionBlock:^(id viewModel) { - LoginViewModel* loginViewModel = (LoginViewModel*)viewModel; - - } failedBlock:^(NSError *error) { - - }]; -} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/Ash_AWord/ViewControllers/Main/MyViewController.xib b/Ash_AWord/ViewControllers/Main/MyViewController.xib index 69797d9..dd2be47 100644 --- a/Ash_AWord/ViewControllers/Main/MyViewController.xib +++ b/Ash_AWord/ViewControllers/Main/MyViewController.xib @@ -18,7 +18,7 @@ - + diff --git a/Ash_AWord/ViewControllers/Main/NoteViewController.h b/Ash_AWord/ViewControllers/Main/NoteViewController.h index 0189eaa..1c5bae4 100644 --- a/Ash_AWord/ViewControllers/Main/NoteViewController.h +++ b/Ash_AWord/ViewControllers/Main/NoteViewController.h @@ -7,7 +7,9 @@ // #import "ViewController.h" +#import "BaseRefreshViewController.h" -@interface NoteViewController : ViewController +@interface NoteViewController : BaseRefreshViewController +@property (weak, nonatomic) IBOutlet UITableView *tableView; @end diff --git a/Ash_AWord/ViewControllers/Main/NoteViewController.m b/Ash_AWord/ViewControllers/Main/NoteViewController.m index 79d513d..8f76be0 100644 --- a/Ash_AWord/ViewControllers/Main/NoteViewController.m +++ b/Ash_AWord/ViewControllers/Main/NoteViewController.m @@ -7,9 +7,14 @@ // #import "NoteViewController.h" - -@interface NoteViewController () - +#import "NotePublishViewController.h" +#import "NoteTableViewCell.h" +#import "NoteViewModel.h" +@interface NoteViewController () +{ + NSInteger _page; + NSMutableArray* _text_imageArr; +} @end @implementation NoteViewController @@ -19,6 +24,8 @@ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization + _page = 1; + _text_imageArr = [[NSMutableArray alloc] init]; } return self; } @@ -27,8 +34,135 @@ { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. + [self customViewDidLoad]; + + self.navigationItem.title = @"文字"; + self.navigationItem.leftBarButtonItem = [Ash_UIUtil leftBarButtonItemWithTarget:self action:@selector(publish) image:[UIImage imageNamed:@"navigationButtonPublish"] highlightedImage:[UIImage imageNamed:@"navigationButtonPublishClick"]]; + + [self headerRereshing]; } +#pragma mark MJRefreshDelegate +-(void)headerRereshing +{ + [_text_imageArr removeAllObjects]; + _page=1; + [self loadData]; +} +-(void)footerRereshing +{ + _page++; + [self footerEndRefreshing]; +} +-(void)loadData +{ + PropertyEntity* pro = [NoteViewModel requireWithOrder_by:Order_by_Time withPage:_page withPage_size:20]; + [RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) { + + NoteViewModel* noteViewModel = (NoteViewModel*)viewModel; + if (noteViewModel.text_imagesArr.count<20) { + [self.tableView removeFooter]; + }else{ + [self.tableView addGifFooterWithRefreshingTarget:self refreshingAction:@selector(footerRereshing)]; + } + if (noteViewModel.text_imagesArr) { + [_text_imageArr addObjectsFromArray:noteViewModel.text_imagesArr]; + } + [self footerEndRefreshing]; + [self headerEndRefreshing]; + [self.tableView reloadData]; + + } failedBlock:^(NSError *error) { + [MBProgressHUD errorHudWithView:self.view label:kNetworkErrorTips hidesAfter:1.0]; + [self footerEndRefreshing]; + [self headerEndRefreshing]; + }]; +} +#pragma mark UITableViewDelegate +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ + return _text_imageArr.count; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return 1; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 0.1; +} +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return 10.0; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + Text_Image* text_image = [_text_imageArr objectAtIndex:indexPath.section]; + return [NoteTableViewCell heightWith:text_image]; +// return 140; +} +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString* cellIdentifier = @"cellIdentifier"; + NoteTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; + if (!cell) { + UINib* nib = [UINib nibWithNibName:@"NoteTableViewCell" bundle:nil]; + [tableView registerNib:nib forCellReuseIdentifier:cellIdentifier]; + cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; + } + cell.selectionStyle = UITableViewCellSelectionStyleNone; + Text_Image* text_image = [_text_imageArr objectAtIndex:indexPath.section]; + [cell setText_Image:text_image]; + return cell; +} +#pragma mark publish +-(void)publish +{ + if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { + UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"拍照",@"从手机相册选择", nil]; + actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; + [actionSheet showFromTabBar:self.tabBarController.tabBar]; + }else{ + [self actionSheet:nil clickedButtonAtIndex:1]; + } + +} + +#pragma mark UIActonSheetDelegate +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +{ + UIImagePickerController* picker = [[UIImagePickerController alloc] init]; + picker.allowsEditing = YES; + picker.delegate = self; + if (buttonIndex == 0) { + picker.sourceType = UIImagePickerControllerSourceTypeCamera; + } + if (buttonIndex == 1) { + picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; + } + [self presentViewController:picker animated:YES completion:nil]; + +} +#pragma mark UIImagePickerControllerDelegate +-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker +{ + [picker dismissViewControllerAnimated: YES completion: ^(void){}]; + +} +-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info +{ + UIImage* image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; + if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) { + + UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); + } + // resize image + image = [Ash_UIUtil fixOrientation:image]; + image = [Ash_UIUtil compressImageDownToPhoneScreenSize:image]; + [picker dismissViewControllerAnimated:NO completion:nil]; + + NotePublishViewController* notePublishViewController = [[NotePublishViewController alloc] init]; + notePublishViewController.publishImage = image; + UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:notePublishViewController]; + [self presentViewController:nav animated:YES completion:nil]; +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/Ash_AWord/ViewControllers/Main/NoteViewController.xib b/Ash_AWord/ViewControllers/Main/NoteViewController.xib index 632d090..ac4a49a 100644 --- a/Ash_AWord/ViewControllers/Main/NoteViewController.xib +++ b/Ash_AWord/ViewControllers/Main/NoteViewController.xib @@ -1,11 +1,13 @@ - + - + + + @@ -13,9 +15,24 @@ + + + + + + - - + + + + + + + + + + + diff --git a/Ash_AWord/ViewControllers/My/SetUpViewController.h b/Ash_AWord/ViewControllers/My/SetUpViewController.h new file mode 100644 index 0000000..3027e1f --- /dev/null +++ b/Ash_AWord/ViewControllers/My/SetUpViewController.h @@ -0,0 +1,14 @@ +// +// SetUpViewController.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "ViewController.h" + +@interface SetUpViewController : ViewController +@property (weak, nonatomic) IBOutlet UITableView *tableView; + +@end diff --git a/Ash_AWord/ViewControllers/My/SetUpViewController.m b/Ash_AWord/ViewControllers/My/SetUpViewController.m new file mode 100644 index 0000000..63e89ab --- /dev/null +++ b/Ash_AWord/ViewControllers/My/SetUpViewController.m @@ -0,0 +1,138 @@ +// +// SetUpViewController.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "SetUpViewController.h" + +@interface SetUpViewController () + +@end + +@implementation SetUpViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. + [self customViewDidLoad]; + self.navigationItem.title = @"设置"; + _tableView.dataSource = self; + _tableView.delegate = self; +} + +#pragma mark UITableViewDelegate +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 5; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 20.0; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return 44.0; +} +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return 100.0; +} +-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section +{ + if (![AWordUser sharedInstance].isLogin) { + return nil; + } + UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 100)]; + view.backgroundColor = [UIColor clearColor]; + UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; + [button addTarget:self action:@selector(lgout:) forControlEvents:UIControlEventTouchUpInside]; + [button setTitle:@"退出当前账号" forState:UIControlStateNormal]; + [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [button setBackgroundColor:[UIColor redColor]]; + button.layer.cornerRadius = 5.0; + button.layer.masksToBounds = YES; + button.frame = CGRectMake(20, 25, kScreenWidth-40, 50); + [view addSubview:button]; + return view; +} +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString* cellIdentifier = @"cell"; + UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; + } + switch (indexPath.row) { + case 0: + { + cell.textLabel.text = @"清除缓存"; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + SDImageCache *cache = [SDImageCache sharedImageCache]; + NSUInteger size = [cache getSize]; + dispatch_async(dispatch_get_main_queue(), ^{ + cell.detailTextLabel.text = size/1024 < 1024 ? [NSString stringWithFormat:@"%.2fKB",(float)size/1024.0]:[NSString stringWithFormat:@"%.2fMB",(float)size/(1024.0*1024.0)]; + }); + }); + + } + + break; + case 1: + cell.textLabel.text = @"推荐给朋友"; + break; + case 2: + { + cell.textLabel.text = @"当前版本"; + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; + NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; + NSString *buildVersion = [infoDictionary objectForKey:@"CFBundleVersion"]; + NSString *version = [NSString stringWithFormat:@"v%@.%@",app_Version, buildVersion]; + cell.detailTextLabel.text = version; + } + break; + case 3: + cell.textLabel.text = @"关于我们"; + break; + case 4: + cell.textLabel.text = @"欢迎打5星好评"; + break; + + default: + break; + } + return cell; +} +-(void)lgout:(id)sender +{ + [AWordUser sharedInstance].isLogin = NO; + [AWordUser sharedInstance].uid = @""; + [[NSNotificationCenter defaultCenter] postNotificationName:kLogoutSuccessNotificationName object:nil]; + [self.navigationController popViewControllerAnimated:YES]; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; +} +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/Ash_AWord/ViewControllers/My/SetUpViewController.xib b/Ash_AWord/ViewControllers/My/SetUpViewController.xib new file mode 100644 index 0000000..94374c2 --- /dev/null +++ b/Ash_AWord/ViewControllers/My/SetUpViewController.xib @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/ViewControllers/Note/NotePublishViewController.h b/Ash_AWord/ViewControllers/Note/NotePublishViewController.h new file mode 100644 index 0000000..0594882 --- /dev/null +++ b/Ash_AWord/ViewControllers/Note/NotePublishViewController.h @@ -0,0 +1,18 @@ +// +// NotePublishViewController.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "ViewController.h" +#import "UIPlaceHolderTextView.h" +@interface NotePublishViewController : ViewController + +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentHeight; +@property (weak, nonatomic) IBOutlet UIPlaceHolderTextView *contentTextView; +@property (weak, nonatomic) IBOutlet UIImageView *imageView; +@property (weak, nonatomic) IBOutlet UILabel *lengthLabel; +@property (nonatomic,strong)UIImage* publishImage; +@end diff --git a/Ash_AWord/ViewControllers/Note/NotePublishViewController.m b/Ash_AWord/ViewControllers/Note/NotePublishViewController.m new file mode 100644 index 0000000..429a444 --- /dev/null +++ b/Ash_AWord/ViewControllers/Note/NotePublishViewController.m @@ -0,0 +1,102 @@ +// +// NotePublishViewController.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "NotePublishViewController.h" +#import "NotePublishViewModel.h" +@interface NotePublishViewController () +{ + NSInteger _textLeft; +} +@end + +@implementation NotePublishViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. + + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(cancel)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"发布" style:UIBarButtonItemStyleDone target:self action:@selector(publish)]; + + _contentHeight.constant = kScreenHeight-216-64-60; + _textLeft = 500; + _contentTextView.placeholder = @"把你喜欢的好玩的图片发上来,配上美美的文字。so good!"; + _contentTextView.delegate = self; + _imageView.image = _publishImage; + + [_contentTextView becomeFirstResponder]; + +} +-(void)cancel +{ + UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil message:@"退出此次编辑" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil]; + [alertView show]; +} +-(void)publish +{ + if (_contentTextView.text.length>0 && _publishImage) { + [MBProgressHUD hudWithView:self.view label:@"发布中"]; + PropertyEntity* notePublishViewModel = [NotePublishViewModel requireAddNote:_contentTextView.text withImage:_publishImage]; + [RequireEngine requireWithProperty:notePublishViewModel completionBlock:^(id viewModel) { + NotePublishViewModel* notePublishViewModel = (NotePublishViewModel*)viewModel; + [MBProgressHUD hideAllHUDsForView:self.view animated:YES]; + if ([notePublishViewModel success]) { + [MBProgressHUD checkHudWithView:self.view label:@"发布成功" hidesAfter:1.0]; + [self dismissViewControllerAnimated:YES completion:nil]; + }else{ + [MBProgressHUD errorHudWithView:self.view label:notePublishViewModel.errMessage hidesAfter:1.0]; + } + } failedBlock:^(NSError *error) { + [MBProgressHUD errorHudWithView:self.view label:kNetworkErrorTips hidesAfter:1.0]; + + }]; + } +} +#pragma mark UITextViewDelegate +-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text +{ +#define MY_MAX 500 + if ((textView.text.length - range.length + text.length) > MY_MAX) + { + NSString *substring = [text substringToIndex:MY_MAX - (textView.text.length - range.length)]; + NSMutableString *lastString = [textView.text mutableCopy]; + [lastString replaceCharactersInRange:range withString:substring]; + textView.text = [lastString copy]; + return NO; + } + else + { + _textLeft = 500-(textView.text.length-range.length+text.length); + _lengthLabel.text = [NSString stringWithFormat:@"%ld",(long)_textLeft]; + return YES; + } +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} +#pragma mark UIAlertViewDelegate +-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex +{ + if (buttonIndex==1) + { + [self dismissViewControllerAnimated:YES completion:nil]; + } +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/Ash_AWord/ViewControllers/Note/NotePublishViewController.xib b/Ash_AWord/ViewControllers/Note/NotePublishViewController.xib new file mode 100644 index 0000000..9031455 --- /dev/null +++ b/Ash_AWord/ViewControllers/Note/NotePublishViewController.xib @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/ViewModels/Note/NotePublishViewModel.h b/Ash_AWord/ViewModels/Note/NotePublishViewModel.h new file mode 100644 index 0000000..56b2741 --- /dev/null +++ b/Ash_AWord/ViewModels/Note/NotePublishViewModel.h @@ -0,0 +1,14 @@ +// +// NotePublishViewModel.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "BaseViewModel.h" + +@interface NotePublishViewModel : BaseViewModel + ++ (PropertyEntity *)requireAddNote:(NSString*)content withImage:(UIImage*)image; +@end diff --git a/Ash_AWord/ViewModels/Note/NotePublishViewModel.m b/Ash_AWord/ViewModels/Note/NotePublishViewModel.m new file mode 100644 index 0000000..638bb73 --- /dev/null +++ b/Ash_AWord/ViewModels/Note/NotePublishViewModel.m @@ -0,0 +1,29 @@ +// +// NotePublishViewModel.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "NotePublishViewModel.h" + +@implementation NotePublishViewModel + + ++(PropertyEntity*)requireAddNote:(NSString *)content withImage:(UIImage *)image +{ + PropertyEntity *pro = [[PropertyEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithPOSTDATA; + proFile *file = [[proFile alloc] init]; + file.name = @"img"; + file.img = [NSArray arrayWithObject:image];; + pro.pFile = file; + pro.reqURL = @"rs/text_image/add"; + pro.responesOBJ = self.class; + content = [content stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + pro.pro = @{@"content": content, + }; + return pro; +} +@end diff --git a/Ash_AWord/ViewModels/Note/NoteViewModel.h b/Ash_AWord/ViewModels/Note/NoteViewModel.h new file mode 100644 index 0000000..0d1a0a4 --- /dev/null +++ b/Ash_AWord/ViewModels/Note/NoteViewModel.h @@ -0,0 +1,28 @@ +// +// NoteViewModel.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "BaseViewModel.h" +typedef enum { + Order_by_Time = 0, + Order_by_Good = 1, +}Order_by; + +@interface Text_Image : MTLModel +@property (nonatomic, strong)NSString* content; +@property (nonatomic, strong)NSString* createTime; +@property (nonatomic, strong)NSURL* imageUrl; +@property (nonatomic, strong)NSString* ownerId; +@property (nonatomic, assign)BOOL hasPraised; +@property (nonatomic, assign)NSInteger praiseCount; +@property (nonatomic, assign)NSInteger messageId; +@end +@interface NoteViewModel : BaseViewModel + +@property (nonatomic, strong)NSArray* text_imagesArr; ++(PropertyEntity*)requireWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size; +@end diff --git a/Ash_AWord/ViewModels/Note/NoteViewModel.m b/Ash_AWord/ViewModels/Note/NoteViewModel.m new file mode 100644 index 0000000..449cf66 --- /dev/null +++ b/Ash_AWord/ViewModels/Note/NoteViewModel.m @@ -0,0 +1,60 @@ +// +// NoteViewModel.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "NoteViewModel.h" +@implementation Text_Image ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + return @{ + @"content": @"content", + @"createTime": @"createTime", + @"hasPraised" : @"hasPraised", + @"messageId": @"id", + @"imageUrl" : @"imageUrl", + @"ownerId" : @"ownerId", + @"praiseCount": @"praiseCount", + }; +} ++ (NSValueTransformer *)imageUrlJSONTransformer { + return [NSValueTransformer valueTransformerForName:MTLURLValueTransformerName]; +} +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error { + self = [super initWithDictionary:dictionaryValue error:error]; + if (self == nil) return nil; + self.content = [self.content stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + // Store a value that needs to be determined locally upon initialization. + + return self; +} +@end + +@implementation NoteViewModel + ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + return @{ + @"text_imagesArr": @"text_images", + }; +} ++ (NSValueTransformer *)text_imagesArrJSONTransformer{ + return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:Text_Image.class]; +} + ++(PropertyEntity*)requireWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size +{ + PropertyEntity *pro = [[PropertyEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithGET; + pro.reqURL = @"rs/text_image/load_public"; + pro.responesOBJ = self.class; + pro.pro = @{@"order_by": [NSString stringWithFormat:@"%u",order_by], + @"page": [NSString stringWithFormat:@"%ld",page], + @"page_size": [NSString stringWithFormat:@"%ld",page_size], + }; + + return pro; +} + +@end diff --git a/Ash_AWord/Views/Note/NoteTableViewCell.h b/Ash_AWord/Views/Note/NoteTableViewCell.h new file mode 100644 index 0000000..1cfc674 --- /dev/null +++ b/Ash_AWord/Views/Note/NoteTableViewCell.h @@ -0,0 +1,29 @@ +// +// NoteTableViewCell.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import +@class Text_Image; +@interface NoteTableViewCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UILabel *contentLabel; +@property (weak, nonatomic) IBOutlet UIImageView *avatar; +@property (weak, nonatomic) IBOutlet UILabel *userName; +@property (weak, nonatomic) IBOutlet UIImageView *contentImgView; +@property (weak, nonatomic) IBOutlet UIButton *goodBtn; +@property (weak, nonatomic) IBOutlet UIButton *badBtn; +@property (weak, nonatomic) IBOutlet UIButton *shareBtn; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentHeight; + + + +- (IBAction)goodBtnClick:(id)sender; +- (IBAction)badBtnClick:(id)sender; +- (IBAction)shareBtnClick:(id)sender; + +-(void)setText_Image:(Text_Image*)text_image; ++(CGFloat)heightWith:(Text_Image*)text_image; +@end diff --git a/Ash_AWord/Views/Note/NoteTableViewCell.m b/Ash_AWord/Views/Note/NoteTableViewCell.m new file mode 100644 index 0000000..cc99977 --- /dev/null +++ b/Ash_AWord/Views/Note/NoteTableViewCell.m @@ -0,0 +1,69 @@ +// +// NoteTableViewCell.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "NoteTableViewCell.h" +#import "NoteViewModel.h" +@implementation NoteTableViewCell + +- (void)awakeFromNib { + // Initialization code + _contentLabel.font = [UIFont appFontOfSize:14.0]; +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (IBAction)goodBtnClick:(id)sender +{ +} + +- (IBAction)badBtnClick:(id)sender +{ +} + +- (IBAction)shareBtnClick:(id)sender +{ +} +-(void)setText_Image:(Text_Image *)text_image +{ + CGSize imageSize = _contentImgView.frame.size; + UIGraphicsBeginImageContextWithOptions(imageSize, 0, [UIScreen mainScreen].scale); + [[UIColor colorWithWhite:0.6 alpha:0.5] set]; + UIRectFill(CGRectMake(0, 0, imageSize.width, imageSize.height)); + UIImage *pressedColorImg = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + + + UIFont *font = [UIFont appFontOfSize:14.0]; + CGSize size = CGSizeMake(300*[Ash_UIUtil currentScreenSizeRate],MAXFLOAT); + + CGRect labelRect = [text_image.content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil]; + _contentHeight.constant = labelRect.size.height; + _contentLabel.text = text_image.content; + [_contentImgView sd_setImageWithURL:text_image.imageUrl placeholderImage:pressedColorImg]; + +} ++(CGFloat)heightWith:(Text_Image *)text_image +{ + UIFont *font = [UIFont appFontOfSize:14.0]; + CGSize size = CGSizeMake(300*[Ash_UIUtil currentScreenSizeRate],MAXFLOAT); + + CGRect labelRect = [text_image.content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil]; + + CGSize imageSize = [Ash_UIUtil downloadImageSizeWithURL:text_image.imageUrl]; + CGFloat imageHeight = imageSize.height; + if (imageHeight!=0 &&imageSize.width!=0) { + imageHeight = imageHeight/(imageSize.width/(304*[Ash_UIUtil currentScreenSizeRate])); + } + return imageHeight+labelRect.size.height+85; +} +@end diff --git a/Ash_AWord/Views/Note/NoteTableViewCell.xib b/Ash_AWord/Views/Note/NoteTableViewCell.xib new file mode 100644 index 0000000..dec6f9a --- /dev/null +++ b/Ash_AWord/Views/Note/NoteTableViewCell.xib @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +