diff --git a/Ash_AWord.xcodeproj/project.pbxproj b/Ash_AWord.xcodeproj/project.pbxproj index 3a04cfe..4bf1e11 100644 --- a/Ash_AWord.xcodeproj/project.pbxproj +++ b/Ash_AWord.xcodeproj/project.pbxproj @@ -57,6 +57,7 @@ A95510981AC39E6A0006D16F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A95510971AC39E6A0006D16F /* ViewController.m */; }; A955109B1AC39E6A0006D16F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A95510991AC39E6A0006D16F /* Main.storyboard */; }; A955109D1AC39E6A0006D16F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A955109C1AC39E6A0006D16F /* Images.xcassets */; }; + A95CE2EB1B1DFD030017AE68 /* NoteCommentViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A95CE2EA1B1DFD030017AE68 /* NoteCommentViewModel.m */; }; 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 */; }; @@ -92,6 +93,7 @@ A968627A1ACCF13300DDAA6B /* PSTGridLayoutSection.m in Sources */ = {isa = PBXBuildFile; fileRef = A968626D1ACCF13300DDAA6B /* PSTGridLayoutSection.m */; }; A968627C1ACCF3D200DDAA6B /* cellmorebtnnormalN@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A968627B1ACCF3D200DDAA6B /* cellmorebtnnormalN@2x.png */; }; A968627E1ACCF46E00DDAA6B /* cellmorebtnclickN@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A968627D1ACCF46E00DDAA6B /* cellmorebtnclickN@2x.png */; }; + A96F27EE1B2195BA00DA0A66 /* UIImageView+Reloading.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F27ED1B2195BA00DA0A66 /* UIImageView+Reloading.m */; }; A9754A1C1ADC080E0018BAAD /* AudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = A9754A0F1ADC080E0018BAAD /* AudioPlayer.m */; }; A9754A1D1ADC080E0018BAAD /* AutoRecoveringHttpDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = A9754A111ADC080E0018BAAD /* AutoRecoveringHttpDataSource.m */; }; A9754A1E1ADC080E0018BAAD /* CoreFoundationDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = A9754A131ADC080E0018BAAD /* CoreFoundationDataSource.m */; }; @@ -122,6 +124,8 @@ A97559D11ACBF0BC004ADA42 /* btn_share@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97559CB1ACBF0BC004ADA42 /* btn_share@2x.png */; }; A97883881AD369DF00D46477 /* mainCellDingClick@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97883871AD369DF00D46477 /* mainCellDingClick@2x.png */; }; A978838A1AD36A0500D46477 /* mainCellDing@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A97883891AD36A0500D46477 /* mainCellDing@2x.png */; }; + A97938751B20A63D00180C08 /* UserViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A97938741B20A63D00180C08 /* UserViewModel.m */; }; + A97938781B20BB0900180C08 /* CommentViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A97938771B20BB0900180C08 /* CommentViewModel.m */; }; 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 */; }; @@ -187,6 +191,19 @@ A9B4A9541AEDC3620017C655 /* FeedbackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B4A9521AEDC3620017C655 /* FeedbackViewController.m */; }; A9B4A9551AEDC3620017C655 /* FeedbackViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9B4A9531AEDC3620017C655 /* FeedbackViewController.xib */; }; A9B4E39F1AC9908E00A1DBDF /* libMobClickLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B4E39C1AC9908E00A1DBDF /* libMobClickLibrary.a */; }; + A9B6DFCC1B1FFDB20003C1BC /* CommentTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B6DFCB1B1FFDB20003C1BC /* CommentTextView.m */; }; + A9B6DFD21B20054B0003C1BC /* CommentTextView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFD11B20054B0003C1BC /* CommentTextView.xib */; }; + A9B6DFD51B201E4E0003C1BC /* share_cancel_highlighted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFD31B201E4E0003C1BC /* share_cancel_highlighted@2x.png */; }; + A9B6DFD61B201E4E0003C1BC /* share_close@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFD41B201E4E0003C1BC /* share_close@2x.png */; }; + A9B6DFD91B201E5B0003C1BC /* share_send_highlighted@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFD71B201E5B0003C1BC /* share_send_highlighted@2x.png */; }; + A9B6DFDA1B201E5B0003C1BC /* share_send@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFD81B201E5B0003C1BC /* share_send@2x.png */; }; + A9B6DFDC1B2023730003C1BC /* recommend_refreshtip_close@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFDB1B2023730003C1BC /* recommend_refreshtip_close@2x.png */; }; + A9B6DFDE1B2028B80003C1BC /* share_cancel@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFDD1B2028B80003C1BC /* share_cancel@2x.png */; }; + A9B6DFE11B202E7D0003C1BC /* comment_support_fake@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFDF1B202E7D0003C1BC /* comment_support_fake@2x.png */; }; + A9B6DFE21B202E7D0003C1BC /* comment_support_plus@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFE01B202E7D0003C1BC /* comment_support_plus@2x.png */; }; + A9B6DFE41B202E950003C1BC /* night_user_comment_circle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFE31B202E950003C1BC /* night_user_comment_circle@2x.png */; }; + A9B6DFE61B2033A80003C1BC /* toolbar_light_comment@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFE51B2033A80003C1BC /* toolbar_light_comment@2x.png */; }; + A9B6DFEC1B2068790003C1BC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A9B6DFEE1B2068790003C1BC /* Localizable.strings */; }; A9BE23BF1ACD8CA20032171A /* libSocialSina.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9BE23BD1ACD8CA20032171A /* libSocialSina.a */; }; A9CF211C1B1C36D0007490EF /* mainCellCommentClickN@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9CF211A1B1C36D0007490EF /* mainCellCommentClickN@2x.png */; }; A9CF211D1B1C36D0007490EF /* mainCellCommentN@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9CF211B1B1C36D0007490EF /* mainCellCommentN@2x.png */; }; @@ -210,6 +227,8 @@ A9FAD4351AC925AC007ADC10 /* LoginViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A9FAD4341AC925AC007ADC10 /* LoginViewModel.m */; }; A9FD82B71B1D433800AC4DC9 /* accessory@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9FD82B51B1D433800AC4DC9 /* accessory@2x.png */; }; A9FD82B81B1D433800AC4DC9 /* accessoryN@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9FD82B61B1D433800AC4DC9 /* accessoryN@2x.png */; }; + A9FD82BC1B1D544300AC4DC9 /* CommentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A9FD82BA1B1D544300AC4DC9 /* CommentTableViewCell.m */; }; + A9FD82BD1B1D544300AC4DC9 /* CommentTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9FD82BB1B1D544300AC4DC9 /* CommentTableViewCell.xib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -273,6 +292,8 @@ A955109C1AC39E6A0006D16F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; 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 = ""; }; + A95CE2E91B1DFD030017AE68 /* NoteCommentViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoteCommentViewModel.h; sourceTree = ""; }; + A95CE2EA1B1DFD030017AE68 /* NoteCommentViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoteCommentViewModel.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 = ""; }; @@ -337,6 +358,8 @@ A968626D1ACCF13300DDAA6B /* PSTGridLayoutSection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSTGridLayoutSection.m; sourceTree = ""; }; A968627B1ACCF3D200DDAA6B /* cellmorebtnnormalN@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cellmorebtnnormalN@2x.png"; sourceTree = ""; }; A968627D1ACCF46E00DDAA6B /* cellmorebtnclickN@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cellmorebtnclickN@2x.png"; sourceTree = ""; }; + A96F27EC1B2195BA00DA0A66 /* UIImageView+Reloading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+Reloading.h"; sourceTree = ""; }; + A96F27ED1B2195BA00DA0A66 /* UIImageView+Reloading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+Reloading.m"; sourceTree = ""; }; A9754A0E1ADC080E0018BAAD /* AudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioPlayer.h; sourceTree = ""; }; A9754A0F1ADC080E0018BAAD /* AudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioPlayer.m; sourceTree = ""; }; A9754A101ADC080E0018BAAD /* AutoRecoveringHttpDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoRecoveringHttpDataSource.h; sourceTree = ""; }; @@ -381,6 +404,10 @@ A97559CB1ACBF0BC004ADA42 /* btn_share@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "btn_share@2x.png"; sourceTree = ""; }; A97883871AD369DF00D46477 /* mainCellDingClick@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mainCellDingClick@2x.png"; sourceTree = ""; }; A97883891AD36A0500D46477 /* mainCellDing@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mainCellDing@2x.png"; sourceTree = ""; }; + A97938731B20A63D00180C08 /* UserViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserViewModel.h; sourceTree = ""; }; + A97938741B20A63D00180C08 /* UserViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserViewModel.m; sourceTree = ""; }; + A97938761B20BB0900180C08 /* CommentViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentViewModel.h; sourceTree = ""; }; + A97938771B20BB0900180C08 /* CommentViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentViewModel.m; 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 = ""; }; @@ -487,6 +514,21 @@ A9B4E39C1AC9908E00A1DBDF /* libMobClickLibrary.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libMobClickLibrary.a; sourceTree = ""; }; A9B4E39D1AC9908E00A1DBDF /* MobClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobClick.h; sourceTree = ""; }; A9B4E39E1AC9908E00A1DBDF /* MobClickSocialAnalytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobClickSocialAnalytics.h; sourceTree = ""; }; + A9B6DFCA1B1FFDB20003C1BC /* CommentTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentTextView.h; sourceTree = ""; }; + A9B6DFCB1B1FFDB20003C1BC /* CommentTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentTextView.m; sourceTree = ""; }; + A9B6DFD11B20054B0003C1BC /* CommentTextView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CommentTextView.xib; sourceTree = ""; }; + A9B6DFD31B201E4E0003C1BC /* share_cancel_highlighted@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "share_cancel_highlighted@2x.png"; sourceTree = ""; }; + A9B6DFD41B201E4E0003C1BC /* share_close@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "share_close@2x.png"; sourceTree = ""; }; + A9B6DFD71B201E5B0003C1BC /* share_send_highlighted@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "share_send_highlighted@2x.png"; sourceTree = ""; }; + A9B6DFD81B201E5B0003C1BC /* share_send@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "share_send@2x.png"; sourceTree = ""; }; + A9B6DFDB1B2023730003C1BC /* recommend_refreshtip_close@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "recommend_refreshtip_close@2x.png"; sourceTree = ""; }; + A9B6DFDD1B2028B80003C1BC /* share_cancel@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "share_cancel@2x.png"; sourceTree = ""; }; + A9B6DFDF1B202E7D0003C1BC /* comment_support_fake@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "comment_support_fake@2x.png"; sourceTree = ""; }; + A9B6DFE01B202E7D0003C1BC /* comment_support_plus@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "comment_support_plus@2x.png"; sourceTree = ""; }; + A9B6DFE31B202E950003C1BC /* night_user_comment_circle@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "night_user_comment_circle@2x.png"; sourceTree = ""; }; + A9B6DFE51B2033A80003C1BC /* toolbar_light_comment@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "toolbar_light_comment@2x.png"; sourceTree = ""; }; + A9B6DFED1B2068790003C1BC /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; + A9B6DFEF1B20687B0003C1BC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; A9BE23BD1ACD8CA20032171A /* libSocialSina.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libSocialSina.a; sourceTree = ""; }; A9BE23BE1ACD8CA20032171A /* UMSocialSinaHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UMSocialSinaHandler.h; sourceTree = ""; }; A9CF211A1B1C36D0007490EF /* mainCellCommentClickN@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mainCellCommentClickN@2x.png"; sourceTree = ""; }; @@ -518,6 +560,9 @@ A9FAD4341AC925AC007ADC10 /* LoginViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewModel.m; sourceTree = ""; }; A9FD82B51B1D433800AC4DC9 /* accessory@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "accessory@2x.png"; sourceTree = ""; }; A9FD82B61B1D433800AC4DC9 /* accessoryN@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "accessoryN@2x.png"; sourceTree = ""; }; + A9FD82B91B1D544300AC4DC9 /* CommentTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentTableViewCell.h; sourceTree = ""; }; + A9FD82BA1B1D544300AC4DC9 /* CommentTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentTableViewCell.m; sourceTree = ""; }; + A9FD82BB1B1D544300AC4DC9 /* CommentTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CommentTableViewCell.xib; sourceTree = ""; }; AD3C5DED2445FC2F0892A525 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; E7B8559E65B4108EA2C3F343 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -603,6 +648,7 @@ A955108F1AC39E6A0006D16F /* Supporting Files */ = { isa = PBXGroup; children = ( + A9B6DFEE1B2068790003C1BC /* Localizable.strings */, A95510901AC39E6A0006D16F /* Info.plist */, A97C54D81AC8FCED0038818A /* PrefixHeader.pch */, A95510911AC39E6A0006D16F /* main.m */, @@ -791,6 +837,8 @@ A97559BE1ACBE6C6004ADA42 /* NotePublishViewModel.m */, A9617A4D1ACC0D0F0024AE4A /* NoteViewModel.h */, A9617A4E1ACC0D0F0024AE4A /* NoteViewModel.m */, + A95CE2E91B1DFD030017AE68 /* NoteCommentViewModel.h */, + A95CE2EA1B1DFD030017AE68 /* NoteCommentViewModel.m */, ); path = Note; sourceTree = ""; @@ -805,6 +853,17 @@ path = Note; sourceTree = ""; }; + A97938721B20A62800180C08 /* Common */ = { + isa = PBXGroup; + children = ( + A97938731B20A63D00180C08 /* UserViewModel.h */, + A97938741B20A63D00180C08 /* UserViewModel.m */, + A97938761B20BB0900180C08 /* CommentViewModel.h */, + A97938771B20BB0900180C08 /* CommentViewModel.m */, + ); + path = Common; + sourceTree = ""; + }; A97C54B71AC8F0370038818A /* ViewControllers */ = { isa = PBXGroup; children = ( @@ -821,6 +880,7 @@ A97C54B81AC8F0370038818A /* ViewModels */ = { isa = PBXGroup; children = ( + A97938721B20A62800180C08 /* Common */, A99AA1271ADCCB3100574B12 /* Message */, A94D0EDA1AD5753A0002DEB1 /* My */, A97559BC1ACBE6B7004ADA42 /* Note */, @@ -918,6 +978,8 @@ A97C54DE1AC91D990038818A /* Tool */ = { isa = PBXGroup; children = ( + A96F27EC1B2195BA00DA0A66 /* UIImageView+Reloading.h */, + A96F27ED1B2195BA00DA0A66 /* UIImageView+Reloading.m */, A97C54DF1AC91DA10038818A /* CommonUtil.h */, A97C54E01AC91DA10038818A /* CommonUtil.m */, A93441DC1ACA311700A6B233 /* Ash_UIUtil.h */, @@ -929,6 +991,10 @@ A97C54E21AC91FD70038818A /* Resource */ = { isa = PBXGroup; children = ( + A9B6DFE51B2033A80003C1BC /* toolbar_light_comment@2x.png */, + A9B6DFE31B202E950003C1BC /* night_user_comment_circle@2x.png */, + A9B6DFDF1B202E7D0003C1BC /* comment_support_fake@2x.png */, + A9B6DFE01B202E7D0003C1BC /* comment_support_plus@2x.png */, A9FD82B51B1D433800AC4DC9 /* accessory@2x.png */, A9FD82B61B1D433800AC4DC9 /* accessoryN@2x.png */, A9CF21291B1C65A2007490EF /* praise-wall-white@2x.png */, @@ -1003,6 +1069,12 @@ A93441E41ACA8AC400A6B233 /* Profile_filter_contentIconClick@2x.png */, A93441DF1ACA89AA00A6B233 /* Profile_filter_voiceIcon@2x.png */, A93441E01ACA89AA00A6B233 /* Profile_filter_voiceIconClick@2x.png */, + A9B6DFDB1B2023730003C1BC /* recommend_refreshtip_close@2x.png */, + A9B6DFD31B201E4E0003C1BC /* share_cancel_highlighted@2x.png */, + A9B6DFD41B201E4E0003C1BC /* share_close@2x.png */, + A9B6DFD71B201E5B0003C1BC /* share_send_highlighted@2x.png */, + A9B6DFD81B201E5B0003C1BC /* share_send@2x.png */, + A9B6DFDD1B2028B80003C1BC /* share_cancel@2x.png */, ); path = Resource; sourceTree = ""; @@ -1170,6 +1242,12 @@ A9CF21241B1C53E3007490EF /* CommentGoodListCellTableViewCell.h */, A9CF21251B1C53E3007490EF /* CommentGoodListCellTableViewCell.m */, A9CF21261B1C53E3007490EF /* CommentGoodListCellTableViewCell.xib */, + A9FD82B91B1D544300AC4DC9 /* CommentTableViewCell.h */, + A9FD82BA1B1D544300AC4DC9 /* CommentTableViewCell.m */, + A9FD82BB1B1D544300AC4DC9 /* CommentTableViewCell.xib */, + A9B6DFCA1B1FFDB20003C1BC /* CommentTextView.h */, + A9B6DFCB1B1FFDB20003C1BC /* CommentTextView.m */, + A9B6DFD11B20054B0003C1BC /* CommentTextView.xib */, ); path = Common; sourceTree = ""; @@ -1296,6 +1374,7 @@ A9EA14C31B02E88300357529 /* LaunchScreen.xib in Resources */, A9CF211D1B1C36D0007490EF /* mainCellCommentN@2x.png in Resources */, A93441FA1ACA919500A6B233 /* tabbarQuotation-dark@2x.png in Resources */, + A9B6DFE21B202E7D0003C1BC /* comment_support_plus@2x.png in Resources */, A97559D01ACBF0BC004ADA42 /* btn_share_clicked@2x.png in Resources */, A90BA01F1AD606AE00728393 /* voice-record-icon@2x.png in Resources */, A9E2711B1ADB97ED000B1542 /* Default-568h.png in Resources */, @@ -1317,11 +1396,14 @@ A99AA12F1ADD028400574B12 /* Icon120.png in Resources */, A98536821AEBC7BB000312BF /* SetUserInfoViewController.xib in Resources */, A97C55071AC933AD0038818A /* UMSShareListController.xib in Resources */, + A9B6DFD91B201E5B0003C1BC /* share_send_highlighted@2x.png in Resources */, A93441EE1ACA8C8F00A6B233 /* defaultUserIcon@2x.png in Resources */, A97559AC1ACB9DF0004ADA42 /* navigationButtonRefresh@2x.png in Resources */, A90BA0181AD6067F00728393 /* voice-continue-record-bg@2x.png in Resources */, A90BA0081AD6060600728393 /* playButton@2x.png in Resources */, + A9B6DFD61B201E4E0003C1BC /* share_close@2x.png in Resources */, A97C54FE1AC933AD0038818A /* UMSocialLocalizable.strings in Resources */, + A9B6DFD51B201E4E0003C1BC /* share_cancel_highlighted@2x.png in Resources */, A93441E91ACA8AD200A6B233 /* Profile_filter_ImageIcon@2x.png in Resources */, A97C55041AC933AD0038818A /* UMShareEditViewControlleriPad.xib in Resources */, A978838A1AD36A0500D46477 /* mainCellDing@2x.png in Resources */, @@ -1330,11 +1412,14 @@ A9617A591ACC2EBC0024AE4A /* mine-setting-icon@2x.png in Resources */, A968627C1ACCF3D200DDAA6B /* cellmorebtnnormalN@2x.png in Resources */, A93442041ACA981D00A6B233 /* Default@2x.png in Resources */, + A9B6DFE11B202E7D0003C1BC /* comment_support_fake@2x.png in Resources */, A97DBE401ACAE29E00705682 /* Icon@2x.png in Resources */, A90BA00A1AD6060600728393 /* playButtonPause@2x.png in Resources */, A97DBE481ACAE7F600705682 /* smalliconWeixin@2x.png in Resources */, A97DBE441ACAE61400705682 /* first-login-qq@2x.png in Resources */, + A9B6DFDC1B2023730003C1BC /* recommend_refreshtip_close@2x.png in Resources */, A9FAD42D1AC923E2007ADC10 /* MessageViewController.xib in Resources */, + A9B6DFE41B202E950003C1BC /* night_user_comment_circle@2x.png in Resources */, A9B4A9551AEDC3620017C655 /* FeedbackViewController.xib in Resources */, A98F986C1ACA2FA9007C4594 /* BaseRefreshViewController.xib in Resources */, A955109D1AC39E6A0006D16F /* Images.xcassets in Resources */, @@ -1356,6 +1441,7 @@ A97559A81ACB9DE4004ADA42 /* navigationButtonPublish@2x.png in Resources */, A98536781AEB7400000312BF /* RegistAccountViewController.xib in Resources */, A97559CE1ACBF0BC004ADA42 /* btn_good_clicked@2x.png in Resources */, + A9B6DFE61B2033A80003C1BC /* toolbar_light_comment@2x.png in Resources */, A97883881AD369DF00D46477 /* mainCellDingClick@2x.png in Resources */, A90BA0211AD606B400728393 /* voice-record-level@2x.png in Resources */, A950AB401AEC8B5E00D0F6DD /* closeButton@2x.png in Resources */, @@ -1366,7 +1452,9 @@ A9CF21221B1C4C70007490EF /* NoteCommentViewController.xib in Resources */, A97559CD1ACBF0BC004ADA42 /* btn_bad@2x.png in Resources */, A93441F71ACA918100A6B233 /* tabbarSetup@2x.png in Resources */, + A9B6DFDE1B2028B80003C1BC /* share_cancel@2x.png in Resources */, A90BA0091AD6060600728393 /* playButtonClick@2x.png in Resources */, + A9FD82BD1B1D544300AC4DC9 /* CommentTableViewCell.xib in Resources */, A98536731AEB66F9000312BF /* ReportViewController.xib in Resources */, A97C55011AC933AD0038818A /* UMSCommentInputController.xib in Resources */, A97559AD1ACB9DF0004ADA42 /* navigationButtonRefreshClick@2x.png in Resources */, @@ -1374,12 +1462,15 @@ A90BA0131AD6066000728393 /* voice-bottom-close@2x.png in Resources */, A93441F81ACA918100A6B233 /* tabbarSetupClick@2x.png in Resources */, A93441FE1ACA919F00A6B233 /* tabbarVoice-dark@2x.png in Resources */, + A9B6DFDA1B201E5B0003C1BC /* share_send@2x.png in Resources */, + A9B6DFD21B20054B0003C1BC /* CommentTextView.xib in Resources */, A9617A581ACC2EBC0024AE4A /* mine-setting-icon-click@2x.png in Resources */, A985368C1AEBDDAB000312BF /* ModifyPassWordViewController.xib in Resources */, A90BA0071AD6060600728393 /* play@2x.png in Resources */, A93441E51ACA8AC400A6B233 /* Profile_filter_contentIcon@2x.png in Resources */, A97559B31ACBC683004ADA42 /* NotePublishViewController.xib in Resources */, A966FB991AD62CAE00542068 /* checkmark@2x.png in Resources */, + A9B6DFEC1B2068790003C1BC /* Localizable.strings in Resources */, A9FAD4231AC922A5007ADC10 /* MainViewController.xib in Resources */, A90BA01D1AD606A700728393 /* voice-record-bg@2x.png in Resources */, A90BA0231AD619B500728393 /* voice-record-level-bg@2x.png in Resources */, @@ -1447,6 +1538,7 @@ A9754A221ADC080E0018BAAD /* LocalFileDataSource.m in Sources */, A97559BF1ACBE6C6004ADA42 /* NotePublishViewModel.m in Sources */, A96862781ACCF13300DDAA6B /* PSTGridLayoutItem.m in Sources */, + A97938781B20BB0900180C08 /* CommentViewModel.m in Sources */, A97559B21ACBC683004ADA42 /* NotePublishViewController.m in Sources */, A9754A1F1ADC080E0018BAAD /* DataSource.m in Sources */, A97C54DD1AC901980038818A /* MBProgressHUD+Util.m in Sources */, @@ -1464,6 +1556,7 @@ A96862761ACCF13300DDAA6B /* PSTCollectionViewUpdateItem.m in Sources */, A968626E1ACCF13300DDAA6B /* NSIndexPath+PSTCollectionViewAdditions.m in Sources */, A9FAD42C1AC923E2007ADC10 /* MessageViewController.m in Sources */, + A97938751B20A63D00180C08 /* UserViewModel.m in Sources */, A985367C1AEB8F89000312BF /* RegistInfoViewController.m in Sources */, A9CF21271B1C53E3007490EF /* CommentGoodListCellTableViewCell.m in Sources */, A98536811AEBC7BB000312BF /* SetUserInfoViewController.m in Sources */, @@ -1507,9 +1600,13 @@ A9FAD4351AC925AC007ADC10 /* LoginViewModel.m in Sources */, A98536861AEBDA1E000312BF /* OurLoginViewController.m in Sources */, A95510921AC39E6A0006D16F /* main.m in Sources */, + A95CE2EB1B1DFD030017AE68 /* NoteCommentViewModel.m in Sources */, A98D659D1AD37F18008668EE /* MessageTableViewCell.m in Sources */, A96862711ACCF13300DDAA6B /* PSTCollectionViewController.m in Sources */, A96862431ACCF0B400DDAA6B /* MWCaptionView.m in Sources */, + A9FD82BC1B1D544300AC4DC9 /* CommentTableViewCell.m in Sources */, + A9B6DFCC1B1FFDB20003C1BC /* CommentTextView.m in Sources */, + A96F27EE1B2195BA00DA0A66 /* UIImageView+Reloading.m in Sources */, A9B4A9541AEDC3620017C655 /* FeedbackViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1534,6 +1631,16 @@ name = UMSocialLocalizable.strings; sourceTree = ""; }; + A9B6DFEE1B2068790003C1BC /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + A9B6DFED1B2068790003C1BC /* zh-Hans */, + A9B6DFEF1B20687B0003C1BC /* en */, + ); + name = Localizable.strings; + path = Resource; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 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 219e524..4404c64 100644 --- a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -51,22 +51,6 @@ landmarkType = "5"> - - - - @@ -665,11 +649,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Note/NoteTableViewCell.m" - timestampString = "454903615.072925" + timestampString = "455187738.062961" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "154" - endingLineNumber = "154" + startingLineNumber = "168" + endingLineNumber = "168" landmarkName = "-setText_Image:" landmarkType = "5"> @@ -729,11 +713,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Pods/MBProgressHUD/MBProgressHUD.m" - timestampString = "451831263.244579" + timestampString = "455129096.335702" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "635" - endingLineNumber = "635" + startingLineNumber = "639" + endingLineNumber = "639" landmarkName = "-drawRect:" landmarkType = "5"> @@ -1577,11 +1561,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Note/NoteTableViewCell.m" - timestampString = "454903615.072925" + timestampString = "455187738.062961" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "165" - endingLineNumber = "165" + startingLineNumber = "179" + endingLineNumber = "179" landmarkName = "-canPerformAction:withSender:" landmarkType = "5"> @@ -1705,7 +1689,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m" - timestampString = "454337336.032283" + timestampString = "455182245.754147" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "296" @@ -1721,7 +1705,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m" - timestampString = "454337336.032283" + timestampString = "455182245.754147" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "279" @@ -1737,7 +1721,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m" - timestampString = "454337336.032283" + timestampString = "455182245.754147" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "274" @@ -1753,12 +1737,12 @@ moduleName = "Ash_AWord" usesParentBreakpointCondition = "Yes" urlString = "file:///Users/xmfish/Documents/Ash_Soft/Ash_AWord/Ash_AWord/ViewControllers/Main/NoteViewController.m" - timestampString = "454337074.055901" + timestampString = "455187536.087896" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "274" endingLineNumber = "274" - offsetFromSymbolStart = "64"> + offsetFromSymbolStart = "51"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/Config/Common.h b/Ash_AWord/Config/Common.h index 9393149..13ea5d4 100644 --- a/Ash_AWord/Config/Common.h +++ b/Ash_AWord/Config/Common.h @@ -95,4 +95,7 @@ */ #define NEWIMAGE_SIZE 700.f +#define DefaultUserIcon [UIImage imageNamed:@"defaultUserIcon"] + +#define DefaultPageSize 20 #endif diff --git a/Ash_AWord/PrefixHeader.pch b/Ash_AWord/PrefixHeader.pch index e8914e3..ecd9dac 100644 --- a/Ash_AWord/PrefixHeader.pch +++ b/Ash_AWord/PrefixHeader.pch @@ -38,6 +38,7 @@ #import "SVWebViewController.h" #import "MobClick.h" #import "LoginViewController.h" +#import "UIImageView+Reloading.h" #endif #endif diff --git a/Ash_AWord/Resource/comment_support_fake@2x.png b/Ash_AWord/Resource/comment_support_fake@2x.png new file mode 100644 index 0000000..4a20db8 Binary files /dev/null and b/Ash_AWord/Resource/comment_support_fake@2x.png differ diff --git a/Ash_AWord/Resource/comment_support_plus@2x.png b/Ash_AWord/Resource/comment_support_plus@2x.png new file mode 100644 index 0000000..8d20619 Binary files /dev/null and b/Ash_AWord/Resource/comment_support_plus@2x.png differ diff --git a/Ash_AWord/Resource/en.lproj/Localizable.strings b/Ash_AWord/Resource/en.lproj/Localizable.strings new file mode 100644 index 0000000..cdab33c --- /dev/null +++ b/Ash_AWord/Resource/en.lproj/Localizable.strings @@ -0,0 +1,10 @@ +/* + Localizable.strings + Ash_AWord + + Created by xmfish on 15/6/4. + Copyright (c) 2015年 ash. All rights reserved. +*/ +"Saving" = "Saving"; +"SaveFailed" = "SaveFailed"; +"Saved" = "Saved"; \ No newline at end of file diff --git a/Ash_AWord/Resource/night_user_comment_circle@2x.png b/Ash_AWord/Resource/night_user_comment_circle@2x.png new file mode 100644 index 0000000..77b4987 Binary files /dev/null and b/Ash_AWord/Resource/night_user_comment_circle@2x.png differ diff --git a/Ash_AWord/Resource/recommend_refreshtip_close@2x.png b/Ash_AWord/Resource/recommend_refreshtip_close@2x.png new file mode 100644 index 0000000..deaee1d Binary files /dev/null and b/Ash_AWord/Resource/recommend_refreshtip_close@2x.png differ diff --git a/Ash_AWord/Resource/share_cancel@2x.png b/Ash_AWord/Resource/share_cancel@2x.png new file mode 100644 index 0000000..419e46f Binary files /dev/null and b/Ash_AWord/Resource/share_cancel@2x.png differ diff --git a/Ash_AWord/Resource/share_cancel_highlighted@2x.png b/Ash_AWord/Resource/share_cancel_highlighted@2x.png new file mode 100644 index 0000000..2789741 Binary files /dev/null and b/Ash_AWord/Resource/share_cancel_highlighted@2x.png differ diff --git a/Ash_AWord/Resource/share_close@2x.png b/Ash_AWord/Resource/share_close@2x.png new file mode 100644 index 0000000..72b6156 Binary files /dev/null and b/Ash_AWord/Resource/share_close@2x.png differ diff --git a/Ash_AWord/Resource/share_send@2x.png b/Ash_AWord/Resource/share_send@2x.png new file mode 100644 index 0000000..8be5302 Binary files /dev/null and b/Ash_AWord/Resource/share_send@2x.png differ diff --git a/Ash_AWord/Resource/share_send_highlighted@2x.png b/Ash_AWord/Resource/share_send_highlighted@2x.png new file mode 100644 index 0000000..56c90ba Binary files /dev/null and b/Ash_AWord/Resource/share_send_highlighted@2x.png differ diff --git a/Ash_AWord/Resource/toolbar_light_comment@2x.png b/Ash_AWord/Resource/toolbar_light_comment@2x.png new file mode 100644 index 0000000..ec8f8dd Binary files /dev/null and b/Ash_AWord/Resource/toolbar_light_comment@2x.png differ diff --git a/Ash_AWord/Resource/zh-Hans.lproj/Localizable.strings b/Ash_AWord/Resource/zh-Hans.lproj/Localizable.strings new file mode 100644 index 0000000..e4b6a35 --- /dev/null +++ b/Ash_AWord/Resource/zh-Hans.lproj/Localizable.strings @@ -0,0 +1,11 @@ +/* + Localizable.strings + Ash_AWord + + Created by xmfish on 15/6/4. + Copyright (c) 2015年 ash. All rights reserved. +*/ + +"Saving" = "保存中"; +"SaveFailed" = "保存失败"; +"Saved" = "保存成功"; \ No newline at end of file diff --git a/Ash_AWord/Utility/Tool/Ash_UIUtil.h b/Ash_AWord/Utility/Tool/Ash_UIUtil.h index acd29a3..99da9de 100644 --- a/Ash_AWord/Utility/Tool/Ash_UIUtil.h +++ b/Ash_AWord/Utility/Tool/Ash_UIUtil.h @@ -10,6 +10,8 @@ @interface Ash_UIUtil : NSObject + ++(CABasicAnimation*)getrotationAnimation; +(CGSize)downloadImageSizeWithURL:(id)imageURL; /** * 通过类名出创建xib类 diff --git a/Ash_AWord/Utility/Tool/Ash_UIUtil.m b/Ash_AWord/Utility/Tool/Ash_UIUtil.m index 626c99e..cfb8c77 100644 --- a/Ash_AWord/Utility/Tool/Ash_UIUtil.m +++ b/Ash_AWord/Utility/Tool/Ash_UIUtil.m @@ -10,6 +10,19 @@ @implementation Ash_UIUtil ++(CABasicAnimation*)getrotationAnimation +{ + CABasicAnimation* rotationAnimation; + rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; + rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ]; + [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + rotationAnimation.duration = 1.0; + rotationAnimation.repeatCount = MAXFLOAT;//你可以设置到最大的整数值 + rotationAnimation.cumulative = NO; + rotationAnimation.removedOnCompletion = NO; + rotationAnimation.fillMode = kCAFillModeForwards; + return rotationAnimation; +} //讨厌警告 -(id)diskImageDataBySearchingAllPathsForKey:(id)key{return nil;} +(CGSize)downloadImageSizeWithURL:(id)imageURL diff --git a/Ash_AWord/Utility/Tool/CommonUtil.m b/Ash_AWord/Utility/Tool/CommonUtil.m index cd27c67..b14e5f8 100644 --- a/Ash_AWord/Utility/Tool/CommonUtil.m +++ b/Ash_AWord/Utility/Tool/CommonUtil.m @@ -184,7 +184,7 @@ NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; // [formatter setDateStyle:NSDateFormatterMediumStyle]; // [formatter setTimeStyle:NSDateFormatterShortStyle]; - [formatter setDateFormat:@"yyyy-MM-dd"]; + [formatter setDateFormat:@"yyyy-MM-dd HH:MM:ss"]; NSDate * d = [NSDate dateWithTimeIntervalSince1970:[timeSp floatValue]/1000]; NSTimeInterval late = [d timeIntervalSince1970]; @@ -218,11 +218,11 @@ if (cha/3600 > 1 && cha/86400 < 1) { - timeString = [NSString stringWithFormat:@"%f", cha/3600]; - - timeString = [timeString substringToIndex:timeString.length-7]; - - timeString = [NSString stringWithFormat:@"%@小时前", timeString]; +// timeString = [NSString stringWithFormat:@"%f", cha/3600]; +// +// timeString = [timeString substringToIndex:timeString.length-7]; +// +// timeString = [NSString stringWithFormat:@"%@小时前", timeString]; } diff --git a/Ash_AWord/Utility/Tool/UIImageView+Reloading.h b/Ash_AWord/Utility/Tool/UIImageView+Reloading.h new file mode 100644 index 0000000..f809fc1 --- /dev/null +++ b/Ash_AWord/Utility/Tool/UIImageView+Reloading.h @@ -0,0 +1,32 @@ +// +// UIImageView+Reloading.h +// XiaoYu +// 可以显示进度,还可以失败重新下载 +// Created by xmfish on 14-8-21. +// Copyright (c) 2014年 Benson. All rights reserved. +// + +#import +#import "UIImageView+WebCache.h" +typedef NS_ENUM(NSInteger, LKImageViewStatus){ + LKImageViewStatusNone = 0, + LKImageViewStatusLoaded = 1, + LKImageViewStatusLoading = 2, + LKImageViewStatusFail = 3 +}; +@interface UIImageView(Reloading) +//加载的图片 url地址 可以是 NSString 或 NSURL +@property(copy, nonatomic) id imageURL; + +//这个不会设置 image 只会保存ImageURL +- (void)setImageURLFromCache:(id)imageURL; + +//当前状态 +@property LKImageViewStatus status; + +//图片点击事件 不用再手动添加UITapGestureRecognizer +@property(copy, nonatomic) void(^onTouchTapBlock)(UIImageView *imageView); + +//重新加载图片 +- (void)reloadImageURL; +@end diff --git a/Ash_AWord/Utility/Tool/UIImageView+Reloading.m b/Ash_AWord/Utility/Tool/UIImageView+Reloading.m new file mode 100644 index 0000000..bb7ea9d --- /dev/null +++ b/Ash_AWord/Utility/Tool/UIImageView+Reloading.m @@ -0,0 +1,335 @@ +// +// UIImageView+Reloading.m +// XiaoYu +// +// Created by xmfish on 14-8-21. +// Copyright (c) 2014年 Benson. All rights reserved. +// + +#import "UIImageView+Reloading.h" + +#import +#import +#import + +@implementation NSObject (Swizzle) + + ++ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_ { + + Method origMethod = class_getInstanceMethod(self, origSel_); + if (!origMethod) { + return NO; + } + Method altMethod = class_getInstanceMethod(self, altSel_); + if (!altMethod) { + return NO; + } + + class_addMethod(self, + origSel_, + class_getMethodImplementation(self, origSel_), + method_getTypeEncoding(origMethod)); + class_addMethod(self, + altSel_, + class_getMethodImplementation(self, altSel_), + method_getTypeEncoding(altMethod)); + + method_exchangeImplementations(class_getInstanceMethod(self, origSel_), class_getInstanceMethod(self, altSel_)); + return YES; +} + ++ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_ { + return [object_getClass((id)self) jr_swizzleMethod:origSel_ withMethod:altSel_ error:error_]; +} + +@end + + +static char imageURLKey; +static char imageStatusKey; +static char imageTapEventKey; +static char imageOriginalModelKey; +@implementation UIImageView (SY) ++ (void)load +{ + [UIImageView jr_swizzleMethod:@selector(cancelCurrentImageLoad) withMethod:@selector(sy_cancelCurrentImageLoad) error:nil]; +} + +- (UIButton *)sy_progressView:(BOOL)isCreate +{ + static char imageProgressKey; + UIButton *progressView = objc_getAssociatedObject(self, &imageProgressKey); + if (isCreate) + { + if (progressView == nil) + { + progressView = [UIButton buttonWithType:UIButtonTypeCustom]; + progressView.frame = self.bounds; + progressView.hidden = YES; + progressView.backgroundColor = [UIColor clearColor]; + [progressView setTitle:@"点击加载图片" forState:UIControlStateNormal]; + [progressView setTitle:@"图片加载中" forState:UIControlStateDisabled]; + progressView.titleLabel.shadowColor = [UIColor whiteColor]; + progressView.titleLabel.shadowOffset = CGSizeMake(1, 1); + [progressView setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal]; + [progressView setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled]; + progressView.titleLabel.adjustsFontSizeToFitWidth = YES; +// CGSize size = CGSizeMake(progressView.frame.size.width,2000); +// CGSize labelsize = [progressView.titleLabel.text sizeWithFont:progressView.titleLabel.font constrainedToSize:size lineBreakMode:NSLineBreakByCharWrapping]; +// progressView.frame = CGRectMake(0.0, 0.0, self.bounds.size.width, self.bounds.size.height); + progressView.center = CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); + [progressView addTarget:self action:@selector(reloadImageURL) forControlEvents:UIControlEventTouchUpInside]; + progressView.enabled = NO; + objc_setAssociatedObject(self, &imageProgressKey, progressView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } + + __weak UIImageView* wself = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [wself addSubview:progressView]; + }); + } + return progressView; +} + +- (UIViewContentMode)originalViewContentMode +{ + NSNumber *value = objc_getAssociatedObject(self, &imageOriginalModelKey); + int mode = -1; + if (value) + { + mode = [value intValue]; + } + if (mode < 0 || mode > UIViewContentModeBottomRight) + { + return -1; + } + else + { + return mode; + } +} + +- (void)setOriginalViewContentMode:(UIViewContentMode)originalViewContentMode +{ + NSNumber *value = [[NSNumber alloc] initWithInt:originalViewContentMode]; + objc_setAssociatedObject(self, &imageOriginalModelKey, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (LKImageViewStatus)status +{ + NSNumber *value = objc_getAssociatedObject(self, &imageStatusKey); + if (value) + { + return [value intValue]; + } + return LKImageViewStatusNone; +} + +- (void)setStatus:(LKImageViewStatus)status +{ + objc_setAssociatedObject(self, &imageStatusKey, @(status), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} +- (void)setImageURLFromCache:(id)imageURL +{ + [self sy_loadTapEvent]; + self.status = LKImageViewStatusLoaded; + objc_setAssociatedObject(self, &imageURLKey, imageURL, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (void)setImageURL:(id)imageURL +{ + [self sy_loadTapEvent]; + objc_setAssociatedObject(self, &imageURLKey, imageURL, OBJC_ASSOCIATION_COPY_NONATOMIC); + if (imageURL) + { + [self reloadImageURL]; + } + else + { + [self sy_cancelCurrentImageLoad]; + self.image = nil; + self.backgroundColor = [UIColor colorWithRed:233/255.0 green:228/255.0 blue:223/255.0 alpha:1]; + self.status = LKImageViewStatusNone; + + UIButton *pv = [self sy_progressView:NO]; + [pv removeFromSuperview]; + } +} + +- (void)sy_loadTapEvent +{ + static char tapEventLoadedKey; + id loaded = objc_getAssociatedObject(self, &tapEventLoadedKey); + if (loaded == nil) + { + self.userInteractionEnabled = YES; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sy_handleTapEvent:)]; + [self addGestureRecognizer:tap]; + objc_setAssociatedObject(self, &tapEventLoadedKey, @(YES), OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } +} + +- (id)getImageURL +{ + return objc_getAssociatedObject(self, &imageURLKey); +} + +- (void)sy_cancelCurrentImageLoad +{ + if ([self getImageURL]) + { + void *callstack[2]; + int frames = backtrace(callstack, 2); + char **strs = backtrace_symbols(callstack, 2); + NSString *func_name = nil; + if (frames > 1 && strs && strs[1]) + { + func_name = [NSString stringWithUTF8String:strs[1]]; + } + free(strs); + + //如果从外部调用 cancelImageLoad 才进行扫尾工作 + if ([func_name rangeOfString:@"UIImageView(WebCache)"].length == 0) + { + UIButton *pv = [self sy_progressView:NO]; +// pv.hidden = YES; + [pv removeFromSuperview]; + + self.status = LKImageViewStatusNone; + } + } + [self sy_cancelCurrentImageLoad]; +} + +- (void)reloadImageURL +{ + id imageURL = [self getImageURL]; + if ([imageURL isKindOfClass:[NSString class]]) + { + if ([imageURL isEqualToString:@""] == NO) + { + imageURL = [NSURL URLWithString:imageURL]; + } + } + if ([imageURL isKindOfClass:[NSURL class]] == NO) + { + return; + } + + [self sy_cancelCurrentImageLoad]; + + self.image = nil; + self.backgroundColor = [UIColor colorWithRed:233/255.0 green:228/255.0 blue:223/255.0 alpha:1]; + + __weak UIImageView *wself = self; + if([self originalViewContentMode] < 0){ + [self setOriginalViewContentMode:self.contentMode]; + } + self.contentMode = UIViewContentModeScaleAspectFill; + + self.status = LKImageViewStatusLoading; + + __weak __block UIButton *pv = [self sy_progressView:YES]; + dispatch_async(dispatch_get_main_queue(), ^{ + pv.hidden = NO; + pv.enabled = NO; + }); + + [self sd_setImageWithURL:imageURL placeholderImage:self.image options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize) { + + float pvalue = MAX(0, MIN(1, receivedSize / (float) expectedSize)); + dispatch_async(dispatch_get_main_queue(), ^{ +// [pv.titleLabel setText:[NSString stringWithFormat:@"图片加载中%.1f %%",pvalue*100]]; + pv.center = CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); + [pv setTitle:[NSString stringWithFormat:@"图片加载中%.1f %%",pvalue*100] forState:UIControlStateDisabled]; + pv.hidden = NO; + }); + + } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { + if(!pv){ + pv = [wself sy_progressView:NO]; + } + + if (image) + { + pv.hidden = YES; + dispatch_async(dispatch_get_main_queue(), ^{ + [pv removeFromSuperview]; + }); + + if([wself originalViewContentMode]>=0){ + + if(wself.contentMode != [wself originalViewContentMode]){ + wself.contentMode = [wself originalViewContentMode]; + [wself setNeedsDisplay]; + } + } + else if (wself.contentMode != UIViewContentModeScaleAspectFill) + { + wself.contentMode = UIViewContentModeScaleAspectFill; + [wself setNeedsDisplay]; + } + + wself.status = LKImageViewStatusLoaded; + wself.backgroundColor = [UIColor clearColor]; + [wself setOriginalViewContentMode:-1]; + + } + else + { + if (error) + { + + wself.status = LKImageViewStatusFail; + [wself setOriginalViewContentMode:-1]; + dispatch_async(dispatch_get_main_queue(), ^{ + pv.enabled = YES; + }); + } + } + }]; +} + +- (void)setOnTouchTapBlock:(void (^)(UIImageView *))onTouchTapBlock +{ + [self sy_loadTapEvent]; + objc_setAssociatedObject(self, &imageTapEventKey, onTouchTapBlock, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (void (^)(UIImageView *))onTouchTapBlock +{ + return objc_getAssociatedObject(self, &imageTapEventKey); +} + +- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event +{ + if ([self getImageURL] && self.status != LKImageViewStatusFail && self.onTouchTapBlock == nil) + { + return NO; + } + if (self.status == LKImageViewStatusLoading || self.status == LKImageViewStatusFail) { + UIButton* pv = [self sy_progressView:NO]; + if (self.status == LKImageViewStatusFail && [pv pointInside:[self convertPoint:point toView:pv] withEvent:event]) { + return YES; + } + return NO; + } + return [super pointInside:point withEvent:event]; +} +- (void)sy_handleTapEvent:(UITapGestureRecognizer *)sender +{ + switch (self.status) + { + case LKImageViewStatusFail: + [self reloadImageURL]; + break; + default: + if (self.onTouchTapBlock) + { + self.onTouchTapBlock(self); + } + break; + } +} +@end diff --git a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.h b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.h index 728d5cf..1102ea5 100644 --- a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.h +++ b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.h @@ -68,4 +68,5 @@ - (void)showNextPhotoAnimated:(BOOL)animated; - (void)showPreviousPhotoAnimated:(BOOL)animated; +-(void)didSavePhoto; @end diff --git a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.m b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.m index 1dfebd5..2a49f7b 100644 --- a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.m +++ b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWPhotoBrowser.m @@ -173,6 +173,7 @@ _toolbar.barStyle = UIBarStyleBlackTranslucent; _toolbar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth; + // Toolbar Items if (self.displayNavArrows) { NSString *arrowPathFormat; @@ -202,7 +203,6 @@ // Super [super viewDidLoad]; - } - (void)performLayout { @@ -392,6 +392,7 @@ } _viewHasAppearedInitially = YES; } + self.navigationController.navigationBarHidden = YES; } @@ -1502,13 +1503,13 @@ self.activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil]; // Show loading spinner after a couple of seconds - double delayInSeconds = 2.0; - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ - if (self.activityViewController) { - [self showProgressHUDWithMessage:nil]; - } - }); +// double delayInSeconds = 2.0; +// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); +// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ +// if (self.activityViewController) { +// [self showProgressHUDWithMessage:nil]; +// } +// }); // Show typeof(self) __weak weakSelf = self; @@ -1593,6 +1594,10 @@ self.navigationController.navigationBar.userInteractionEnabled = YES; } +-(void)didSavePhoto +{ + [self savePhoto]; +} #pragma mark - Actions - (void)savePhoto { @@ -1611,7 +1616,7 @@ } - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { - [self showProgressHUDCompleteMessage: error ? NSLocalizedString(@"Failed", @"Informing the user a process has failed") : NSLocalizedString(@"Saved", @"Informing the user an item has been saved")]; + [self showProgressHUDCompleteMessage: error ? NSLocalizedString(@"SaveFailed", @"Informing the user a process has failed") : NSLocalizedString(@"Saved", @"Informing the user an item has been saved")]; [self hideControlsAfterDelay]; // Continue as normal... } diff --git a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.h b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.h index 8445b62..933f6bf 100644 --- a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.h +++ b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.h @@ -23,5 +23,6 @@ - (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch; - (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch; - (void)imageView:(UIImageView *)imageView tripleTapDetected:(UITouch *)touch; +- (void)imageView:(UIImageView *)imageView longTapDetected:(UIGestureRecognizer *)gestureRecognizer; @end \ No newline at end of file diff --git a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.m b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.m index b0666ba..38d9df3 100644 --- a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.m +++ b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWTapDetectingImageView.m @@ -12,6 +12,10 @@ - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { + UILongPressGestureRecognizer *longpress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onlongtabed:)]; + longpress.minimumPressDuration = 1.0;///至少按1秒 + longpress.numberOfTouchesRequired = 1;//只有一个触点 + [self addGestureRecognizer:longpress]; self.userInteractionEnabled = YES; } return self; @@ -19,6 +23,10 @@ - (id)initWithImage:(UIImage *)image { if ((self = [super initWithImage:image])) { + UILongPressGestureRecognizer *longpress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onlongtabed:)]; + longpress.minimumPressDuration = 1.0;///至少按1秒 + longpress.numberOfTouchesRequired = 1;//只有一个触点 + [self addGestureRecognizer:longpress]; self.userInteractionEnabled = YES; } return self; @@ -26,11 +34,23 @@ - (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage { if ((self = [super initWithImage:image highlightedImage:highlightedImage])) { + + UILongPressGestureRecognizer *longpress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onlongtabed:)]; + longpress.minimumPressDuration = 1.0;///至少按1秒 + longpress.numberOfTouchesRequired = 1;//只有一个触点 + [self addGestureRecognizer:longpress]; self.userInteractionEnabled = YES; } return self; } + +-(void)onlongtabed:(UIGestureRecognizer*)gestureRecognizer +{ + if(gestureRecognizer.state == UIGestureRecognizerStateBegan){ + [self handleLongTap:gestureRecognizer]; + } +} - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; NSUInteger tapCount = touch.tapCount; @@ -64,5 +84,8 @@ if ([_tapDelegate respondsToSelector:@selector(imageView:tripleTapDetected:)]) [_tapDelegate imageView:self tripleTapDetected:touch]; } - +-(void)handleLongTap:(UIGestureRecognizer*)gestureRecognizer{ + if ([_tapDelegate respondsToSelector:@selector(imageView:longTapDetected:)]) + [_tapDelegate imageView:self longTapDetected:gestureRecognizer]; +} @end diff --git a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWZoomingScrollView.m b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWZoomingScrollView.m index 6a03a44..697990a 100644 --- a/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWZoomingScrollView.m +++ b/Ash_AWord/Vender/MWPhotoBrowser/MWPhotoBrowser/Classes/MWZoomingScrollView.m @@ -14,7 +14,7 @@ #import "MWPhotoBrowserPrivate.h" // Private methods and properties -@interface MWZoomingScrollView () { +@interface MWZoomingScrollView () { MWPhotoBrowser __weak *_photoBrowser; MWTapDetectingView *_tapView; // for background taps @@ -157,7 +157,9 @@ // Image failed so just show black! - (void)displayImageFailure { [self hideLoadingIndicator]; - _photoImageView.image = nil; + _photoImageView.image = [UIImage imageNamed:@"MWPhotoBrowser.bundle/images/ImageError.png"]; + _photoImageView.hidden = NO; + return; if (!_loadingError) { _loadingError = [UIImageView new]; _loadingError.image = [UIImage imageNamed:@"MWPhotoBrowser.bundle/images/ImageError.png"]; @@ -349,6 +351,12 @@ #pragma mark - Tap Detection - (void)handleSingleTap:(CGPoint)touchPoint { + +// [UIView animateWithDuration:0.3 animations:^{ +// _photoBrowser.navigationController.navigationBarHidden = !_photoBrowser.navigationController.navigationBarHidden; +// }]; + [_photoBrowser.navigationController popViewControllerAnimated:YES]; + [_photoBrowser performSelector:@selector(toggleControls) withObject:nil afterDelay:0.2]; } @@ -380,11 +388,27 @@ // Image View - (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch { - [self handleSingleTap:[touch locationInView:imageView]]; +// [self handleSingleTap:[touch locationInView:imageView]]; + [_photoBrowser.navigationController popViewControllerAnimated:YES]; } - (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch { [self handleDoubleTap:[touch locationInView:imageView]]; } +-(void)imageView:(UIImageView *)imageView longTapDetected:(UIGestureRecognizer *)gestureRecognizer +{ + UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"保存图片", nil]; + actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; + [actionSheet showInView:self]; +} + +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex +{ + if (buttonIndex == 0) { + [_photoBrowser didSavePhoto]; + } + + +} // Background View - (void)view:(UIView *)view singleTapDetected:(UITouch *)touch { diff --git a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m index d017744..72d9762 100644 --- a/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m +++ b/Ash_AWord/ViewControllers/Common/BaseRefreshViewController.m @@ -22,10 +22,10 @@ self.tableView.delegate = self; self.tableView.dataSource = self; [self.tableView addLegendHeaderWithRefreshingTarget:self refreshingAction:@selector(headerRereshing)]; - [self.tableView addLegendFooterWithRefreshingTarget:self refreshingAction:@selector(footerRereshing)]; +// [self.tableView addLegendFooterWithRefreshingTarget:self refreshingAction:@selector(footerRereshing)]; [self customViewDidLoad]; [self.tableView.footer setTitle:@"" forState:MJRefreshFooterStateNoMoreData]; - self.tableView.separatorColor = [UIColor clearColor]; +// self.tableView.separatorColor = [UIColor clearColor]; } #pragma mark MJRefreshDelegate diff --git a/Ash_AWord/ViewControllers/Note/NoteCommentViewController.h b/Ash_AWord/ViewControllers/Note/NoteCommentViewController.h index bef6fe3..310a50b 100644 --- a/Ash_AWord/ViewControllers/Note/NoteCommentViewController.h +++ b/Ash_AWord/ViewControllers/Note/NoteCommentViewController.h @@ -7,7 +7,13 @@ // #import - -@interface NoteCommentViewController : UIViewController - +#import "BaseRefreshViewController.h" +@class Text_Image; +@interface NoteCommentViewController : BaseRefreshViewController +@property (weak, nonatomic) IBOutlet UITableView *tableView; +@property (weak, nonatomic) IBOutlet UIView *lineView; +- (IBAction)commentBtnClick:(id)sender; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lineHeight; +@property (weak, nonatomic) IBOutlet UIButton *commentBtn; +@property (strong, nonatomic)Text_Image* text_image; @end diff --git a/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m b/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m index 7e9412e..62ad536 100644 --- a/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m +++ b/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m @@ -7,9 +7,21 @@ // #import "NoteCommentViewController.h" - -@interface NoteCommentViewController () - +#import "NoteTableViewCell.h" +#import "NoteViewModel.h" +#import "CommentTextView.h" +#import "CommentGoodListCellTableViewCell.h" +#import "UserViewModel.h" +#import "CommentViewModel.h" +#import "CommentTableViewCell.h" +@interface NoteCommentViewController () +{ + NoteTableViewCell* _headView; + CommentTextView* _commentTextView; + CommentGoodListCellTableViewCell* _commentGoodListCellTableViewCell; + NSInteger _page; + NSMutableArray* _commentInfoArr; +} @end @implementation NoteCommentViewController @@ -17,8 +29,166 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. + _page = 1; + _commentInfoArr = [[NSMutableArray alloc] init]; + [self customViewDidLoad]; + self.navigationItem.title = @"评论"; + + self.tableView.delegate = self; + self.tableView.dataSource = self; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + + _headView = [Ash_UIUtil instanceXibView:@"NoteTableViewCell"]; + [_headView setText_Image:_text_image]; + CGFloat height = [NoteTableViewCell heightWith:_text_image]; + _headView.frame = CGRectMake(0, 0, kScreenWidth, height); + _headView.isComment = YES; + UIView* tableHeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, height+80)]; + [tableHeadView addSubview:_headView]; + + _commentGoodListCellTableViewCell = [Ash_UIUtil instanceXibView:@"CommentGoodListCellTableViewCell"]; + _commentGoodListCellTableViewCell.frame = CGRectMake(0, height, kScreenWidth, 80); + [tableHeadView addSubview:_commentGoodListCellTableViewCell]; + + self.tableView.tableHeaderView = tableHeadView; + + _lineView.backgroundColor = [UIColor lineColor]; + _lineHeight.constant = 0.5; + + CGFloat top = 0; // 顶端盖高度 + CGFloat bottom = 0 ; // 底端盖高度 + CGFloat left = 50; // 左端盖宽度 + CGFloat right = 30; // 右端盖宽度 + UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right); + + UIImage *img=[UIImage imageNamed:@"toolbar_light_comment.png"]; + img=[img resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch]; + [_commentBtn setBackgroundImage:img forState:UIControlStateNormal]; + + + _commentTextView = [Ash_UIUtil instanceXibView:@"CommentTextView"]; + _commentTextView.frame = self.view.frame; + [self.view addSubview:_commentTextView]; + _commentTextView.recordId = _text_image.messageId; + [_commentTextView setHidden:YES]; + + + [self loadData]; + [self requirePraiseUser]; + CGPoint point = self.tableView.contentOffset; + point.y = height; + [self.tableView setContentOffset:point]; } + +-(void)requirePraiseUser +{ + PropertyEntity* pro = [UserViewModel requireLoadPraiseUserWithRecordId:_text_image.messageId withPage:1 withPage_size:10]; + [RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) { + if ([viewModel success]) { + [_commentGoodListCellTableViewCell setUserInfoArr:[(UserViewModel*)viewModel userInfoArr]]; + } + } failedBlock:^(NSError *error) { + + }]; +} + +#pragma mark MJRefreshDelegate +-(void)headerRereshing +{ + _page=1; + [self requirePraiseUser]; + [self loadData]; +} +-(void)footerRereshing +{ + [self loadData]; +} +-(void)loadData +{ + [MobClick event:kUmen_note]; + + PropertyEntity* pro = [CommentViewModel requireLoadCommentWithRecordId:_text_image.messageId withPage:_page withPage_size:DefaultPageSize]; + [RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) { + + if ([viewModel success]) { + CommentViewModel* commentViewModel = (CommentViewModel*)viewModel; + + if (_page <= 1) { + [_commentInfoArr removeAllObjects]; + } + if (commentViewModel.commentInfoArr) { + [_commentInfoArr addObjectsFromArray:commentViewModel.commentInfoArr]; + } + [self footerEndRefreshing]; + [self headerEndRefreshing]; + if (commentViewModel.commentInfoArr.count - + - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/ViewModels/Common/CommentViewModel.h b/Ash_AWord/ViewModels/Common/CommentViewModel.h new file mode 100644 index 0000000..ab1b85e --- /dev/null +++ b/Ash_AWord/ViewModels/Common/CommentViewModel.h @@ -0,0 +1,26 @@ +// +// CommentViewModel.h +// Ash_AWord +// +// Created by xmfish on 15/6/5. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "BaseViewModel.h" + +@interface CommentInfoViewModel : BaseViewModel +@property (nonatomic, strong) NSString *commentId; +@property (nonatomic, strong) NSString *ownerId; +@property (nonatomic, strong) NSString *ownerFigureurl; +@property (nonatomic, strong) NSString *ownerName; +@property (nonatomic, strong) NSString *content; +@property (nonatomic, strong) NSString *createTime; +@end +@interface CommentViewModel : BaseViewModel + +@property (nonatomic, strong)NSArray* commentInfoArr; + ++(PropertyEntity*)requireAddCommentWithReconrdId:(NSInteger)recordId withContent:(NSString*)content; + ++(PropertyEntity*)requireLoadCommentWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size; +@end diff --git a/Ash_AWord/ViewModels/Common/CommentViewModel.m b/Ash_AWord/ViewModels/Common/CommentViewModel.m new file mode 100644 index 0000000..f2a321f --- /dev/null +++ b/Ash_AWord/ViewModels/Common/CommentViewModel.m @@ -0,0 +1,65 @@ +// +// CommentViewModel.m +// Ash_AWord +// +// Created by xmfish on 15/6/5. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "CommentViewModel.h" + +@implementation CommentInfoViewModel ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + return @{ + @"content": @"content", + @"createTime": @"createTime", + @"commentId": @"id", + @"ownerId" : @"ownerId", + @"ownerFigureurl" : @"ownerFigureurl", + @"ownerName" : @"ownerName", + }; +} +@end +@implementation CommentViewModel ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + NSMutableDictionary* dic = [NSMutableDictionary dictionaryWithDictionary:[super JSONKeyPathsByPropertyKey]]; + [dic setObject:@"comments" forKey:@"commentInfoArr"]; + return dic; +} +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error { + self = [super initWithDictionary:dictionaryValue error:error]; + if (self == nil) return nil; + + return self; +} ++ (NSValueTransformer *)commentInfoArrJSONTransformer{ + return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:CommentInfoViewModel.class]; +} + ++(PropertyEntity*)requireAddCommentWithReconrdId:(NSInteger)recordId withContent:(NSString *)content +{ + PropertyEntity *pro = [[PropertyEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithPOST; + pro.reqURL = @"rs/text_image/add_comment"; + pro.responesOBJ = self.class; + pro.pro = @{ + @"record_id": [NSString stringWithFormat:@"%ld",recordId], + @"content": content, + }; + + return pro; +} ++(PropertyEntity*)requireLoadCommentWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size +{ + PropertyEntity *pro = [[PropertyEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithGET; + pro.reqURL = @"rs/text_image/load_comment"; + pro.responesOBJ = self.class; + pro.pro = @{@"record_id": [NSString stringWithFormat:@"%ld",recordId], + @"page": [NSString stringWithFormat:@"%ld",page], + @"page_size": [NSString stringWithFormat:@"%ld",page_size], + }; + + return pro; +} +@end diff --git a/Ash_AWord/ViewModels/Common/UserViewModel.h b/Ash_AWord/ViewModels/Common/UserViewModel.h new file mode 100644 index 0000000..674bce4 --- /dev/null +++ b/Ash_AWord/ViewModels/Common/UserViewModel.h @@ -0,0 +1,25 @@ +// +// UserInfoViewModel.h +// Ash_AWord +// +// Created by xmfish on 15/6/4. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "BaseViewModel.h" + +@interface UserInfoViewModel : BaseViewModel +@property (nonatomic, strong) NSString *uid; +@property (nonatomic, strong) NSString *name; +@property (nonatomic, strong) NSString *gender; +@property (nonatomic, strong) NSString *figureurl; + + + +@end + +@interface UserViewModel : BaseViewModel +@property (nonatomic, strong) NSArray *userInfoArr;; + ++(PropertyEntity*)requireLoadPraiseUserWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size; +@end diff --git a/Ash_AWord/ViewModels/Common/UserViewModel.m b/Ash_AWord/ViewModels/Common/UserViewModel.m new file mode 100644 index 0000000..9ed2254 --- /dev/null +++ b/Ash_AWord/ViewModels/Common/UserViewModel.m @@ -0,0 +1,47 @@ +// +// UserInfoViewModel.m +// Ash_AWord +// +// Created by xmfish on 15/6/4. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "UserViewModel.h" + +@implementation UserInfoViewModel + + + +@end + +@implementation UserViewModel + ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + NSMutableDictionary* dic = [NSMutableDictionary dictionaryWithDictionary:[super JSONKeyPathsByPropertyKey]]; + [dic setObject:@"users" forKey:@"userInfoArr"]; + return dic; +} +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error { + self = [super initWithDictionary:dictionaryValue error:error]; + if (self == nil) return nil; + + return self; +} ++ (NSValueTransformer *)userInfoArrJSONTransformer{ + return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:UserInfoViewModel.class]; +} ++(PropertyEntity*)requireLoadPraiseUserWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size +{ + PropertyEntity *pro = [[PropertyEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithGET; + pro.reqURL = @"rs/text_image/load_praise_user"; + pro.responesOBJ = self.class; + pro.pro = @{@"record_id": [NSString stringWithFormat:@"%ld",recordId], + @"page": [NSString stringWithFormat:@"%ld",(long)page], + @"page_size": [NSString stringWithFormat:@"%ld",(long)page_size], + }; + + return pro; +} + +@end \ No newline at end of file diff --git a/Ash_AWord/ViewModels/Note/NoteCommentViewModel.h b/Ash_AWord/ViewModels/Note/NoteCommentViewModel.h new file mode 100644 index 0000000..480721e --- /dev/null +++ b/Ash_AWord/ViewModels/Note/NoteCommentViewModel.h @@ -0,0 +1,26 @@ +// +// NoteCommentViewModel.h +// Ash_AWord +// +// Created by xmfish on 15/6/2. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "BaseViewModel.h" + +@interface NoteCommentInfoViewModel : BaseViewModel +@property (nonatomic, strong)NSString* commentId; +@property (nonatomic, strong)NSString* ownerId; +@property (nonatomic, strong) NSURL *ownerFigureUrl; +@property (nonatomic, strong) NSString *ownerName; +@property (nonatomic, strong) NSString *content; +@property (nonatomic, strong) NSString *createTime; +@end +@interface NoteCommentViewModel : BaseViewModel + +@property (nonatomic, strong)NSArray* commentArr; + ++(PropertyEntity*)requireLoadWithPage:(NSInteger)page withPage_size:(NSInteger)page_size withRecordId:(NSString*)recordId; + ++(PropertyEntity*)requireAddwithRecordId:(NSString*)recordId withContent:(NSString*)content; +@end diff --git a/Ash_AWord/ViewModels/Note/NoteCommentViewModel.m b/Ash_AWord/ViewModels/Note/NoteCommentViewModel.m new file mode 100644 index 0000000..166c298 --- /dev/null +++ b/Ash_AWord/ViewModels/Note/NoteCommentViewModel.m @@ -0,0 +1,78 @@ +// +// NoteCommentViewModel.m +// Ash_AWord +// +// Created by xmfish on 15/6/2. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "NoteCommentViewModel.h" + +@implementation NoteCommentInfoViewModel + ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + return @{ + @"content": @"content", + @"createTime": @"createTime", + @"commentId": @"id", + @"ownerId" : @"ownerId", + @"ownerFigureurl" : @"ownerFigureurl", + @"ownerName" : @"ownerName", + }; +} ++ (NSValueTransformer *)ownerFigureurlJSONTransformer { + 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 NoteCommentViewModel ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + NSMutableDictionary* dic = [NSMutableDictionary dictionaryWithDictionary:[super JSONKeyPathsByPropertyKey]]; + [dic setObject:@"comments" forKey:@"commentArr"]; + return dic; +} +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error { + self = [super initWithDictionary:dictionaryValue error:error]; + if (self == nil) return nil; + + return self; +} ++ (NSValueTransformer *)commentArrJSONTransformer{ + return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:NoteCommentInfoViewModel.class]; +} + + ++(PropertyEntity*)requireLoadWithPage:(NSInteger)page withPage_size:(NSInteger)page_size withRecordId:(NSString *)recordId +{ + PropertyEntity *pro = [[PropertyEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithGET; + pro.reqURL = @"rs/text_image/load_comment"; + pro.responesOBJ = self.class; + pro.pro = @{@"record_id": recordId, + @"page": [NSString stringWithFormat:@"%ld",(long)page], + @"page_size": [NSString stringWithFormat:@"%ld",(long)page_size], + }; + + return pro; +} ++(PropertyEntity*)requireAddwithRecordId:(NSString *)recordId withContent:(NSString *)content +{ + PropertyEntity *pro = [[PropertyEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithGET; + pro.reqURL = @"rs/text_image/add_comment"; + pro.responesOBJ = self.class; + pro.pro = @{@"record_id": recordId, + @"content": content, + }; + + return pro; +} +@end diff --git a/Ash_AWord/ViewModels/Note/NoteViewModel.h b/Ash_AWord/ViewModels/Note/NoteViewModel.h index b812290..887e108 100644 --- a/Ash_AWord/ViewModels/Note/NoteViewModel.h +++ b/Ash_AWord/ViewModels/Note/NoteViewModel.h @@ -41,4 +41,7 @@ typedef enum { +(PropertyEntity*)requireDelWithRecordId:(NSInteger)recordId; + + + @end diff --git a/Ash_AWord/ViewModels/Note/NoteViewModel.m b/Ash_AWord/ViewModels/Note/NoteViewModel.m index 00b9460..e5e7bbe 100644 --- a/Ash_AWord/ViewModels/Note/NoteViewModel.m +++ b/Ash_AWord/ViewModels/Note/NoteViewModel.m @@ -65,8 +65,8 @@ 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], + @"page": [NSString stringWithFormat:@"%ld",(long)page], + @"page_size": [NSString stringWithFormat:@"%ld",(long)page_size], }; return pro; @@ -138,4 +138,6 @@ return pro; } + + @end diff --git a/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.h b/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.h index 2686e5b..05b4f7c 100644 --- a/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.h +++ b/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.h @@ -11,4 +11,7 @@ @interface CommentGoodListCellTableViewCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIImageView *barBtImageView; +- (IBAction)showMoreBtnClick:(id)sender; +@property (weak, nonatomic) IBOutlet UIButton *showMoreBtn; +-(void)setUserInfoArr:(NSArray*)userInfoArr; @end diff --git a/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.m b/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.m index 8bce838..71216cd 100644 --- a/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.m +++ b/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.m @@ -7,11 +7,13 @@ // #import "CommentGoodListCellTableViewCell.h" +#import "UserViewModel.h" @implementation CommentGoodListCellTableViewCell - (void)awakeFromNib { // Initialization code + [self setUserInfoArr:nil]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { @@ -20,4 +22,39 @@ // Configure the view for the selected state } +- (IBAction)showMoreBtnClick:(id)sender { +} + +-(void)setUserInfoArr:(NSArray *)userInfoArr +{ + + for (UIView* view in [_barBtImageView subviews]) { + if (view.tag != 100) { + [view removeFromSuperview]; + } + } + for (int i=0; i kScreenWidth-40) { + break; + } + UserInfoViewModel* userInfoViewModel = [userInfoArr objectAtIndex:i]; + UIImageView* imageView = [[UIImageView alloc] initWithFrame:CGRectMake(i*48+10, 18, 36, 36)]; + imageView.backgroundColor = [UIColor lightGrayColor]; + imageView.layer.cornerRadius = imageView.frame.size.width/2; + imageView.layer.masksToBounds = YES; + [imageView sd_setImageWithURL:[NSURL URLWithString:userInfoViewModel.figureurl] placeholderImage:DefaultUserIcon]; + [_barBtImageView addSubview:imageView]; + } + if (userInfoArr.count == 0) { + UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(10, 18, 300, 36)]; + label.text = @"还没有人点赞呢~"; + label.textColor = [UIColor lightGrayColor]; + [_barBtImageView addSubview:label]; + [_showMoreBtn setEnabled:NO]; + }else + { + [_showMoreBtn setEnabled:YES]; + } +} + @end diff --git a/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.xib b/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.xib index 6004a5b..475f532 100644 --- a/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.xib +++ b/Ash_AWord/Views/Common/CommentGoodListCellTableViewCell.xib @@ -16,31 +16,56 @@ - + - - + + + + + + - - + + + + + + + + + + + + + + - + + diff --git a/Ash_AWord/Views/Common/CommentTableViewCell.h b/Ash_AWord/Views/Common/CommentTableViewCell.h new file mode 100644 index 0000000..9bc5903 --- /dev/null +++ b/Ash_AWord/Views/Common/CommentTableViewCell.h @@ -0,0 +1,20 @@ +// +// CommentTableViewCell.h +// Ash_AWord +// +// Created by xmfish on 15/6/2. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import + +@class CommentInfoViewModel; +@interface CommentTableViewCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UIImageView *avatarImageView; +@property (weak, nonatomic) IBOutlet UILabel *nameLabel; +@property (weak, nonatomic) IBOutlet UILabel *timeLabel; +@property (weak, nonatomic) IBOutlet UITextView *contentTextView; + +-(void)setCommentInfoViewModel:(CommentInfoViewModel*)commentInfoViewModel; ++(CGFloat)getHeightWithCommentInfoViewModel:(CommentInfoViewModel*)commentInfoViewModel; +@end diff --git a/Ash_AWord/Views/Common/CommentTableViewCell.m b/Ash_AWord/Views/Common/CommentTableViewCell.m new file mode 100644 index 0000000..3621eca --- /dev/null +++ b/Ash_AWord/Views/Common/CommentTableViewCell.m @@ -0,0 +1,44 @@ +// +// CommentTableViewCell.m +// Ash_AWord +// +// Created by xmfish on 15/6/2. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "CommentTableViewCell.h" +#import "CommentViewModel.h" +@implementation CommentTableViewCell +{ + CommentInfoViewModel* _commentInfoViewModel; +} +- (void)awakeFromNib { + // Initialization code + _avatarImageView.layer.masksToBounds = YES; + _avatarImageView.layer.cornerRadius = 18.0; +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +-(void)setCommentInfoViewModel:(CommentInfoViewModel *)commentInfoViewModel +{ + [_avatarImageView sd_setImageWithURL:[NSURL URLWithString:commentInfoViewModel.ownerFigureurl] placeholderImage:DefaultUserIcon]; + _nameLabel.text = commentInfoViewModel.ownerName; + _contentTextView.text = commentInfoViewModel.content; + _timeLabel.text = [CommonUtil timeFromtimeSp:commentInfoViewModel.createTime]; +} ++(CGFloat)getHeightWithCommentInfoViewModel:(CommentInfoViewModel *)commentInfoViewModel +{ + UIFont *font = [UIFont appFontOfSize:13.0]; + CGSize size = CGSizeMake(kScreenWidth - 50,MAXFLOAT); + + + CGRect labelRect = [commentInfoViewModel.content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil]; + + return labelRect.size.height+60; +} +@end diff --git a/Ash_AWord/Views/Common/CommentTableViewCell.xib b/Ash_AWord/Views/Common/CommentTableViewCell.xib new file mode 100644 index 0000000..95205d4 --- /dev/null +++ b/Ash_AWord/Views/Common/CommentTableViewCell.xib @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/Views/Common/CommentTextView.h b/Ash_AWord/Views/Common/CommentTextView.h new file mode 100644 index 0000000..96f56bc --- /dev/null +++ b/Ash_AWord/Views/Common/CommentTextView.h @@ -0,0 +1,25 @@ +// +// CommentTextView.h +// Ash_AWord +// +// Created by xmfish on 15/6/4. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import + +@interface CommentTextView : UIView + +@property (nonatomic, assign) NSInteger recordId; + +@property (weak, nonatomic) IBOutlet UITextView *contentTextView; +@property (weak, nonatomic) IBOutlet UILabel *tipLabel; +- (IBAction)cancelBtnClick:(id)sender; +- (IBAction)sendBtnClick:(id)sender; +@property (weak, nonatomic) IBOutlet UIView *contentBgView; + +- (IBAction)bgBtnClick:(id)sender; + +-(void)show; +-(void)hide; +@end diff --git a/Ash_AWord/Views/Common/CommentTextView.m b/Ash_AWord/Views/Common/CommentTextView.m new file mode 100644 index 0000000..89112dd --- /dev/null +++ b/Ash_AWord/Views/Common/CommentTextView.m @@ -0,0 +1,147 @@ +// +// CommentTextView.m +// Ash_AWord +// +// Created by xmfish on 15/6/4. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "CommentTextView.h" +#import "CommentViewModel.h" +@interface CommentTextView() +@end + +@implementation CommentTextView +{ +} +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +- (IBAction)bgBtnClick:(id)sender { + [self hide]; +} + +-(void)show +{ + [_contentTextView becomeFirstResponder]; + self.hidden = NO; + self.alpha = 1; + +} +-(void)hide +{ + [_contentTextView resignFirstResponder]; +} + + +-(void)awakeFromNib +{ + _contentTextView.layer.borderWidth = 0.5; + _contentTextView.layer.borderColor = [[UIColor lightGrayColor] CGColor]; + _contentTextView.delegate = self; + //使用NSNotificationCenter 鍵盤出現時 + [[NSNotificationCenter defaultCenter] addObserver:self + + selector:@selector(keyboardWasShown:) + + name:UIKeyboardWillShowNotification object:nil]; + + //使用NSNotificationCenter 鍵盤隐藏時 + [[NSNotificationCenter defaultCenter] addObserver:self + + selector:@selector(keyboardWillBeHidden:) + + name:UIKeyboardWillHideNotification object:nil]; +} +//实现当键盘出现的时候计算键盘的高度大小。用于输入框显示位置 +- (void)keyboardWasShown:(NSNotification*)aNotification +{ + NSDictionary* info = [aNotification userInfo]; + //kbSize即為鍵盤尺寸 (有width, height) + CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;//得到鍵盤的高度 + + [UIView animateWithDuration:0.3 animations:^{ + CGRect frame = _contentBgView.frame; + frame.origin.y = kScreenHeight - kbSize.height - _contentBgView.frame.size.height-64; + _contentBgView.frame = frame; + } completion:^(BOOL finished) { + + }]; +} + +//当键盘隐藏的时候 +- (void)keyboardWillBeHidden:(NSNotification*)aNotification +{ + [UIView animateWithDuration:0.3 animations:^{ + CGRect frame = _contentBgView.frame; + frame.origin.y = kScreenHeight-64; + _contentBgView.frame = frame; + self.alpha = 0; + } completion:^(BOOL finished) { + + }]; +} +- (IBAction)cancelBtnClick:(id)sender { + [self hide]; +} + +- (IBAction)sendBtnClick:(id)sender { + if ([_contentTextView.text isEqualToString:@""]) { + _tipLabel.text = @"写点什么吧。。。"; + _tipLabel.textColor = [UIColor redColor]; + } else if(_contentTextView.text.length > 500) + { + _tipLabel.text = @"评论内容500字内"; + _tipLabel.textColor = [UIColor redColor]; + }else + { + if (![AWordUser sharedInstance].isLogin) + { + [LoginViewController presentLoginViewControllerInView:nil success:nil]; + return; + } + [self comment]; + } +} + +-(void)comment +{ + + [MBProgressHUD hudWithView:nil label:@"评论中"]; + + PropertyEntity* pro = [CommentViewModel requireAddCommentWithReconrdId:_recordId withContent:_contentTextView.text]; + [RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) { + [MBProgressHUD hideAllHUDsForView:nil animated:YES]; + + if ([viewModel success]) { + [MBProgressHUD checkHudWithView:nil label:@"评论成功" hidesAfter:1.0]; + _tipLabel.text = @""; + [self hide]; + }else{ + [MBProgressHUD checkHudWithView:nil label:[viewModel errMessage] hidesAfter:1.0]; + + } + } failedBlock:^(NSError *error) { + [MBProgressHUD errorHudWithView:nil label:kNetworkErrorTips hidesAfter:2.0]; + + }]; +} +#pragma mark UITextViewDelegate +-(void)textViewDidChange:(UITextView *)textView +{ + if (![_contentTextView.text isEqualToString:@""]) { + _tipLabel.text = @"写评论"; + _tipLabel.textColor = [UIColor blackColor]; + } +} + +-(void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} +@end diff --git a/Ash_AWord/Views/Common/CommentTextView.xib b/Ash_AWord/Views/Common/CommentTextView.xib new file mode 100644 index 0000000..aaf9c8e --- /dev/null +++ b/Ash_AWord/Views/Common/CommentTextView.xib @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/Views/Note/NoteTableViewCell.h b/Ash_AWord/Views/Note/NoteTableViewCell.h index 8fd834d..b00aca3 100644 --- a/Ash_AWord/Views/Note/NoteTableViewCell.h +++ b/Ash_AWord/Views/Note/NoteTableViewCell.h @@ -7,6 +7,8 @@ // #import +#import "UIImageView+Reloading.h" + @protocol NoteTableViewCellDelegate -(void) reportWithIndex:(NSInteger)index; @end @@ -27,6 +29,7 @@ @property (weak, nonatomic) IBOutlet UIButton *shareBtn; @property (weak, nonatomic) IBOutlet UIButton *closeBtn; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentHeight; +@property (nonatomic, assign)BOOL isComment; - (IBAction)avatarBtnClick:(id)sender; - (IBAction)imageBtnClick:(id)sender; diff --git a/Ash_AWord/Views/Note/NoteTableViewCell.m b/Ash_AWord/Views/Note/NoteTableViewCell.m index 7f06913..7636340 100644 --- a/Ash_AWord/Views/Note/NoteTableViewCell.m +++ b/Ash_AWord/Views/Note/NoteTableViewCell.m @@ -12,6 +12,7 @@ #import "MWPhotoBrowser.h" #import "SetUpViewController.h" #import "MyNoteViewController.h" +#import "NoteCommentViewController.h" @interface NoteTableViewCell() @end @implementation NoteTableViewCell @@ -20,6 +21,8 @@ } - (void)awakeFromNib { // Initialization code + + _isComment = NO; _contentLabel.font = [UIFont appFontOfSize:14.0]; _contentTextView.font = [UIFont appFontOfSize:14.0]; _contentTextView.scrollEnabled = NO; @@ -61,7 +64,6 @@ return; } -// _goodBtn.enabled = NO; if (_goodBtn.selected) { [_goodBtn setTitle:[NSString stringWithFormat:@"%ld",_text_image.praiseCount-1] forState:UIControlStateNormal]; [_goodBtn setTitle:[NSString stringWithFormat:@"%ld",_text_image.praiseCount-1] forState:UIControlStateSelected]; @@ -107,8 +109,22 @@ _goodBtn.backgroundColor = [UIColor lineColor]; } } +-(void)setIsComment:(BOOL)isComment +{ + if (isComment) { + _badBtn.hidden = YES; + }else + { + _badBtn.hidden = NO; + } +} +//评论 - (IBAction)badBtnClick:(id)sender { + NoteCommentViewController* noteCommentViewController = [[NoteCommentViewController alloc] init]; + noteCommentViewController.hidesBottomBarWhenPushed = YES; + noteCommentViewController.text_image = _text_image; + [[AppDelegate visibleViewController].navigationController pushViewController:noteCommentViewController animated:YES]; } - (IBAction)shareBtnClick:(id)sender @@ -126,13 +142,6 @@ -(void)setText_Image:(Text_Image *)text_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(); - _userName.text = text_image.ownerName; [_avatar sd_setImageWithURL:text_image.ownerFigureurl placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]]; @@ -145,8 +154,13 @@ CGRect labelRect = [text_image.content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil]; _contentHeight.constant = labelRect.size.height+25; _contentTextView.text = text_image.content; - [_contentImgView sd_setImageWithURL:text_image.imageUrl placeholderImage:pressedColorImg]; + + _contentImgView.imageURL = text_image.imageUrl; + + [_contentImgView setOnTouchTapBlock:^(UIImageView *imageView) { + [self imageBtnClick:nil]; + }]; [_goodBtn setTitle:[NSString stringWithFormat:@"%ld",(long)text_image.praiseCount] forState:UIControlStateNormal]; [_goodBtn setTitle:[NSString stringWithFormat:@"%ld",(long)text_image.praiseCount] forState:UIControlStateSelected]; [_shareBtn setTitle:[NSString stringWithFormat:@"%ld",(long)text_image.shareCount] forState:UIControlStateNormal]; diff --git a/Ash_AWord/Views/Note/NoteTableViewCell.xib b/Ash_AWord/Views/Note/NoteTableViewCell.xib index f462806..d054c1b 100644 --- a/Ash_AWord/Views/Note/NoteTableViewCell.xib +++ b/Ash_AWord/Views/Note/NoteTableViewCell.xib @@ -39,6 +39,7 @@ + @@ -62,12 +63,6 @@ - - - - - - + + + + + + @@ -118,7 +119,7 @@ - + @@ -161,7 +162,7 @@ - + @@ -202,12 +203,12 @@ - - - + + + @@ -220,6 +221,7 @@ + @@ -242,6 +244,7 @@ + diff --git a/Ash_AWord/zh-Hant.lproj/Main.strings b/Ash_AWord/zh-Hant.lproj/Main.strings new file mode 100644 index 0000000..e69de29 diff --git a/Pods/MBProgressHUD/MBProgressHUD.m b/Pods/MBProgressHUD/MBProgressHUD.m index 549cb66..660a26e 100644 --- a/Pods/MBProgressHUD/MBProgressHUD.m +++ b/Pods/MBProgressHUD/MBProgressHUD.m @@ -131,6 +131,10 @@ static const CGFloat kDetailsLabelFontSize = 12.f; } + (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated { + if (view == nil) + { + view = [UIApplication sharedApplication].delegate.window; + } NSArray *huds = [MBProgressHUD allHUDsForView:view]; for (MBProgressHUD *hud in huds) { hud.removeFromSuperViewOnHide = YES;