diff --git a/.DS_Store b/.DS_Store index 9830dab..fc3b71c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/newsPicks.xcodeproj/project.pbxproj b/newsPicks.xcodeproj/project.pbxproj index f389a89..97e1528 100644 --- a/newsPicks.xcodeproj/project.pbxproj +++ b/newsPicks.xcodeproj/project.pbxproj @@ -171,14 +171,21 @@ 374F12801994895B00B9731F /* NPTabBtn.m in Sources */ = {isa = PBXBuildFile; fileRef = 374F127F1994895B00B9731F /* NPTabBtn.m */; }; 374F1284199496EA00B9731F /* LoginViewController_iPad.m in Sources */ = {isa = PBXBuildFile; fileRef = 374F1282199496EA00B9731F /* LoginViewController_iPad.m */; }; 374F1285199496EA00B9731F /* LoginViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 374F1283199496EA00B9731F /* LoginViewController_iPad.xib */; }; + 376117E1199DA50F00BADE7A /* NPSettingInterestController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 376117E0199DA50F00BADE7A /* NPSettingInterestController.xib */; }; 3761A8821995BE7F00C8B4FB /* NPTextInputViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3761A8801995BE7F00C8B4FB /* NPTextInputViewController.m */; }; 3761A8831995BE7F00C8B4FB /* NPTextInputViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3761A8811995BE7F00C8B4FB /* NPTextInputViewController_iPad.xib */; }; 3761A8851995BEA400C8B4FB /* NPTextInputViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3761A8841995BEA400C8B4FB /* NPTextInputViewController.xib */; }; 376E571D1992283A00086E55 /* NPTimeOnlineCell_iPad.m in Sources */ = {isa = PBXBuildFile; fileRef = 376E571C1992283A00086E55 /* NPTimeOnlineCell_iPad.m */; }; + 37819D2419B3344400DADC77 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 37819D2319B3344400DADC77 /* Main_iPhone.storyboard */; }; + 37819D2719B33D3900DADC77 /* LoginRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 37819D2619B33D3900DADC77 /* LoginRootViewController.m */; }; 378BFC1E198F875300DBD405 /* MJPopupBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 378BFC1B198F875300DBD405 /* MJPopupBackgroundView.m */; }; 378BFC1F198F875300DBD405 /* UIViewController+MJPopupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 378BFC1D198F875300DBD405 /* UIViewController+MJPopupViewController.m */; }; 37B016C9198A6B950069298D /* SVProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 37B016C6198A6B950069298D /* SVProgressHUD.bundle */; }; 37B016CA198A6B950069298D /* SVProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 37B016C8198A6B950069298D /* SVProgressHUD.m */; }; + 66F148BA199F0C9400720697 /* NPThemeOfInterestCellTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 66F148B9199F0C9400720697 /* NPThemeOfInterestCellTableViewCell.m */; }; + 66F148BC199F182600720697 /* success-black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 66F148BB199F182600720697 /* success-black@2x.png */; }; + 66F148BF199F565100720697 /* NPUserInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 66F148BE199F565100720697 /* NPUserInfoModel.m */; }; + 66F148C219A0D66500720697 /* NPRecommandThreadModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 66F148C119A0D66500720697 /* NPRecommandThreadModel.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -426,12 +433,16 @@ 374F1281199496EA00B9731F /* LoginViewController_iPad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController_iPad.h; sourceTree = ""; }; 374F1282199496EA00B9731F /* LoginViewController_iPad.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController_iPad.m; sourceTree = ""; }; 374F1283199496EA00B9731F /* LoginViewController_iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoginViewController_iPad.xib; sourceTree = ""; }; + 376117E0199DA50F00BADE7A /* NPSettingInterestController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NPSettingInterestController.xib; sourceTree = ""; }; 3761A87F1995BE7F00C8B4FB /* NPTextInputViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPTextInputViewController.h; sourceTree = ""; }; 3761A8801995BE7F00C8B4FB /* NPTextInputViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NPTextInputViewController.m; sourceTree = ""; }; 3761A8811995BE7F00C8B4FB /* NPTextInputViewController_iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NPTextInputViewController_iPad.xib; sourceTree = ""; }; 3761A8841995BEA400C8B4FB /* NPTextInputViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NPTextInputViewController.xib; sourceTree = ""; }; 376E571B1992283A00086E55 /* NPTimeOnlineCell_iPad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPTimeOnlineCell_iPad.h; sourceTree = ""; }; 376E571C1992283A00086E55 /* NPTimeOnlineCell_iPad.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NPTimeOnlineCell_iPad.m; sourceTree = ""; }; + 37819D2319B3344400DADC77 /* Main_iPhone.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main_iPhone.storyboard; sourceTree = ""; }; + 37819D2519B33D3900DADC77 /* LoginRootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginRootViewController.h; sourceTree = ""; }; + 37819D2619B33D3900DADC77 /* LoginRootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginRootViewController.m; sourceTree = ""; }; 378BFC1A198F875300DBD405 /* MJPopupBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJPopupBackgroundView.h; sourceTree = ""; }; 378BFC1B198F875300DBD405 /* MJPopupBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJPopupBackgroundView.m; sourceTree = ""; }; 378BFC1C198F875300DBD405 /* UIViewController+MJPopupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+MJPopupViewController.h"; sourceTree = ""; }; @@ -440,6 +451,13 @@ 37B016C6198A6B950069298D /* SVProgressHUD.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SVProgressHUD.bundle; sourceTree = ""; }; 37B016C7198A6B950069298D /* SVProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVProgressHUD.h; sourceTree = ""; }; 37B016C8198A6B950069298D /* SVProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVProgressHUD.m; sourceTree = ""; }; + 66F148B8199F0C9400720697 /* NPThemeOfInterestCellTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPThemeOfInterestCellTableViewCell.h; sourceTree = ""; }; + 66F148B9199F0C9400720697 /* NPThemeOfInterestCellTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NPThemeOfInterestCellTableViewCell.m; sourceTree = ""; }; + 66F148BB199F182600720697 /* success-black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "success-black@2x.png"; path = "newsPicks/other/SVProgressHUD/SVProgressHUD.bundle/success-black@2x.png"; sourceTree = ""; }; + 66F148BD199F565100720697 /* NPUserInfoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPUserInfoModel.h; sourceTree = ""; }; + 66F148BE199F565100720697 /* NPUserInfoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NPUserInfoModel.m; sourceTree = ""; }; + 66F148C019A0D66500720697 /* NPRecommandThreadModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRecommandThreadModel.h; sourceTree = ""; }; + 66F148C119A0D66500720697 /* NPRecommandThreadModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NPRecommandThreadModel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -506,6 +524,8 @@ children = ( 378BFC19198F873600DBD405 /* PopupView */, 3741F7901990C966006B8115 /* Main_iPad.storyboard */, + 37819D2519B33D3900DADC77 /* LoginRootViewController.h */, + 37819D2619B33D3900DADC77 /* LoginRootViewController.m */, 3741F7921990CD65006B8115 /* NPNewsListViewController_ipad.h */, 3741F7931990CD65006B8115 /* NPNewsListViewController_ipad.m */, 37193CA3198F39910065752D /* TestViewController.h */, @@ -594,8 +614,10 @@ 2644A00519868FDF00EAD5DF /* NPSettingPasswordController.m */, 2644A0071986904D00EAD5DF /* NPSettingInterestController.h */, 2644A0081986904D00EAD5DF /* NPSettingInterestController.m */, + 376117E0199DA50F00BADE7A /* NPSettingInterestController.xib */, 373E8913198A2CC00080FBEF /* LoginViewController.h */, 373E8914198A2CC00080FBEF /* LoginViewController.m */, + 37819D2319B3344400DADC77 /* Main_iPhone.storyboard */, 373E8915198A2CC00080FBEF /* LoginViewController.xib */, 371CDB4D198C754E00D3C9B8 /* NPContentUrlViewController.h */, 371CDB4E198C754E00D3C9B8 /* NPContentUrlViewController.m */, @@ -645,6 +667,10 @@ 2649D9E0197EBCAF00377012 /* NPlistReplyModel.m */, 26BE23021981036A007CDBBB /* NPUserDetaiInfolModel.h */, 26BE23031981036A007CDBBB /* NPUserDetaiInfolModel.m */, + 66F148BD199F565100720697 /* NPUserInfoModel.h */, + 66F148BE199F565100720697 /* NPUserInfoModel.m */, + 66F148C019A0D66500720697 /* NPRecommandThreadModel.h */, + 66F148C119A0D66500720697 /* NPRecommandThreadModel.m */, ); path = model; sourceTree = ""; @@ -780,6 +806,7 @@ 2694226A197BFE9E00515F9E = { isa = PBXGroup; children = ( + 66F148BB199F182600720697 /* success-black@2x.png */, 2694227C197BFE9E00515F9E /* newsPicks */, 26942295197BFE9E00515F9E /* newsPicksTests */, 26942275197BFE9E00515F9E /* Frameworks */, @@ -970,6 +997,8 @@ 2666CF071982839A00D4B106 /* NPFollowCell.m */, 376E571B1992283A00086E55 /* NPTimeOnlineCell_iPad.h */, 376E571C1992283A00086E55 /* NPTimeOnlineCell_iPad.m */, + 66F148B8199F0C9400720697 /* NPThemeOfInterestCellTableViewCell.h */, + 66F148B9199F0C9400720697 /* NPThemeOfInterestCellTableViewCell.m */, ); path = cell; sourceTree = ""; @@ -1086,12 +1115,15 @@ files = ( 26942281197BFE9E00515F9E /* InfoPlist.strings in Resources */, 37193CA7198F39910065752D /* TestViewController.xib in Resources */, + 376117E1199DA50F00BADE7A /* NPSettingInterestController.xib in Resources */, 26542D25197D2C08000E0317 /* zbar-help.html in Resources */, 26542D29197D2C08000E0317 /* zbar-samples.png in Resources */, + 66F148BC199F182600720697 /* success-black@2x.png in Resources */, 26542D27197D2C08000E0317 /* zbar-helpicons.png in Resources */, 26E8C7B2197D73020039EFB4 /* NP_IMG_default.jpg in Resources */, 26A43841197E053C009F225D /* Localizable.strings in Resources */, 371CDB51198C754E00D3C9B8 /* NPContentUrlViewController.xib in Resources */, + 37819D2419B3344400DADC77 /* Main_iPhone.storyboard in Resources */, 26542D23197D2C08000E0317 /* zbar-back.png in Resources */, 260B4999197D4A7D00BEFF53 /* registerPhoto_1.png in Resources */, 374F1285199496EA00B9731F /* LoginViewController_iPad.xib in Resources */, @@ -1179,6 +1211,7 @@ 2649D9DB197EAFBA00377012 /* NPlistPopularUsers.m in Sources */, 26542D1F197D2C08000E0317 /* UIImageView+AFNetworking.m in Sources */, 26942283197BFE9E00515F9E /* main.m in Sources */, + 66F148C219A0D66500720697 /* NPRecommandThreadModel.m in Sources */, 26E8C791197D5DF10039EFB4 /* MKAnnotationView+WebCache.m in Sources */, 2649D9E1197EBCAF00377012 /* NPlistReplyModel.m in Sources */, 185CD718198AAA470076F05B /* gtxCellView.m in Sources */, @@ -1191,6 +1224,7 @@ 26542D19197D2C08000E0317 /* AFURLConnectionOperation.m in Sources */, 3741F7941990CD65006B8115 /* NPNewsListViewController_ipad.m in Sources */, 26542C91197D241A000E0317 /* NPNavigationViewController.m in Sources */, + 66F148BF199F565100720697 /* NPUserInfoModel.m in Sources */, 3761A8821995BE7F00C8B4FB /* NPTextInputViewController.m in Sources */, 373E8916198A2CC00080FBEF /* LoginViewController.m in Sources */, 26791FCC197FB796003DAC20 /* NPCustomMethod.m in Sources */, @@ -1202,8 +1236,10 @@ 374F1284199496EA00B9731F /* LoginViewController_iPad.m in Sources */, 26E8C793197D5DF10039EFB4 /* NSData+GIF.m in Sources */, 26542D17197D2C08000E0317 /* AFPropertyListRequestOperation.m in Sources */, + 66F148BA199F0C9400720697 /* NPThemeOfInterestCellTableViewCell.m in Sources */, 26791FC6197F6B70003DAC20 /* NPNewListDetailFootLoadView.m in Sources */, 2613BBF01980109F00628079 /* NPUserDetailViewController.m in Sources */, + 37819D2719B33D3900DADC77 /* LoginRootViewController.m in Sources */, 26542C8D197D241A000E0317 /* NPBaseViewController.m in Sources */, 26449FF319867FB400EAD5DF /* NPFollowersRobotsController.m in Sources */, 26542CD6197D27D0000E0317 /* NPListModel.m in Sources */, @@ -1337,7 +1373,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.1; ONLY_ACTIVE_ARCH = YES; - PROVISIONING_PROFILE = "fd7353de-859e-4ee7-9ead-d4671693b150"; + PROVISIONING_PROFILE = "ed4b5fca-8fde-47bc-b82e-09aab12f6686"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -1371,7 +1407,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.1; - PROVISIONING_PROFILE = "fd7353de-859e-4ee7-9ead-d4671693b150"; + PROVISIONING_PROFILE = "ed4b5fca-8fde-47bc-b82e-09aab12f6686"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -1383,7 +1419,8 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CODE_SIGN_IDENTITY = "iPhone Developer: ZHONGRUI YIN (9S72XJC9KA)"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "newsPicks/newsPicks-Prefix.pch"; INFOPLIST_FILE = "newsPicks/newsPicks-Info.plist"; @@ -1393,7 +1430,7 @@ "$(PROJECT_DIR)/newsPicks/other/AFNetworking/ZBarSDK", ); PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "fd7353de-859e-4ee7-9ead-d4671693b150"; + PROVISIONING_PROFILE = ""; SDKROOT = iphoneos6.1; WRAPPER_EXTENSION = app; }; @@ -1404,7 +1441,8 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CODE_SIGN_IDENTITY = "iPhone Developer: ZHONGRUI YIN (9S72XJC9KA)"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "newsPicks/newsPicks-Prefix.pch"; INFOPLIST_FILE = "newsPicks/newsPicks-Info.plist"; @@ -1414,7 +1452,7 @@ "$(PROJECT_DIR)/newsPicks/other/AFNetworking/ZBarSDK", ); PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE = "fd7353de-859e-4ee7-9ead-d4671693b150"; + PROVISIONING_PROFILE = ""; SDKROOT = iphoneos6.1; WRAPPER_EXTENSION = app; }; diff --git a/newsPicks.xcodeproj/project.xcworkspace/xcshareddata/newsPicks.xccheckout b/newsPicks.xcodeproj/project.xcworkspace/xcshareddata/newsPicks.xccheckout index 475d65c..a5a8c9c 100644 --- a/newsPicks.xcodeproj/project.xcworkspace/xcshareddata/newsPicks.xccheckout +++ b/newsPicks.xcodeproj/project.xcworkspace/xcshareddata/newsPicks.xccheckout @@ -5,7 +5,7 @@ IDESourceControlProjectFavoriteDictionaryKey IDESourceControlProjectIdentifier - 1D770B83-773D-40DC-B6EB-8B677E8AF950 + C042A238-AAF2-4F84-AB2A-69911559926F IDESourceControlProjectName newsPicks IDESourceControlProjectOriginsDictionary diff --git a/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/ZhangCheng.xcuserdatad/UserInterfaceState.xcuserstate b/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/ZhangCheng.xcuserdatad/UserInterfaceState.xcuserstate index 9e38858..7387348 100644 Binary files a/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/ZhangCheng.xcuserdatad/UserInterfaceState.xcuserstate and b/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/ZhangCheng.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate b/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate index 9cc8908..ef50f66 100644 Binary files a/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate and b/newsPicks.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/newsPicks.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/newsPicks.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..0c387e5 --- /dev/null +++ b/newsPicks.xcodeproj/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcschemes/newsPicks.xcscheme b/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcschemes/newsPicks.xcscheme new file mode 100644 index 0000000..e21ddad --- /dev/null +++ b/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcschemes/newsPicks.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcschemes/xcschememanagement.plist b/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..cd9c0b6 --- /dev/null +++ b/newsPicks.xcodeproj/xcuserdata/dengqixiang.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + newsPicks.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 26942272197BFE9E00515F9E + + primary + + + 2694228D197BFE9E00515F9E + + primary + + + + + diff --git a/newsPicks/.DS_Store b/newsPicks/.DS_Store index 02d358d..450d6a7 100644 Binary files a/newsPicks/.DS_Store and b/newsPicks/.DS_Store differ diff --git a/newsPicks/cell/NPFollowCell.h b/newsPicks/cell/NPFollowCell.h index bc49b48..136f479 100644 --- a/newsPicks/cell/NPFollowCell.h +++ b/newsPicks/cell/NPFollowCell.h @@ -17,4 +17,6 @@ @property(nonatomic,assign)iddelegate; -(void)restSubView:(NPUserDetaiInfolModel *)infoModel; +(float)cellHight; +- (id)initWithStyle2:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier; + @end diff --git a/newsPicks/cell/NPFollowCell.m b/newsPicks/cell/NPFollowCell.m index e12e38f..4124b68 100644 --- a/newsPicks/cell/NPFollowCell.m +++ b/newsPicks/cell/NPFollowCell.m @@ -30,21 +30,67 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus } return self; } +- (id)initWithStyle2:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + [self initSub2]; + // Initialization code + } + return self; +} -(void)initSub { + BOOL isIPhone = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone; + headView=[[UIImageView alloc]init]; + headView.frame=CGRectMake(5, 5, 60, 60); + [self.contentView addSubview:headView]; + + name=[[UILabel alloc] init]; + name.frame=CGRectMake(headView.frame.size.width+headView.frame.origin.x+5, headView.frame.origin.y, (isIPhone?320:270)-headView.frame.origin.x-headView.frame.origin.y-10, 20); + name.font=[UIFont boldSystemFontOfSize:17]; + name.textColor=[UIColor blackColor]; + name.backgroundColor=[UIColor clearColor]; + [self.contentView addSubview:name]; + followBtn=[NPUserFollowingButton buttonWithType:UIButtonTypeCustom]; + followBtn.titleLabel.font=[UIFont systemFontOfSize:13]; + followBtn.frame=CGRectMake((isIPhone?320:270)-75, 0, 70, 30); + [followBtn addTarget:self action:@selector(clickFollow:) forControlEvents:UIControlEventTouchUpInside]; + followBtn.center=CGPointMake(followBtn.center.x, headView.center.y); + [self.contentView addSubview:followBtn]; + + typeContent=[[UILabel alloc] init]; + typeContent.frame=CGRectMake(name.frame.origin.x, 0, followBtn.frame.origin.x-name.frame.origin.x-5, 15); + typeContent.font=[UIFont systemFontOfSize:14]; + typeContent.textColor=[UIColor blackColor]; + typeContent.backgroundColor=[UIColor clearColor]; + typeContent.center=CGPointMake(typeContent.center.x, headView.center.y+4); + [self.contentView addSubview:typeContent]; + + likeNum=[[UILabel alloc]init]; + likeNum.frame=CGRectMake(typeContent.frame.origin.x, headView.frame.origin.y+headView.frame.size.height-typeContent.frame.size.height, name.frame.size.width, typeContent.frame.size.height); + likeNum.backgroundColor=[UIColor clearColor]; + likeNum.font=typeContent.font; + likeNum.textColor=typeContent.textColor; + [self.contentView addSubview:likeNum]; +} +-(void)initSub2 +{ + BOOL isIPhone = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone; + headView=[[UIImageView alloc]init]; headView.frame=CGRectMake(5, 5, 60, 60); [self.contentView addSubview:headView]; name=[[UILabel alloc] init]; - name.frame=CGRectMake(headView.frame.size.width+headView.frame.origin.x+5, headView.frame.origin.y, [UIScreen mainScreen].bounds.size.width-headView.frame.origin.x-headView.frame.origin.y-10, 20); + name.frame=CGRectMake(headView.frame.size.width+headView.frame.origin.x+5, headView.frame.origin.y, 500-headView.frame.origin.x-headView.frame.origin.y-10, 20); name.font=[UIFont boldSystemFontOfSize:17]; name.textColor=[UIColor blackColor]; name.backgroundColor=[UIColor clearColor]; [self.contentView addSubview:name]; followBtn=[NPUserFollowingButton buttonWithType:UIButtonTypeCustom]; followBtn.titleLabel.font=[UIFont systemFontOfSize:13]; - followBtn.frame=CGRectMake([UIScreen mainScreen].bounds.size.width-75, 0, 70, 30); + followBtn.frame=CGRectMake(500-75, 0, 70, 30); [followBtn addTarget:self action:@selector(clickFollow:) forControlEvents:UIControlEventTouchUpInside]; followBtn.center=CGPointMake(followBtn.center.x, headView.center.y); [self.contentView addSubview:followBtn]; @@ -85,7 +131,7 @@ -(void)changeFollowStatus:(BOOL)follow { followBtn.layer.borderColor=[[UIColor clearColor]CGColor]; followBtn.layer.borderWidth=0; - [followBtn setTitle:@"following" forState:UIControlStateNormal]; + [followBtn setTitle:@"unfollow" forState:UIControlStateNormal]; [followBtn setBackgroundImage:[NPCustomMethod createImageWithColor:[UIColor colorWithRed:62.0f/255.0f green:69.0f/255.0f blue:113.0f/255.0f alpha:1] size:followBtn.frame.size] forState:UIControlStateNormal]; } diff --git a/newsPicks/cell/NPNewListDetailCell.m b/newsPicks/cell/NPNewListDetailCell.m index 9f00b6f..56df389 100644 --- a/newsPicks/cell/NPNewListDetailCell.m +++ b/newsPicks/cell/NPNewListDetailCell.m @@ -26,7 +26,7 @@ -(void)restCell:(NPlistReplyModel *)reply for (UIView *view in self.contentView.subviews) { [view removeFromSuperview]; } - if (reply.content.length) { +// if (reply.content.length) { UIImageView *headImageView=[[UIImageView alloc]init]; headImageView.frame=CGRectMake(NPNewListDetailCell_topPlace, NPNewListDetailCell_topPlace, NPNewListDetailCell_Content_headImageHight, NPNewListDetailCell_Content_headImageHight); headImageView.contentMode=UIViewContentModeScaleAspectFill; @@ -34,11 +34,12 @@ -(void)restCell:(NPlistReplyModel *)reply [self.contentView addSubview:headImageView]; UILabel *nameLabel=[[UILabel alloc] init]; - nameLabel.frame=CGRectMake(NPNewListDetailCell_topPlace+headImageView.frame.size.width+headImageView.frame.origin.x, headImageView.frame.origin.y, [UIScreen mainScreen].bounds.size.width-NPNewListDetailCell_RightPlace-headImageView.frame.size.width-headImageView.frame.origin.x-NPNewListDetailCell_topPlace, headImageView.frame.size.height/3); + nameLabel.frame=CGRectMake(NPNewListDetailCell_topPlace+headImageView.frame.size.width+headImageView.frame.origin.x+10, headImageView.frame.origin.y, [UIScreen mainScreen].bounds.size.width-NPNewListDetailCell_RightPlace-headImageView.frame.size.width-headImageView.frame.origin.x-NPNewListDetailCell_topPlace, headImageView.frame.size.height/3); nameLabel.backgroundColor=[UIColor clearColor]; nameLabel.textColor=[UIColor lightGrayColor]; nameLabel.font=[UIFont systemFontOfSize:10]; - nameLabel.text=reply.name; + nameLabel.text = @"Leon"; +// nameLabel.text=reply.name; [self.contentView addSubview:nameLabel]; UILabel *postionLabel=[[UILabel alloc]init]; @@ -46,7 +47,8 @@ -(void)restCell:(NPlistReplyModel *)reply postionLabel.textColor=nameLabel.textColor; postionLabel.backgroundColor=[UIColor clearColor]; postionLabel.frame=CGRectMake(nameLabel.frame.origin.x, nameLabel.frame.size.height+nameLabel.frame.origin.y, nameLabel.frame.size.width, nameLabel.frame.size.height); - postionLabel.text=reply.position; +// postionLabel.text=reply.position; + postionLabel.text = @"nice newsPicked!"; [self.contentView addSubview:postionLabel]; UILabel *timeLabel=[[UILabel alloc]init]; @@ -54,7 +56,8 @@ -(void)restCell:(NPlistReplyModel *)reply timeLabel.font=postionLabel.font; timeLabel.textColor=postionLabel.textColor; timeLabel.backgroundColor=[UIColor clearColor]; - timeLabel.text=reply.time; + timeLabel.text = @"2014-08-31 22:33"; +// timeLabel.text=reply.time; [self.contentView addSubview:timeLabel]; @@ -76,7 +79,8 @@ -(void)restCell:(NPlistReplyModel *)reply NSMutableDictionary *mutableLinkAttributes=[NSMutableDictionary dictionary]; [mutableLinkAttributes setObject:[UIColor blueColor] forKey:(NSString *)kCTForegroundColorAttributeName]; contentLabel.linkAttributes=mutableLinkAttributes; - contentLabel.attributedText=[NSMutableAttributedString attributedStringWith:contentLabel.font lineSpace:NPNewListDetailCell_lineSpace textColor:contentLabel.textColor content:reply.content]; +// contentLabel.attributedText=[NSMutableAttributedString attributedStringWith:contentLabel.font lineSpace:NPNewListDetailCell_lineSpace textColor:contentLabel.textColor content:reply.content]; + contentLabel.attributedText=[NSMutableAttributedString attributedStringWith:contentLabel.font lineSpace:NPNewListDetailCell_lineSpace textColor:contentLabel.textColor content:@"it is a good newspicked"]; CGSize size=[NSMutableAttributedString adjustSizeWithAttributedString:contentLabel.attributedText MaxWidth:contentLabel.frame.size.width]; contentLabel.frame=CGRectMake(contentLabel.frame.origin.x, contentLabel.frame.origin.y, size.width, size.height); [NPCustomMethod matchesInStringUrl:contentLabel]; @@ -84,29 +88,30 @@ -(void)restCell:(NPlistReplyModel *)reply UIButton *btnPraise=[UIButton buttonWithType:UIButtonTypeCustom]; - btnPraise.frame=CGRectMake([UIScreen mainScreen].bounds.size.width-NPNewListDetailCell_RightPlace+10, postionLabel.frame.origin.y-5, 25, 35); - btnPraise.backgroundColor=[UIColor orangeColor]; + btnPraise.frame=CGRectMake([UIScreen mainScreen].bounds.size.width-NPNewListDetailCell_RightPlace, postionLabel.frame.origin.y-5, 36, 35); +// btnPraise.backgroundColor=[UIColor orangeColor]; + [btnPraise setBackgroundImage:[UIImage imageNamed:@"img_pick_navy"] forState:UIControlStateNormal]; [self.contentView addSubview:btnPraise]; UIView *line=[[UIView alloc]init]; line.frame=CGRectMake(0, contentLabel.frame.size.height+contentLabel.frame.origin.y+NPNewListDetailCell_buttomPlace-0.5, [UIScreen mainScreen].bounds.size.width, 0.5); line.backgroundColor=[UIColor lightGrayColor]; [self.contentView addSubview:line]; - }else - { - UIButton *headImage=[UIButton buttonWithType:UIButtonTypeCustom]; - [headImage addTarget:self action:@selector(clickHead:) forControlEvents:UIControlEventTouchUpInside]; - headImage.frame=CGRectMake(NPNewListDetailCell_topPlace, NPNewListDetailCell_topPlace, NPNewListDetailCell_noContent_headImageHight, NPNewListDetailCell_noContent_headImageHight); - headImage.contentMode=UIViewContentModeScaleAspectFill; - [headImage setImageWithURL:[NSURL URLWithString:reply.headImageUrl] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]]; - [self.contentView addSubview:headImage]; - UIView *line=[[UIView alloc]init]; - line.frame=CGRectMake(0, headImage.frame.size.height+headImage.frame.origin.y+NPNewListDetailCell_topPlace-0.5, [UIScreen mainScreen].bounds.size.width, 0.5); - line.backgroundColor=[UIColor lightGrayColor]; - [self.contentView addSubview:line]; - - - } +// }else +// { +// UIButton *headImage=[UIButton buttonWithType:UIButtonTypeCustom]; +// [headImage addTarget:self action:@selector(clickHead:) forControlEvents:UIControlEventTouchUpInside]; +// headImage.frame=CGRectMake(NPNewListDetailCell_topPlace, NPNewListDetailCell_topPlace, NPNewListDetailCell_noContent_headImageHight, NPNewListDetailCell_noContent_headImageHight); +// headImage.contentMode=UIViewContentModeScaleAspectFill; +// [headImage setImageWithURL:[NSURL URLWithString:reply.headImageUrl] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]]; +// [self.contentView addSubview:headImage]; +// UIView *line=[[UIView alloc]init]; +// line.frame=CGRectMake(0, headImage.frame.size.height+headImage.frame.origin.y+NPNewListDetailCell_topPlace-0.5, [UIScreen mainScreen].bounds.size.width, 0.5); +// line.backgroundColor=[UIColor lightGrayColor]; +// [self.contentView addSubview:line]; +// +// +// } } -(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url diff --git a/newsPicks/cell/NPThemeOfInterestCellTableViewCell.h b/newsPicks/cell/NPThemeOfInterestCellTableViewCell.h new file mode 100644 index 0000000..bb2bb56 --- /dev/null +++ b/newsPicks/cell/NPThemeOfInterestCellTableViewCell.h @@ -0,0 +1,16 @@ +// +// NPThemeOfInterestCellTableViewCell.h +// newsPicks +// +// Created by kangxv on 14-8-16. +// Copyright (c) 2014年 kangxv. All rights reserved. +// + +#import + +@interface NPThemeOfInterestCellTableViewCell : UITableViewCell + +@property (retain, nonatomic) UILabel *conte_text; + +- (void)selected_cell:(BOOL )isSelect; +@end diff --git a/newsPicks/cell/NPThemeOfInterestCellTableViewCell.m b/newsPicks/cell/NPThemeOfInterestCellTableViewCell.m new file mode 100644 index 0000000..974096b --- /dev/null +++ b/newsPicks/cell/NPThemeOfInterestCellTableViewCell.m @@ -0,0 +1,64 @@ +// +// NPThemeOfInterestCellTableViewCell.m +// newsPicks +// +// Created by kangxv on 14-8-16. +// Copyright (c) 2014年 kangxv. All rights reserved. +// + +#import "NPThemeOfInterestCellTableViewCell.h" + +@implementation NPThemeOfInterestCellTableViewCell +{ + UIImageView *select_tag; +} + +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + // Initialization code + [self creatContentView]; + } + return self; +} + +- (void)awakeFromNib +{ + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated +{ + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +- (void)creatContentView +{ + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10.0f, 5.0f, 10.0f, self.frame.size.height-10.0f)]; + label.backgroundColor = [UIColor colorWithRed:arc4random()%100*0.01 green:0 blue:0 alpha:1]; + self.conte_text = [[UILabel alloc] initWithFrame:CGRectMake(30.09f, 5.0f, 100.0f, self.frame.size.height - 10.0f)]; + self.conte_text.textColor = [UIColor blackColor]; + [self.contentView addSubview:label]; + [self.contentView addSubview:self.conte_text]; + + select_tag = [[UIImageView alloc] initWithFrame:CGRectMake(self.frame.size.width-30.0f, 5.0f, 20.0f, 20.0f)]; + [self.contentView addSubview:select_tag]; +} + +- (void)selected_cell:(BOOL )isSelect +{ + if(isSelect) + { + select_tag.image = [UIImage imageNamed:@"success-black.png"]; + self.conte_text.textColor = [UIColor blackColor]; + }else + { + select_tag.image = [UIImage imageNamed:@"registerPhoto_1"]; + self.conte_text.textColor = [UIColor darkGrayColor]; + } +} + +@end diff --git a/newsPicks/cell/NPTimeOnlineCell.m b/newsPicks/cell/NPTimeOnlineCell.m index 931bbbf..66b52a0 100644 --- a/newsPicks/cell/NPTimeOnlineCell.m +++ b/newsPicks/cell/NPTimeOnlineCell.m @@ -44,7 +44,7 @@ -(void)restCell:(NPListModel *)model UILabel *contentLable=[[UILabel alloc]init]; - contentLable.frame=CGRectMake(NPTimeOnlineCell_content_LeftPlace, contLableTop, contentView.frame.size.width-contentImageView.frame.size.width-NPTimeOnlineCell_content_LeftPlace*2, NPTimeOnlineCell_content_imagHight-2*contLableTop); + contentLable.frame=CGRectMake(NPTimeOnlineCell_content_LeftPlace, contLableTop, contentView.frame.size.width-contentImageView.frame.size.width-NPTimeOnlineCell_content_LeftPlace*2, NPTimeOnlineCell_content_imagHight); contentLable.numberOfLines=3; contentLable.textAlignment=NSTextAlignmentLeft; contentLable.font=[UIFont boldSystemFontOfSize:13]; @@ -56,7 +56,7 @@ -(void)restCell:(NPListModel *)model }else { UILabel *contentLable=[[UILabel alloc]init]; - contentLable.frame=CGRectMake(NPTimeOnlineCell_content_LeftPlace, contLableTop, contentView.frame.size.width-NPTimeOnlineCell_content_LeftPlace*2, NPTimeOnlineCell_content_imagHight-2*contLableTop); + contentLable.frame=CGRectMake(NPTimeOnlineCell_content_LeftPlace, contLableTop, contentView.frame.size.width-NPTimeOnlineCell_content_LeftPlace*2, NPTimeOnlineCell_content_imagHight); contentLable.numberOfLines=3; contentLable.textAlignment=NSTextAlignmentLeft; contentLable.font=[UIFont boldSystemFontOfSize:13]; @@ -64,7 +64,18 @@ -(void)restCell:(NPListModel *)model contentLable.textColor=[UIColor blackColor]; contentLable.text=model.title; [contentView addSubview:contentLable]; + } + + UILabel *userNameLabel = [[UILabel alloc] init]; + userNameLabel.frame = CGRectMake(NPTimeOnlineCell_content_LeftPlace, NPTimeOnlineCell_content_imagHight-2, contentView.frame.size.width-NPTimeOnlineCell_content_LeftPlace*2, 10); + userNameLabel.font = [UIFont systemFontOfSize:10]; + userNameLabel.backgroundColor = [UIColor clearColor]; + userNameLabel.textColor = [UIColor lightGrayColor]; + userNameLabel.textAlignment = NSTextAlignmentLeft; + userNameLabel.text = model.loginname; + [contentView addSubview:userNameLabel]; + UILabel *contLableSubTitle=[[UILabel alloc]init]; contLableSubTitle.font=[UIFont systemFontOfSize:10]; contLableSubTitle.frame=CGRectMake(NPTimeOnlineCell_content_LeftPlace, NPTimeOnlineCell_content_imagHight, contentView.frame.size.width-NPTimeOnlineCell_content_imagWidth-NPTimeOnlineCell_content_LeftPlace*2, NPTimeOnlineCell_content_timeHigth); @@ -139,7 +150,7 @@ -(void)restCell:(NPListModel *)model UIImageView *contentFollowView=[[UIImageView alloc]init]; contentFollowView.frame=CGRectMake(NPTimeOnlineCell_content_LeftPlace, contentTime.frame.size.height+contentTime.frame.origin.y+NPTimeOnlineCell_content_time_replayImg, NPTimeOnlineCell_content_replyImg_higth-15, NPTimeOnlineCell_content_replyImg_higth-15); contentFollowView.contentMode=UIViewContentModeScaleAspectFill; - [contentFollowView setImageWithURL:[NSURL URLWithString:@""] placeholderImage:[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]]; + [contentFollowView setImageWithURL:[NSURL URLWithString:model.userimage] placeholderImage:[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]]; [contentView addSubview:contentFollowView]; contentView.frame=CGRectMake(contentView.frame.origin.x, contentView.frame.origin.y, contentView.frame.size.width, contentFollowView.frame.size.height+contentFollowView.frame.origin.y+NPTimeOnlineCell_buttomPlace); } @@ -161,7 +172,7 @@ -(void)restPopularUsers:(NPlistPopularUsers *)popularUsers NPPopularUserView *popularView=[[NPPopularUserView alloc]init]; popularView.frame=CGRectMake(x, NPTimeOnlineCell_leftPlace, NPTimeOnlineCell_PopularUser_Higth-2*NPTimeOnlineCell_leftPlace, NPTimeOnlineCell_PopularUser_Higth-2*NPTimeOnlineCell_leftPlace); [popularView setImageWithURL:[NSURL URLWithString:user.headImageUrl] placeholderImage:[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]]; - popularView.leveImageView.image=[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]; +// popularView.leveImageView.image=[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]; [contentView addSubview:popularView]; x=popularView.frame.size.width+popularView.frame.origin.x+NPTimeOnlineCell_leftPlace; diff --git a/newsPicks/cell/NPTimeOnlineCell_iPad.h b/newsPicks/cell/NPTimeOnlineCell_iPad.h index 3fd576c..890408d 100644 --- a/newsPicks/cell/NPTimeOnlineCell_iPad.h +++ b/newsPicks/cell/NPTimeOnlineCell_iPad.h @@ -25,6 +25,21 @@ @property (weak, nonatomic) IBOutlet UIButton *pickBtn5; @property (weak, nonatomic) IBOutlet UILabel *titleLabel5; @property (weak, nonatomic) IBOutlet UIView *mContentView; +@property (weak, nonatomic) IBOutlet UILabel *title0; +@property (weak, nonatomic) IBOutlet UIView *avatarview0; +@property (weak, nonatomic) IBOutlet UILabel *title1; +@property (weak, nonatomic) IBOutlet UIView *avatarview1; +@property (weak, nonatomic) IBOutlet UILabel *title2; +@property (weak, nonatomic) IBOutlet UIView *avatarview2; +@property (weak, nonatomic) IBOutlet UILabel *title3; +@property (weak, nonatomic) IBOutlet UIView *avatarview3; +@property (weak, nonatomic) IBOutlet UILabel *title4; +@property (weak, nonatomic) IBOutlet UIView *avatarview4; +@property (weak, nonatomic) IBOutlet UILabel *time0; +@property (weak, nonatomic) IBOutlet UILabel *time1; +@property (weak, nonatomic) IBOutlet UILabel *time2; +@property (weak, nonatomic) IBOutlet UILabel *time3; +@property (weak, nonatomic) IBOutlet UILabel *time4; @property (assign, nonatomic) IBOutlet id delegate; @property (strong,nonatomic)NSArray *modelArray; diff --git a/newsPicks/cell/NPTimeOnlineCell_iPad.m b/newsPicks/cell/NPTimeOnlineCell_iPad.m index fc61ee2..810fa7a 100644 --- a/newsPicks/cell/NPTimeOnlineCell_iPad.m +++ b/newsPicks/cell/NPTimeOnlineCell_iPad.m @@ -61,6 +61,16 @@ -(void)restCell:(NSArray *)array{ NPListModel *model = [array objectAtIndex:i]; UILabel *label = [self valueForKey:[NSString stringWithFormat:@"titleLabel%d",i+1]]; label.text=model.content; + UILabel *timelabel = [self valueForKey:[NSString stringWithFormat:@"time%d",i]]; + timelabel.text = model.time; + UILabel *titleLabel = [self valueForKey:[NSString stringWithFormat:@"title%d",i]]; + titleLabel.text = model.title; + UIView *avatarView = [self valueForKey:[NSString stringWithFormat:@"avatarview%d",i]]; + UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 44, 46)]; + [imageView setImageWithURL:[NSURL URLWithString:model.userimage]]; + [avatarView addSubview:imageView]; + + UIButton *backBtn =[self valueForKey:[NSString stringWithFormat:@"backBtn%d",i+1]]; // [backBtn setBackgroundImageWithURL:[NSURL URLWithString:model.contentImage] forState:UIControlStateNormal]; UIImageView *iView = (UIImageView*)[self viewWithTag:1212+i]; diff --git a/newsPicks/cell/NPUserInfoDetailHeadView.m b/newsPicks/cell/NPUserInfoDetailHeadView.m index 6056075..af9e91f 100644 --- a/newsPicks/cell/NPUserInfoDetailHeadView.m +++ b/newsPicks/cell/NPUserInfoDetailHeadView.m @@ -96,7 +96,7 @@ -(void)restValue:(NPUserDetaiInfolModel *)infoModel { _multiPageView.text=infoModel.description; [_detailView restValue:infoModel]; - [self changeFollowStatus:infoModel.is_following.boolValue]; + [self changeFollowStatus:[infoModel.is_following isEqualToString:@"1"]]; _followingNumBtn.descriptionLabel.text=@"Following"; [_followingNumBtn setTitle:infoModel.following_num==nil?@"0":infoModel.following_num forState:UIControlStateNormal]; @@ -118,7 +118,7 @@ -(void)changeFollowStatus:(BOOL)follow { _followingBtn.layer.borderColor=[[UIColor clearColor]CGColor]; _followingBtn.layer.borderWidth=0; - [_followingBtn setTitle:@"following" forState:UIControlStateNormal]; + [_followingBtn setTitle:@"unfollow" forState:UIControlStateNormal]; [_followingBtn setBackgroundImage:[NPCustomMethod createImageWithColor:[UIColor colorWithRed:62.0f/255.0f green:69.0f/255.0f blue:113.0f/255.0f alpha:1] size:_followingBtn.frame.size] forState:UIControlStateNormal]; } diff --git a/newsPicks/controller/NPBaseViewController.m b/newsPicks/controller/NPBaseViewController.m index bd6bc92..2cccb57 100644 --- a/newsPicks/controller/NPBaseViewController.m +++ b/newsPicks/controller/NPBaseViewController.m @@ -35,7 +35,7 @@ -(void)loadView { [super loadView]; if (IOS7_OR_LATER) { - self.view.frame=CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, [UIScreen mainScreen].bounds.size.width, self.view.frame.size.height-20); +// self.view.frame=CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, [UIScreen mainScreen].bounds.size.width, self.view.frame.size.height-20); } } - (void)viewDidLoad diff --git a/newsPicks/controller/NPMainViewController.m b/newsPicks/controller/NPMainViewController.m index 650bac2..19b4200 100644 --- a/newsPicks/controller/NPMainViewController.m +++ b/newsPicks/controller/NPMainViewController.m @@ -20,6 +20,7 @@ #import "TestViewController.h" #import "UIViewController+MJPopupViewController.h" #import "LoginViewController_iPad.h" +#import "NPRecommandThreadModel.h" static void *flabbyContext = &flabbyContext; @interface NPMainViewController () { @@ -31,6 +32,7 @@ @interface NPMainViewController () @property (nonatomic, strong, readonly) UIActionSheet *pageActionSheet; @property (nonatomic, strong) UIWebView *mainWebView; -@property (nonatomic, strong) NSURL *URL; - (id)initWithAddress:(NSString*)urlString; - (id)initWithURL:(NSURL*)URL; diff --git a/newsPicks/controller_ipad/LoginRootViewController.h b/newsPicks/controller_ipad/LoginRootViewController.h new file mode 100644 index 0000000..fdef6dd --- /dev/null +++ b/newsPicks/controller_ipad/LoginRootViewController.h @@ -0,0 +1,13 @@ +// +// LoginRootViewController.h +// newsPicks +// +// Created by ZhangCheng on 14-8-31. +// Copyright (c) 2014年 ZhangCheng. All rights reserved. +// + +#import + +@interface LoginRootViewController : UIViewController + +@end diff --git a/newsPicks/controller_ipad/LoginRootViewController.m b/newsPicks/controller_ipad/LoginRootViewController.m new file mode 100644 index 0000000..d3fb24d --- /dev/null +++ b/newsPicks/controller_ipad/LoginRootViewController.m @@ -0,0 +1,53 @@ +// +// LoginRootViewController.m +// newsPicks +// +// Created by ZhangCheng on 14-8-31. +// Copyright (c) 2014年 ZhangCheng. All rights reserved. +// + +#import "LoginRootViewController.h" + +@interface LoginRootViewController () + +@end + +@implementation LoginRootViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view. + [self.navigationController setNavigationBarHidden:YES animated:NO]; + [self setNeedsStatusBarAppearanceUpdate]; +} +-(UIStatusBarStyle)preferredStatusBarStyle{ + return UIStatusBarStyleLightContent; +} +- (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/newsPicks/controller_ipad/LoginViewController_iPad.m b/newsPicks/controller_ipad/LoginViewController_iPad.m index 7892d21..4316aef 100644 --- a/newsPicks/controller_ipad/LoginViewController_iPad.m +++ b/newsPicks/controller_ipad/LoginViewController_iPad.m @@ -29,11 +29,19 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. + +} +-(UIStatusBarStyle)preferredStatusBarStyle{ + return UIStatusBarStyleLightContent; } -(BOOL)textFieldShouldReturn:(UITextField *)textField{ [textField resignFirstResponder]; return NO; } +-(IBAction)backAction{ + [self.navigationController popViewControllerAnimated:YES]; +} + -(IBAction)loginAction:(id)sender{ if ([self.emailTF.text isEqualToString:@""]) { return; @@ -55,6 +63,27 @@ -(IBAction)loginAction:(id)sender{ } }]; } +-(IBAction)regAction:(id)sender{ + if ([self.emailTF.text isEqualToString:@""]) { + return; + } + [NPHTTPRequest getLoginUser:self.emailTF.text type:@"facebook" usingSuccessBlock:^(BOOL isSuccess, NSDictionary *result) { + if (isSuccess) { + NSLog(@"Yes:%@",result); + NSNumber *uid = result[@"data"]; + [[NSUserDefaults standardUserDefaults]setObject:uid forKey:@"com.zhangcheng.uid"]; + [[NSUserDefaults standardUserDefaults]synchronize]; + [self performSegueWithIdentifier:@"next" sender:nil]; + }else{ + if (result==nil) { + [SVProgressHUD showErrorWithStatus:@"网络请求失败"]; + }else{ + [SVProgressHUD showErrorWithStatus:result[@"message"]]; + } + NSLog(@"no:%@",result); + } + }]; +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/newsPicks/controller_ipad/Main_iPad.storyboard b/newsPicks/controller_ipad/Main_iPad.storyboard index 1c345e9..25c566e 100644 --- a/newsPicks/controller_ipad/Main_iPad.storyboard +++ b/newsPicks/controller_ipad/Main_iPad.storyboard @@ -5,6 +5,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -28,155 +322,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -187,52 +334,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -450,6 +1053,11 @@ + + + + + @@ -462,6 +1070,15 @@ + + + + + + + + + @@ -469,6 +1086,383 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -574,7 +1568,7 @@ - + diff --git a/newsPicks/controller_ipad/TestViewController.m b/newsPicks/controller_ipad/TestViewController.m index 15e317a..3c3902b 100644 --- a/newsPicks/controller_ipad/TestViewController.m +++ b/newsPicks/controller_ipad/TestViewController.m @@ -12,12 +12,14 @@ #import "NPUserDetaiInfolModel.h" #import "NPUserDetailViewController.h" #import "NPNewsListViewController_ipad.h" +#import "SVProgressHUD.h" @interface TestViewController (){ IBOutlet UITableView *mTableView; NSMutableArray *list; NSString *_uid; int currentPage; + BOOL isNib; } @end @@ -30,12 +32,16 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil if (self) { // Custom initialization self.view.frame=CGRectMake(768, 40, self.view.frame.size.width, self.view.frame.size.height); + isNib=YES; } return self; } -(IBAction)backAction:(id)sender{ [((NPMainViewController*)self.parentViewController) closeSecView]; } +-(IBAction)backAction2{ + [self.navigationController popViewControllerAnimated:YES]; +} - (void)viewDidLoad { [super viewDidLoad]; @@ -47,11 +53,18 @@ - (void)viewDidLoad [self loadMore]; } +-(UIStatusBarStyle)preferredStatusBarStyle{ + return UIStatusBarStyleLightContent; +} +-(IBAction)nextAction{ + [self.navigationController dismissViewControllerAnimated:YES completion:nil]; +} -(void)loadMore { - [NPHTTPRequest getUserInfoFollowing:YES uid:_uid page:currentPage+1 usingSuccessBlock:^(BOOL isSuccess, NSArray *result) { + [NPHTTPRequest getRecommandUser:_uid page:1 usingSuccessBlock:^(BOOL isSuccess, NSArray *result) { if (isSuccess) { - currentPage++; +// currentPage++; + [list removeAllObjects]; [list addObjectsFromArray:result]; [mTableView reloadData]; } @@ -70,7 +83,13 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS static NSString *cellID=@"checkID"; NPFollowCell *cell=[tableView dequeueReusableCellWithIdentifier:cellID]; if (!cell) { - cell=[[NPFollowCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + if (isNib) { + cell=[[NPFollowCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; + + }else{ + cell=[[NPFollowCell alloc]initWithStyle2:UITableViewCellStyleDefault reuseIdentifier:cellID]; + + } cell.selectionStyle=UITableViewCellSelectionStyleGray; cell.delegate=self; } @@ -82,12 +101,27 @@ -(void)NPFollowCellClickFollowing:(NPFollowCell *)cell NPUserDetaiInfolModel *infoModel=[list objectAtIndex:[mTableView indexPathForCell:cell].row]; if (infoModel.is_following.boolValue) { infoModel.is_following=@"0"; + [NPHTTPRequest getUnfollowUser:_uid targetUser:infoModel.uid usingSuccessBlock:^(BOOL isSuccess, NSDictionary *dic) { + if(isSuccess){ + + }else{ + [SVProgressHUD showErrorWithStatus:dic[@"message"]]; + } + }]; }else { infoModel.is_following=@"1"; + [NPHTTPRequest getFollowUser:_uid targetUser:infoModel.uid usingSuccessBlock:^(BOOL isSuccess, NSDictionary *dic) { + if(isSuccess){ + + }else{ + [SVProgressHUD showErrorWithStatus:dic[@"message"]]; + } + }]; } [mTableView reloadData]; } + -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NPUserDetaiInfolModel *infoModel=[list objectAtIndex:indexPath.row]; diff --git a/newsPicks/controller_ipad/TestViewController.xib b/newsPicks/controller_ipad/TestViewController.xib index 2604cfa..293e904 100644 --- a/newsPicks/controller_ipad/TestViewController.xib +++ b/newsPicks/controller_ipad/TestViewController.xib @@ -16,19 +16,26 @@ - + + + + - + + + + + + + + + + diff --git a/newsPicks/controller_iphone/LoginViewController.m b/newsPicks/controller_iphone/LoginViewController.m index ee2d86e..99a2cf9 100644 --- a/newsPicks/controller_iphone/LoginViewController.m +++ b/newsPicks/controller_iphone/LoginViewController.m @@ -45,6 +45,7 @@ -(IBAction)loginAction:(id)sender{ NSLog(@"Yes:%@",result); NSNumber *uid = result[@"data"]; [[NSUserDefaults standardUserDefaults]setObject:uid forKey:@"com.zhangcheng.uid"]; + [[NSUserDefaults standardUserDefaults]setObject:self.emailTF.text forKey:@"com.zhangcheng.username"]; [[NSUserDefaults standardUserDefaults]synchronize]; [self.navigationController dismissViewControllerAnimated:YES completion:nil]; }else{ diff --git a/newsPicks/controller_iphone/Main_iPhone.storyboard b/newsPicks/controller_iphone/Main_iPhone.storyboard new file mode 100644 index 0000000..4b63f0b --- /dev/null +++ b/newsPicks/controller_iphone/Main_iPhone.storyboard @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newsPicks/controller_iphone/NPContentUrlViewController.m b/newsPicks/controller_iphone/NPContentUrlViewController.m index 9649d97..397d6c0 100644 --- a/newsPicks/controller_iphone/NPContentUrlViewController.m +++ b/newsPicks/controller_iphone/NPContentUrlViewController.m @@ -11,11 +11,13 @@ #import "SVProgressHUD.h" #import "UIViewController+MJPopupViewController.h" -@interface NPContentUrlViewController (){ +@interface NPContentUrlViewController (){ NSThread *th; } @property (strong, nonatomic) IBOutlet UIBarButtonItem *rightBtn; @property (weak, nonatomic) IBOutlet UITextField *urlTF; +@property (weak, nonatomic) IBOutlet UIWebView *webView; + @property (weak, nonatomic) IBOutlet UILabel *titleLabel; @property (weak, nonatomic) IBOutlet UITextView *contentTV; @property (weak, nonatomic) IBOutlet UIButton *btn; @@ -28,14 +30,21 @@ - (IBAction)sendAction:(id)sender { [SVProgressHUD showErrorWithStatus:@"URL无效或者没有有效的标题"]; return; } - [NPHTTPRequest sendAddThread:[[NSUserDefaults standardUserDefaults]objectForKey:@"com.zhangcheng.uid"] title:self.titleLabel.text type:@"0" content:self.contentTV.text link:self.urlTF.text usingSuccessBlock:^(BOOL isSuccess, NSDictionary *result) { + + NSString *str = nil; + if ([self.urlTF.text hasPrefix:@"http://"]) { + str=self.urlTF.text; + }else{ + str = [NSString stringWithFormat:@"http://%@",self.urlTF.text]; + } + [NPHTTPRequest sendAddThread:[[NSUserDefaults standardUserDefaults]objectForKey:@"com.zhangcheng.uid"] title:self.titleLabel.text type:@"0" content:self.contentTV.text link:str usingSuccessBlock:^(BOOL isSuccess, NSDictionary *result) { if (isSuccess) { [SVProgressHUD showSuccessWithStatus:@"发送成功!"]; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) [self.navigationController popViewControllerAnimated:YES]; else - [self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade completion:nil]; + [self.navigationController dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade completion:nil]; }else{ [SVProgressHUD showErrorWithStatus:@"发送失败"]; } @@ -54,13 +63,41 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil return self; } - (IBAction)URLChangedAction:(UITextField*)sender { - if (th) { - [th cancel]; - th=nil; - } +// if (th) { +// [th cancel]; +// th=nil; +// } +// +// th = [[NSThread alloc]initWithTarget:self selector:@selector(dealWithURL:) object:sender.text]; +// [th start]; - th = [[NSThread alloc]initWithTarget:self selector:@selector(dealWithURL:) object:sender.text]; - [th start]; + NSString *str = nil; + if ([sender.text hasPrefix:@"http://"]) { + str=sender.text; + }else{ + str = [NSString stringWithFormat:@"http://%@",sender.text]; + } + [self.webView stopLoading]; + NSURL *url =[NSURL URLWithString:str]; + [self.webView loadRequest:[NSURLRequest requestWithURL:url]]; +} + +-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ + [UIApplication sharedApplication].networkActivityIndicatorVisible =NO; + + self.titleLabel.text=@""; +} +-(void)webViewDidStartLoad:(UIWebView *)webView{ + [UIApplication sharedApplication].networkActivityIndicatorVisible =YES; + +} +-(void)webViewDidFinishLoad:(UIWebView *)webView{ + [UIApplication sharedApplication].networkActivityIndicatorVisible =NO; + + NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; + if (![self.titleLabel.text isEqualToString:title]) { + self.titleLabel.text=title; + } } -(void)dealWithURL:(NSString*)URL{ NSString *str = nil; @@ -70,10 +107,13 @@ -(void)dealWithURL:(NSString*)URL{ str = [NSString stringWithFormat:@"http://%@",URL]; } NSError *error ; +// NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:str]]; +// NSData *received = [NSURLConnection sendSynchronousRequest:req returningResponse:nil error:nil]; +// NSString *str2 = [[NSString alloc]initWithData:received encoding:NSUTF8StringEncoding]; NSString *str2 = [[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:str] encoding:NSUTF8StringEncoding error:&error]; if (!error) { - + NSLog(@"%@",str2); NSRange r1 =[str2 rangeOfString:@""]; NSRange r2 =[str2 rangeOfString:@""]; if (r1.location!=NSNotFound && r2.location!=NSNotFound) { @@ -81,6 +121,8 @@ -(void)dealWithURL:(NSString*)URL{ NSString *str3 =[[str2 substringToIndex:r2.location]substringFromIndex:r1.location+r1.length]; self.titleLabel.text=str3; + }else{ + self.titleLabel.text=str2.length>20?[str2 substringToIndex:20]:str2; } }else{ diff --git a/newsPicks/controller_iphone/NPContentUrlViewController.xib b/newsPicks/controller_iphone/NPContentUrlViewController.xib index 3a98557..6f08548 100644 --- a/newsPicks/controller_iphone/NPContentUrlViewController.xib +++ b/newsPicks/controller_iphone/NPContentUrlViewController.xib @@ -13,6 +13,7 @@ + @@ -68,6 +69,15 @@ + + + + + + + + + diff --git a/newsPicks/controller_iphone/NPFollowersRobotsController.m b/newsPicks/controller_iphone/NPFollowersRobotsController.m index 7a52a26..b4da7d3 100644 --- a/newsPicks/controller_iphone/NPFollowersRobotsController.m +++ b/newsPicks/controller_iphone/NPFollowersRobotsController.m @@ -10,6 +10,7 @@ #import "NPFollowCell.h" #import "NPUserDetaiInfolModel.h" #import "NPUserDetailViewController.h" +#import "SVProgressHUD.h" @interface NPFollowersRobotsController () { UITabBar *tabBar; @@ -60,20 +61,32 @@ - (void)viewDidLoad mTableView.dataSource=self; [self.view addSubview:mTableView]; - [self loadMore]; [super viewDidLoad]; // Do any additional setup after loading the view. } +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self loadMore]; + +} -(void)loadMore { - [NPHTTPRequest getUserInfoFollowing:YES uid:_uid page:currentPage+1 usingSuccessBlock:^(BOOL isSuccess, NSArray *result) { + [NPHTTPRequest getRecommandUser:_uid page:1 usingSuccessBlock:^(BOOL isSuccess, NSArray *result) { if (isSuccess) { - currentPage++; +// currentPage++; + [list removeAllObjects]; [list addObjectsFromArray:result]; [mTableView reloadData]; } }]; +// [NPHTTPRequest getUserInfoFollowing:YES uid:_uid page:currentPage+1 usingSuccessBlock:^(BOOL isSuccess, NSArray *result) { +// if (isSuccess) { +// currentPage++; +// [list addObjectsFromArray:result]; +// [mTableView reloadData]; +// } +// }]; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { @@ -100,9 +113,23 @@ -(void)NPFollowCellClickFollowing:(NPFollowCell *)cell NPUserDetaiInfolModel *infoModel=[list objectAtIndex:[mTableView indexPathForCell:cell].row]; if (infoModel.is_following.boolValue) { infoModel.is_following=@"0"; + [NPHTTPRequest getUnfollowUser:_uid targetUser:infoModel.uid usingSuccessBlock:^(BOOL isSuccess, NSDictionary *dic) { + if(isSuccess){ + + }else{ + [SVProgressHUD showErrorWithStatus:dic[@"message"]]; + } + }]; }else { infoModel.is_following=@"1"; + [NPHTTPRequest getFollowUser:_uid targetUser:infoModel.uid usingSuccessBlock:^(BOOL isSuccess, NSDictionary *dic) { + if(isSuccess){ + + }else{ + [SVProgressHUD showErrorWithStatus:dic[@"message"]]; + } + }]; } [mTableView reloadData]; } diff --git a/newsPicks/controller_iphone/NPNewListDetailViewController.m b/newsPicks/controller_iphone/NPNewListDetailViewController.m index 207657e..31a17f9 100644 --- a/newsPicks/controller_iphone/NPNewListDetailViewController.m +++ b/newsPicks/controller_iphone/NPNewListDetailViewController.m @@ -14,11 +14,14 @@ #import "NPNewListDetailFootReplysView.h" #import "NPUserDetailViewController.h" #import "SVWebViewController.h" +#import "NPTextInputViewController.h" +#import "UIViewController+MJPopupViewController.h" @interface NPNewListDetailViewController () { UITableView *mTableView; NSMutableDictionary *mDicData; } +@property(nonatomic,strong)NPTextInputViewController *textInputviewController; @end @implementation NPNewListDetailViewController @@ -33,10 +36,31 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil } -(void)clickHeadView:(UITapGestureRecognizer *)ges { - SVWebViewController *webController=[[SVWebViewController alloc]initWithURL:[NSURL URLWithString:self.listModel.link]]; + SVWebViewController *webController=[[SVWebViewController alloc]init]; + webController.URL = [NSURL URLWithString:self.listModel.link]; webController.availableActions=0; [self.navigationController pushViewController:webController animated:YES]; +} +-(void)viewWillAppear:(BOOL)animated +{ + [self.view setBackgroundColor:[UIColor whiteColor]]; + UIButton *picButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, [UIImage imageNamed:@"img_pick_navy"].size.width/2, [UIImage imageNamed:@"img_pick_navy"] .size.height/2)]; + [picButton addTarget:self action:@selector(pickThisNews) forControlEvents:UIControlEventTouchUpInside]; + [picButton setBackgroundImage:[UIImage imageNamed:@"img_pick_navy"] forState:UIControlStateNormal]; + self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:picButton]; + + if(UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone){ + self.title = self.listModel.title; + } +} +-(void)pickThisNews +{ + self.textInputviewController= [[NPTextInputViewController alloc]initWithNibName:@"NPTextInputViewController" bundle:nil]; + self.textInputviewController.tid=self.listModel.listID; + self.textInputviewController.mTitle=self.listModel.title; + [self presentPopupViewController:self.textInputviewController animationType:MJPopupViewAnimationSlideBottomTop]; + } - (void)viewDidLoad { @@ -76,7 +100,6 @@ - (void)viewDidLoad } [self performSelector:@selector(loadData) withObject:nil afterDelay:1.5]; - // Do any additional setup after loading the view. } -(void)loadData { @@ -146,21 +169,23 @@ -(void)endLoadView } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData]; - NSString *key = [allKeys objectAtIndex:section]; - NSArray *value = [mDicData valueForKey:key]; - return [value count]; +// NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData]; +// NSString *key = [allKeys objectAtIndex:section]; +// NSArray *value = [mDicData valueForKey:key]; + return 10; +// return [value count]; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return mDicData.allKeys.count; + return 2; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData]; - NSString *key = [allKeys objectAtIndex:indexPath.section]; - NSArray *value = [mDicData valueForKey:key]; - return [NPNewListDetailCell cellHigth:[value objectAtIndex:indexPath.row]]; +// NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData]; +// NSString *key = [allKeys objectAtIndex:indexPath.section]; +// NSArray *value = [mDicData valueForKey:key]; +// return [NPNewListDetailCell cellHigth:[value objectAtIndex:indexPath.row]]; + return 100; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { @@ -169,8 +194,8 @@ -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData];; - NSString *key = [allKeys objectAtIndex:section]; +// NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData];; +// NSString *key = [allKeys objectAtIndex:section]; UIView *view=[[UIView alloc] init]; view.frame=CGRectMake(0, 0, self.view.frame.size.width, 25); @@ -183,7 +208,8 @@ -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger) title.frame=CGRectMake(5, 0, view.frame.size.width-5, view.frame.size.height); title.font=[UIFont boldSystemFontOfSize:15]; title.textColor=[UIColor grayColor]; - title.text=key;; +// title.text=key; + title.text = @"comments"; title.backgroundColor=[UIColor clearColor]; [view addSubview:title]; return view; @@ -198,10 +224,11 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS cell.selectionStyle=UITableViewCellSelectionStyleNone; } - NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData];; - NSString *key = [allKeys objectAtIndex:indexPath.section]; - NSArray *value = [mDicData valueForKey:key]; - [cell restCell:[value objectAtIndex:indexPath.row]]; +// NSArray *allKeys = [NPCustomMethod sortNewsListKey:mDicData];; +// NSString *key = [allKeys objectAtIndex:indexPath.section]; +// NSArray *value = [mDicData valueForKey:key]; +// [cell restCell:[value objectAtIndex:indexPath.row]]; + [cell restCell:nil]; return cell; } //click userHeader diff --git a/newsPicks/controller_iphone/NPSetingProfileController.m b/newsPicks/controller_iphone/NPSetingProfileController.m index 2872587..5689687 100644 --- a/newsPicks/controller_iphone/NPSetingProfileController.m +++ b/newsPicks/controller_iphone/NPSetingProfileController.m @@ -7,6 +7,8 @@ // #import "NPSetingProfileController.h" +#import "SVProgressHUD.h" + @interface NPSetingProfileController () { @@ -16,7 +18,9 @@ @interface NPSetingProfileController () UITextField *textFildFirstName; UITextField *textFildCompand; UITextField *textFildJob; - UITextView *textBio;; + UITextView *textBio; + + NSString *user_name; } @end @@ -30,8 +34,25 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil } return self; } - +-(void)viewWillAppear:(BOOL)animated +{ + [self.view setBackgroundColor:[UIColor whiteColor]]; +} - (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view. + [self creatNavBtn]; + [self creatContentView]; + [self requestUserMessage]; +} + +- (void)creatNavBtn +{ + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"SAVE" style:UIBarButtonItemStylePlain target:self action:@selector(saveMessage)]; +} + +- (void)creatContentView { mScrollView.backgroundColor=[UIColor whiteColor]; mScrollView=[[UIScrollView alloc]init]; @@ -48,18 +69,19 @@ - (void)viewDidLoad lableID.backgroundColor=[UIColor clearColor]; lableID.textColor=[UIColor lightGrayColor]; lableID.text=@"ID *"; - [mScrollView addSubview:lableID]; - +// [mScrollView addSubview:lableID]; +// textFieldID=[[UITextField alloc]init]; textFieldID.frame=CGRectMake(lableID.frame.origin.x, lableID.frame.size.height+lableID.frame.origin.y,self.view.frame.size.width-leftPlace*2, 25); textFieldID.layer.borderWidth=0.5; textFieldID.delegate=self; textFieldID.layer.borderColor=[UIColor blackColor].CGColor; textFieldID.borderStyle=UITextBorderStyleNone; - [mScrollView addSubview:textFieldID]; +// [mScrollView addSubview:textFieldID]; UILabel *labeLastName=[[UILabel alloc]init]; - labeLastName.frame=CGRectMake(lableID.frame.origin.x, textFieldID.frame.size.height+textFieldID.frame.size.height+place, (self.view.frame.size.width-leftPlace*2-30)/2, lableID.frame.size.height); +// labeLastName.frame=CGRectMake(lableID.frame.origin.x, textFieldID.frame.size.height+textFieldID.frame.size.height+place, (self.view.frame.size.width-leftPlace*2-30)/2, lableID.frame.size.height); + labeLastName.frame=CGRectMake(lableID.frame.origin.x, 3, (self.view.frame.size.width-leftPlace*2-30)/2, lableID.frame.size.height); labeLastName.font=lableID.font; labeLastName.textColor=lableID.textColor; labeLastName.backgroundColor=[UIColor clearColor]; @@ -75,13 +97,14 @@ - (void)viewDidLoad [mScrollView addSubview:textFildLastName]; UILabel *labelFirstName=[[UILabel alloc]init]; - labelFirstName.frame=CGRectMake(labeLastName.frame.size.width+labeLastName.frame.origin.x+30, labeLastName.frame.origin.y, labeLastName.frame.size.width, labeLastName.frame.size.height); +// labelFirstName.frame=CGRectMake(labeLastName.frame.size.width+labeLastName.frame.origin.x+30, labeLastName.frame.origin.y, labeLastName.frame.size.width, labeLastName.frame.size.height); + labelFirstName.frame=CGRectMake(labeLastName.frame.size.width+labeLastName.frame.origin.x+30, 3, labeLastName.frame.size.width, labeLastName.frame.size.height); labelFirstName.backgroundColor=[UIColor clearColor]; labelFirstName.font=labeLastName.font; labelFirstName.textColor=labeLastName.textColor; labelFirstName.text=@"First Name"; [mScrollView addSubview:labelFirstName]; - + textFildFirstName=[[UITextField alloc]init]; textFildFirstName.frame=CGRectMake(labelFirstName.frame.origin.x, labelFirstName.frame.size.height+labelFirstName.frame.origin.y, labelFirstName.frame.size.width, textFieldID.frame.size.height); textFildFirstName.backgroundColor=[UIColor clearColor]; @@ -143,8 +166,6 @@ - (void)viewDidLoad mScrollView.contentSize=CGSizeMake(mScrollView.frame.size.width, textBio.frame.size.height+textBio.frame.origin.y+130); [mScrollView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapContent)]]; - [super viewDidLoad]; - // Do any additional setup after loading the view. } -(void)tapContent { @@ -171,15 +192,41 @@ - (void)didReceiveMemoryWarning // Dispose of any resources that can be recreated. } -/* -#pragma mark - Navigation +- (void)saveMessage +{ + [NPHTTPRequest sendProfile:user_name family:textFildFirstName.text given:textFildLastName.text company:textFildCompand.text position:textFildJob.text description:textBio.text userimage:nil usingSuccessBlock:^(BOOL isSuccess, NSDictionary *dic) { + if (isSuccess) { + [SVProgressHUD showSuccessWithStatus:@"发送成功!"]; + + if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) + [self.navigationController popViewControllerAnimated:YES]; + else + [self.navigationController popViewControllerAnimated:YES]; + }else{ + [SVProgressHUD showErrorWithStatus:@"发送失败"]; + } + }]; +} -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +- (void)requestUserMessage { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. + + [NPHTTPRequest getUserInfo:[[NSUserDefaults standardUserDefaults]objectForKey:@"com.zhangcheng.uid"] successBlock:^(BOOL isSuccess, NPUserInfoModel *result) { + if (isSuccess) { + user_name = result.name; + textBio.text = result.description; + textFildFirstName.text=result.family; + textFildCompand.text = result.company; + textFildJob.text = result.position; + textFildLastName.text = result.given; + }else + { + [SVProgressHUD showErrorWithStatus:@"加载失败"]; + [self.navigationController popViewControllerAnimated:YES]; + } + }]; } -*/ + + @end diff --git a/newsPicks/controller_iphone/NPSettingEmailController.m b/newsPicks/controller_iphone/NPSettingEmailController.m index 44d0d76..c9a7587 100644 --- a/newsPicks/controller_iphone/NPSettingEmailController.m +++ b/newsPicks/controller_iphone/NPSettingEmailController.m @@ -25,10 +25,43 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil } return self; } - +-(void)viewWillAppear:(BOOL)animated +{ + [self.view setBackgroundColor:[UIColor whiteColor]]; +} - (void)viewDidLoad { self.title=@"Email"; + [super viewDidLoad]; + // Do any additional setup after loading the view. + [self creatContent]; +} +-(void)tapContent +{ + [textEmailTwo resignFirstResponder]; + [textEmail resignFirstResponder]; +} +- (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. +} +*/ + +- (void)creatContent +{ + UIBarButtonItem *barBtn = [[UIBarButtonItem alloc] initWithTitle:@"SAVE" style:UIBarButtonItemStylePlain target:self action:@selector(saveEmail)]; + self.navigationItem.rightBarButtonItem = barBtn; UILabel *labelCurrent=[[UILabel alloc]init]; labelCurrent.font=[UIFont systemFontOfSize:15]; labelCurrent.textColor=[UIColor lightGrayColor]; @@ -76,29 +109,14 @@ - (void)viewDidLoad waring.text=@"*Re-enter for confirmation purpose"; [self.view addSubview:waring]; [self.view addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapContent)]]; - [super viewDidLoad]; - // Do any additional setup after loading the view. -} --(void)tapContent -{ - [textEmailTwo resignFirstResponder]; - [textEmail resignFirstResponder]; -} -- (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 +- (void)saveEmail { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. + if ([textEmail.text isEqualToString:textEmailTwo.text]) { + + } } -*/ @end diff --git a/newsPicks/controller_iphone/NPSettingInterestController.m b/newsPicks/controller_iphone/NPSettingInterestController.m index 4bd5947..2c003f6 100644 --- a/newsPicks/controller_iphone/NPSettingInterestController.m +++ b/newsPicks/controller_iphone/NPSettingInterestController.m @@ -7,18 +7,24 @@ // #import "NPSettingInterestController.h" +#import "NPThemeOfInterestCellTableViewCell.h" -@interface NPSettingInterestController () +@interface NPSettingInterestController (){ + NSMutableArray *_array; +} @end @implementation NPSettingInterestController - +-(IBAction)backAction{ + [self.navigationController popViewControllerAnimated:YES]; +} - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization + self.title=@"Theme of Interest"; } return self; } @@ -27,23 +33,46 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. + [self initData]; } -- (void)didReceiveMemoryWarning +- (void)initData { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} + _array = [[NSMutableArray alloc]initWithArray:[[NSUserDefaults standardUserDefaults]objectForKey:@"com.zhangcheng.categoryArray"]]; -/* -#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. +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return 10; +} +-(UIStatusBarStyle)preferredStatusBarStyle{ + return UIStatusBarStyleLightContent; +} +-(NPThemeOfInterestCellTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + NPThemeOfInterestCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; + if (cell==nil) { + cell = [[NPThemeOfInterestCellTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; + } + cell.conte_text.text = [NSString stringWithFormat:@"category %d",(int)indexPath.row]; + [cell selected_cell:[_array indexOfObject:[NSNumber numberWithInt:indexPath.row]]==NSNotFound?NO:YES]; +// cell.accessoryType=[_array indexOfObject:[NSNumber numberWithInt:indexPath.row]]==NSNotFound?UITableViewCellAccessoryNone:UITableViewCellAccessoryCheckmark; + return cell; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + NSInteger index =[_array indexOfObject:[NSNumber numberWithInt:indexPath.row]]; + if (index == NSNotFound) { + [_array addObject:[NSNumber numberWithInt:indexPath.row]]; + NPThemeOfInterestCellTableViewCell *cell =[tableView cellForRowAtIndexPath:indexPath]; + [cell selected_cell:YES]; + }else{ + [_array removeObject:[NSNumber numberWithInt:indexPath.row]]; + NPThemeOfInterestCellTableViewCell *cell =[tableView cellForRowAtIndexPath:indexPath]; +// cell.accessoryType=UITableViewCellAccessoryNone; + [cell selected_cell:NO]; + } + [[NSUserDefaults standardUserDefaults]setObject:[NSArray arrayWithArray:_array] forKey:@"com.zhangcheng.categoryArray"]; + [[NSUserDefaults standardUserDefaults]synchronize]; } -*/ @end diff --git a/newsPicks/controller_iphone/NPSettingInterestController.xib b/newsPicks/controller_iphone/NPSettingInterestController.xib new file mode 100644 index 0000000..22da387 --- /dev/null +++ b/newsPicks/controller_iphone/NPSettingInterestController.xib @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newsPicks/controller_iphone/NPSettingViewController.m b/newsPicks/controller_iphone/NPSettingViewController.m index 3846e4a..08c8eae 100644 --- a/newsPicks/controller_iphone/NPSettingViewController.m +++ b/newsPicks/controller_iphone/NPSettingViewController.m @@ -15,10 +15,13 @@ #import "UIViewController+MJPopupViewController.h" #import "LoginViewController_iPad.h" #import "NPMainViewController.h" -@interface NPSettingViewController () +@interface NPSettingViewController () { UITableView *mTableView; + UIImagePickerController *_imagePickerController; + } +@property(strong,nonatomic)NSData *imageData; @end @implementation NPSettingViewController @@ -44,6 +47,14 @@ - (void)viewDidLoad mTableView.tableFooterView=foot; [super viewDidLoad]; // Do any additional setup after loading the view. + _imagePickerController = [[UIImagePickerController alloc]init]; + _imagePickerController.delegate = self; + _imagePickerController.videoQuality = UIImagePickerControllerQualityTypeLow; + [self performSelectorInBackground:@selector(getImageDataInBackground) withObject:nil]; +} +-(void)getImageDataInBackground{ + self.imageData = [[NSUserDefaults standardUserDefaults]objectForKey:@"com.zhangcheng.userImage"]; + [mTableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationNone]; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { @@ -110,7 +121,7 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS if (indexPath.section==0) { UIImageView *imageView=[[UIImageView alloc]init]; imageView.frame=CGRectMake(9, 0, 40, 40); - imageView.image=[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]; + imageView.image=self.imageData==nil?[UIImage imageNamed:NP_IMG_TIME_ONLINE_DEFAULT]:[UIImage imageWithData:self.imageData]; imageView.tag=100; [cell.contentView addSubview:imageView]; cell.textLabel.textAlignment=NSTextAlignmentCenter; @@ -155,7 +166,8 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath * { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (indexPath.section==0) { - UIActionSheet *sheet=[[UIActionSheet alloc]initWithTitle:@"Select Photo" delegate:nil cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"From Photo Library",@"Take Photo", nil]; + UIActionSheet *sheet=[[UIActionSheet alloc]initWithTitle:@"Select Photo" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Take Photo",@"From Photo Library", nil]; + [sheet showInView:self.view]; } if (indexPath.section==1) { @@ -173,7 +185,7 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath * } } if (indexPath.section==2) { - NPSettingInterestController *interestController=[[NPSettingInterestController alloc]init]; + NPSettingInterestController *interestController=[[NPSettingInterestController alloc]initWithNibName:@"NPSettingInterestController" bundle:nil]; [self.navigationController pushViewController:interestController animated:YES]; } if (indexPath.section==3) { @@ -196,21 +208,61 @@ -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)button }else{ [self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade completion:^{ - LoginViewController_iPad *viewController = [[LoginViewController_iPad alloc]initWithNibName:@"LoginViewController_iPad" bundle:nil]; - UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:viewController]; - [nav setNavigationBarHidden:YES]; + UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil]; + UINavigationController *nav = [sb instantiateViewControllerWithIdentifier:@"LoginNavViewController"]; nav.modalTransitionStyle=UIModalTransitionStyleCrossDissolve; [((NPMainViewController*)((UINavigationController*)((UIWindow*)[UIApplication sharedApplication].windows.firstObject).rootViewController).viewControllers.firstObject) viewWillAppear:NO]; }]; } } } +- (void)_getMediaFromSource:(UIImagePickerControllerSourceType)sourceType { + if ([UIImagePickerController isSourceTypeAvailable: + sourceType]) { + _imagePickerController.sourceType = sourceType; + _imagePickerController.allowsEditing = NO; + [self presentViewController:_imagePickerController animated:YES completion:^(void){}]; + } + else { + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"访问摄像头失败" message:@"未监测到摄像头" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; + [alertView show]; + } +} +-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ + switch (buttonIndex) { + case 0: + [self _getMediaFromSource:UIImagePickerControllerSourceTypeCamera]; + break; + + case 1: + [self _getMediaFromSource:UIImagePickerControllerSourceTypePhotoLibrary]; + break; + + default: + break; + } +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } +#pragma mark - ImagePickerControllerDelegate +-(void) imagePickerControllerDidCancel:(UIImagePickerController *)picker{ + [picker dismissViewControllerAnimated:YES completion:^(void){ + }]; +} +-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ + UIImage *originalImage = [info objectForKey:UIImagePickerControllerOriginalImage]; + [picker dismissViewControllerAnimated:YES completion:^{ + NSData *data = UIImagePNGRepresentation(originalImage); + self.imageData=data; + [mTableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationNone]; + [[NSUserDefaults standardUserDefaults]setObject:data forKey:@"com.zhangcheng.userImage"]; + [[NSUserDefaults standardUserDefaults]synchronize]; + }]; +} /* #pragma mark - Navigation diff --git a/newsPicks/controller_iphone/NPUserDetailViewController.m b/newsPicks/controller_iphone/NPUserDetailViewController.m index 8c1fdf2..bbc3d71 100644 --- a/newsPicks/controller_iphone/NPUserDetailViewController.m +++ b/newsPicks/controller_iphone/NPUserDetailViewController.m @@ -24,13 +24,14 @@ @interface NPUserDetailViewController () +#import "NPUserDetaiInfolModel.h" +#import "NPUserInfoModel.h" @class NPlistPopularUsers; -@class NPUserDetaiInfolModel; +//@class NPUserDetaiInfolModel; @interface NPHTTPRequest : NSObject + (void)getTimeOnLineData:(NSString *)cid page:(int)page usingSuccessBlock:(void (^)(BOOL isSuccess,NSArray *result))successBlock; + (void)getTopData:(int)page usingSuccessBlock:(void (^)(BOOL isSuccess,NSArray *result,NPlistPopularUsers *popularUser))successBlock; @@ -21,5 +23,13 @@ + (void)getLoginUser:(NSString *)uname type:(NSString *)type usingSuccessBlock:(void (^)(BOOL isSuccess,NSDictionary *result))successBlock; +(void)sendAddThread:(NSString *)uid title:(NSString*)title type:(NSString *)type content:(NSString*)content link:(NSString*)url usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock; +(void)getFollowThread:(NSString *)uid thread:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock; ++(void)getLikeThread:(NSString *)uid thread:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock; ++ (void)getRecommandUser:(NSString *)uid page:(int)page usingSuccessBlock:(void (^)(BOOL isSuccess,NSArray *result))successBlock; ++(void)sendProfile:(NSString*)username family:(NSString*)family given:(NSString*)given company:(NSString*)company position:(NSString*)position description:(NSString*)description userimage:(NSString*)userimage usingSuccessBlock:(void (^)(BOOL isSuccess,NSDictionary *dic))successBlock; ++ (void)getUserInfo:(NSString *)uid successBlock:(void (^)(BOOL isSuccess,NPUserInfoModel *result))successBlock; ++(void)getRelation:(NSString *)uid targetUser:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock; ++ (void)getRecommandThreadSuccessBlock:(void (^)(BOOL isSuccess, NSArray *array))successBlock; ++(void)getUnfollowUser:(NSString *)uid targetUser:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock; ++(void)getFollowUser:(NSString *)uid targetUser:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock; @end diff --git a/newsPicks/http/NPHTTPRequest.m b/newsPicks/http/NPHTTPRequest.m index 3a6895e..8916d2c 100644 --- a/newsPicks/http/NPHTTPRequest.m +++ b/newsPicks/http/NPHTTPRequest.m @@ -13,6 +13,8 @@ #import "NPlistReplyModel.h" #import "NPUserDetaiInfolModel.h" #import "SVProgressHUD.h" +#import "NPUserInfoModel.h" +#import "NPRecommandThreadModel.h" @implementation NPHTTPRequest //post上传 @@ -331,8 +333,8 @@ + (void)getUserInfo:(NSString *)uid usingSuccessBlock:(void (^)(BOOL isSuccess,N NSLog(@"%@",stringUrl); [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { if (1 == [resultDictionary [@"status"] integerValue]) { - NPUserDetaiInfolModel *model=[[NPUserDetaiInfolModel alloc]initWithDataDic:resultDictionary[@"data"]]; - + NPUserDetaiInfolModel *model=[[NPUserDetaiInfolModel alloc]initWithDataDic:((NSArray*)resultDictionary[@"data"]).lastObject]; +// NSLog(@"%@",((NSArray*)resultDictionary[@"data"]).lastObject); successBlock(YES,model); }else{ successBlock(NO,nil); @@ -390,7 +392,32 @@ + (void)getUserInfoFollowing:(BOOL)isFollowing uid:(NSString *)uid page:(int)pag }]; } - ++ (void)getRecommandUser:(NSString *)uid page:(int)page usingSuccessBlock:(void (^)(BOOL isSuccess,NSArray *result))successBlock +{ + NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/0/%@/%d",BaseUrl,GetRecommandUser,uid,ItemNumPerPage,page]; + // NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/%d",BaseUrl,GetRecommandUser,ItemNumPerPage,page]; + NSLog(@"%@",stringUrl); + [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { + if (1 == [resultDictionary [@"status"] integerValue]) { + NSMutableArray *list=[NSMutableArray array]; + for (NSDictionary *dic in resultDictionary[@"data"]) { + NPUserDetaiInfolModel *model=[[NPUserDetaiInfolModel alloc]initWithDataDic:dic]; + + [list addObject:model]; + } + successBlock(YES,list); + }else{ + + [SVProgressHUD showErrorWithStatus:resultDictionary[@"message"]]; + + successBlock(NO,nil); + } + + } andFailureBlock:^(NSError *resultError) { + successBlock(NO,nil); + }]; + +} +(void)getLoginUser:(NSString *)uname type:(NSString *)type usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock{ NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/%@",BaseUrl,LoginStingUrl,uname,type]; @@ -425,25 +452,57 @@ +(void)getFollowThread:(NSString *)uid thread:(NSString *)tid usingSuccessBlock: } ++(void)getLikeThread:(NSString *)uid thread:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock{ + NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/%@",BaseUrl,LikeThread,uid,tid]; + NSLog(@"%@",stringUrl); + [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { + if (1 == [resultDictionary [@"status"] integerValue]) { + + successBlock(YES,resultDictionary); + }else{ + successBlock(NO,resultDictionary); + } + + } andFailureBlock:^(NSError *resultError) { + successBlock(NO,nil); + }]; + +} - -+(void)sendAddThread:(NSString *)uid title:(NSString*)title type:(NSString *)type content:(NSString*)content link:(NSString*)url usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock{ - /* - NSString *stringUrl=@"http://203.195.175.230:8080/post/"; - NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:uid,@"userid",title,@"title",type,@"cateid",content,@"content",@"",@"threadimage",url,@"link", nil]; - [NPHTTPRequest postValue:stringUrl dic:dic fileDic:nil usingSuccessBlock:^(NSDictionary *resultDictionary) { ++(void)getFollowUser:(NSString *)uid targetUser:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock{ + NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/%@",BaseUrl,FollowUser,uid,tid]; + NSLog(@"%@",stringUrl); + [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { if (1 == [resultDictionary [@"status"] integerValue]) { successBlock(YES,resultDictionary); }else{ successBlock(NO,resultDictionary); } + } andFailureBlock:^(NSError *resultError) { successBlock(NO,nil); + }]; +} ++(void)getRelation:(NSString *)uid targetUser:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock{ + NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/%@",BaseUrl,GetRelation,uid,tid]; + NSLog(@"%@",stringUrl); + [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { + if (1 == [resultDictionary [@"status"] integerValue]) { + + successBlock(YES,[resultDictionary objectForKey:@"data"]); + }else{ + successBlock(NO,resultDictionary); + } + + } andFailureBlock:^(NSError *resultError) { + successBlock(NO,nil); }]; - */ - NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/%@/%@/%@/%@",BaseUrl,AddThread,uid,title,type,content,url]; +} + ++(void)getUnfollowUser:(NSString *)uid targetUser:(NSString *)tid usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock{ + NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@/%@",BaseUrl,UnfollowUser,uid,tid]; NSLog(@"%@",stringUrl); [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { if (1 == [resultDictionary [@"status"] integerValue]) { @@ -458,4 +517,155 @@ +(void)sendAddThread:(NSString *)uid title:(NSString*)title type:(NSString *)typ }]; } + + + ++(void)sendAddThread:(NSString *)uid title:(NSString*)title type:(NSString *)type content:(NSString*)content link:(NSString*)url usingSuccessBlock:(void (^)(BOOL, NSDictionary *))successBlock{ + + AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@""]];//这里要将url设置为空 + + httpClient.parameterEncoding = AFJSONParameterEncoding; + + [httpClient setDefaultHeader:@"Content-Type" value:@"application/json"]; + + + NSMutableDictionary *params=[[NSMutableDictionary alloc] init]; // 要传递的json数据是一个字典 + + [params setObject:uid forKey:@"userid"]; + + [params setObject:title forKey:@"title"]; + + [params setObject:type forKey:@"cateid"]; + [params setObject:content forKey:@"content"]; + [params setObject:[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] forKey:@"link"]; + + + + // httpClient 的postPath就是上文中的pathStr,即你要访问的URL地址,这里是向服务器提交一个数据请求, + + [httpClient postPath:POSTURL parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { + NSLog(@"data====%@",params); + NSString *responseStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; + NSLog(@"Request Successful, response '%@'", responseStr); + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableLeaves error:nil]; + successBlock(YES,dic); + + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + successBlock(NO,nil); + NSLog(@"[HTTPClient Error]: %@", error); + }]; + +} + ++(void)sendProfile:(NSString*)username family:(NSString*)family given:(NSString*)given company:(NSString*)company position:(NSString*)position description:(NSString*)description userimage:(NSString*)userimage usingSuccessBlock:(void (^)(BOOL isSuccess,NSDictionary *dic))successBlock +{ +// AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@""]];//这里要将url设置为空 +// httpClient.parameterEncoding = AFJSONParameterEncoding; +// [httpClient setDefaultHeader:@"Content-Type" value:@"application/json"]; +// NSMutableDictionary *params=[[NSMutableDictionary alloc] init]; // 要传递的json数据是一个字典 +// [params setObject:username forKey:@"loginname"]; +// [params setObject:@"facebook" forKey:@"type"]; +// [params setObject:given forKey:@"given"]; +// [params setObject:company forKey:@"company"]; +// [params setObject:position forKey:@"position"]; +// [params setObject:description forKey:@"description"]; +//// [params setObject:userimage forKey:@"userimage"]; +// +// [httpClient postPath:POSTURL parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { +// NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableLeaves error:nil]; +// successBlock(YES,dic); +// } failure:^(AFHTTPRequestOperation *operation, NSError *error) { +// successBlock(NO,nil); +// }]; + NSString *type = @"facebook"; + NSString *stringUrl = [NSString stringWithFormat:@"%@loginUser/%@/%@/%@/%@/%@/%@/%@/%@",BaseUrl,username,type,family,given,company,position,description,userimage]; + NSLog(@"%@",stringUrl); + [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { + if (1 == [resultDictionary [@"status"] integerValue]) { + successBlock(YES,[resultDictionary objectForKey:@"data"]); + }else + { + successBlock(NO,nil); + } + } andFailureBlock:^(NSError *resultError) { + successBlock(NO,nil); + }]; +} + ++ (void)getUserInfo:(NSString *)uid successBlock:(void (^)(BOOL isSuccess,NPUserInfoModel *result))successBlock +{ + NSString *stringUrl=[NSString stringWithFormat:@"%@%@/%@",BaseUrl,GetUserProfile,uid]; + NSLog(@"%@",stringUrl); + [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { + NSLog(@"-----%@",resultDictionary); + if (1 == [resultDictionary [@"status"] integerValue]) { + NSArray *array = [resultDictionary objectForKey:@"data"]; + if (array.count == 1) { + NSDictionary *dic = [array objectAtIndex:0]; + NPUserInfoModel *model = [[NPUserInfoModel alloc] init]; + model.uid = uid; + model.name = [dic objectForKey:@"loginname"]; + model.description = [dic objectForKey:@"description"]; + model.typeName = [dic objectForKeyedSubscript:@"type"]; + model.company =[dic objectForKey:@"company"]; + model.family=[dic objectForKey:@"family"]; + model.given = [dic objectForKey:@"given"]; + model.position = [dic objectForKey:@"position"]; + model.userimage = [dic objectForKey:@"userimage"]; + successBlock(YES,model); + } + + }else{ + successBlock(NO,nil); + } + + } andFailureBlock:^(NSError *resultError) { + successBlock(YES,nil); + }]; +} + ++ (void)getRecommandThreadSuccessBlock:(void (^)(BOOL isSuccess, NSArray *array))successBlock +{ + NSString *stringUrl=[NSString stringWithFormat:@"%@%@/99/1",BaseUrl,GetRecommandThread]; + [NPHTTPRequest getDictionaryWithStringURL:stringUrl usingSuccessBlock:^(NSDictionary *resultDictionary) { + if (1 == [resultDictionary [@"status"] integerValue]) { + NSArray *data = [resultDictionary objectForKey:@"data"]; + NSMutableArray *array = [NSMutableArray array]; + for (int i = 0; i + +@interface NPRecommandThreadModel : NSObject + +@property (retain, nonatomic) NSString *userimage; +@property (retain, nonatomic) NSString *position; +@property (retain, nonatomic) NSString *createdate; +@property (retain, nonatomic) NSString *link; +@property (retain, nonatomic) NSString *title; +@property (retain, nonatomic) NSString *threadid; +@property (retain, nonatomic) NSString *type; +@property (retain, nonatomic) NSString *description; +@property (retain, nonatomic) NSString *given; +@property (retain, nonatomic) NSString *score; +@property (retain, nonatomic) NSString *family; +@property (retain, nonatomic) NSString *company; +@property (retain, nonatomic) NSString *content; +@property (retain, nonatomic) NSString *loginname; +@property (retain, nonatomic) NSString *cateid; +@property (retain, nonatomic) NSString *threadimage; +@property (retain, nonatomic) NSString *userid; + + +@end diff --git a/newsPicks/model/NPRecommandThreadModel.m b/newsPicks/model/NPRecommandThreadModel.m new file mode 100644 index 0000000..5c639ef --- /dev/null +++ b/newsPicks/model/NPRecommandThreadModel.m @@ -0,0 +1,14 @@ +// +// NPRecommandThreadModel.m +// newsPicks +// +// Created by kangxv on 14-8-17. +// Copyright (c) 2014年 kangxv. All rights reserved. +// + +#import "NPRecommandThreadModel.h" + +@implementation NPRecommandThreadModel : NSObject + + +@end diff --git a/newsPicks/model/NPUserDetaiInfolModel.m b/newsPicks/model/NPUserDetaiInfolModel.m index 3a9303f..6a36b51 100644 --- a/newsPicks/model/NPUserDetaiInfolModel.m +++ b/newsPicks/model/NPUserDetaiInfolModel.m @@ -28,10 +28,10 @@ - (NSDictionary*)attributeMapDictionary ,@"loginname",@"name" ,@"type",@"typeName" ,@"description",@"description" - ,@"likeNum",@"likeNum" - ,@"followers_num",@"followers_num" - ,@"following_num",@"following_num" - ,@"is_following",@"is_following" + ,@"following",@"likeNum" + ,@"follower",@"followers_num" + ,@"following",@"following_num" + ,@"isfollower",@"is_following" ,@"userimage",@"avatar" ,@"isPremium",@"isPremium" ,nil]; diff --git a/newsPicks/model/NPUserInfoModel.h b/newsPicks/model/NPUserInfoModel.h new file mode 100644 index 0000000..2dc37cf --- /dev/null +++ b/newsPicks/model/NPUserInfoModel.h @@ -0,0 +1,26 @@ +// +// NPUserInfoModel.h +// newsPicks +// +// Created by kangxv on 14-8-16. +// Copyright (c) 2014年 kangxv. All rights reserved. +// + +#import + +@interface NPUserInfoModel : NSObject + +@property(nonatomic,retain)NSString *uid; +@property(nonatomic,retain)NSString *name; +@property(nonatomic,retain)NSString *typeName; +@property(nonatomic,retain)NSString *description; + +@property(nonatomic,retain)NSString *company; +@property(nonatomic,retain)NSString *family; +@property(nonatomic,retain)NSString *given; +@property(nonatomic,retain)NSString *position; +@property(nonatomic,retain)NSString *userimage; + + + +@end diff --git a/newsPicks/model/NPUserInfoModel.m b/newsPicks/model/NPUserInfoModel.m new file mode 100644 index 0000000..c253a3f --- /dev/null +++ b/newsPicks/model/NPUserInfoModel.m @@ -0,0 +1,13 @@ +// +// NPUserInfoModel.m +// newsPicks +// +// Created by kangxv on 14-8-16. +// Copyright (c) 2014年 kangxv. All rights reserved. +// + +#import "NPUserInfoModel.h" + +@implementation NPUserInfoModel + +@end diff --git a/newsPicks/newsPicks-Prefix.pch b/newsPicks/newsPicks-Prefix.pch index a325a86..d5b674e 100644 --- a/newsPicks/newsPicks-Prefix.pch +++ b/newsPicks/newsPicks-Prefix.pch @@ -26,13 +26,17 @@ #define LoginStingUrl @"loginUser" #define GetFeedStingUrl @"getFeed" #define GetRecommandThread @"getRecommandThread" +#define GetRecommandUser @"getRecommandUser" #define GetThreadInfo @"getThreadInfo" #define GetFollowing @"getFollowing" #define GetFollower @"getFollower" - +#define FollowUser @"followUser" +#define UnfollowUser @"unfollowUser" +#define GetRelation @"getRelation" #define GetUserProfile @"getUserProfile" #define GetRecommandUser @"getRecommandUser" #define AddThread @"addThread" #define FollowThread @"followThread" - +#define LikeThread @"likeThread" +#define POSTURL @"http://203.195.175.230:8080/post/" diff --git a/newsPicks/other/SVProgressHUD/.DS_Store b/newsPicks/other/SVProgressHUD/.DS_Store index d342e04..8774f23 100644 Binary files a/newsPicks/other/SVProgressHUD/.DS_Store and b/newsPicks/other/SVProgressHUD/.DS_Store differ diff --git a/newsPicks/view/NPMainleftView.m b/newsPicks/view/NPMainleftView.m index bc4d5aa..3c5b5dd 100644 --- a/newsPicks/view/NPMainleftView.m +++ b/newsPicks/view/NPMainleftView.m @@ -12,6 +12,7 @@ @implementation NPMainleftView @synthesize delegate=_delegate; +(NPMainleftView *)mainLeftView { + return [[NPMainleftView alloc]initWithFrame:CGRectMake(0, IOS7_OR_LATER?20:0, 40, 40*3)]; } - (id)initWithFrame:(CGRect)frame @@ -19,7 +20,7 @@ - (id)initWithFrame:(CGRect)frame self = [super initWithFrame:frame]; if (self) { [self restSubView]; - // Initialization code + } return self; } diff --git a/newsPicks/view/NPUserDetailView.m b/newsPicks/view/NPUserDetailView.m index e994c9d..07f0b4d 100644 --- a/newsPicks/view/NPUserDetailView.m +++ b/newsPicks/view/NPUserDetailView.m @@ -94,7 +94,7 @@ -(void)restValue:(NPUserDetaiInfolModel *)infoModel }else { - loackImageView.hidden=YES; +// loackImageView.hidden=YES; btnPremium.hidden=YES; likeLabel.hidden=NO; typeLabel.hidden=NO;