Commit 2041dd27 by lee

Merge branch 'master' of git.oschina.net:kollway-kollway/newcemarose

parents 60fa6510 52b1c54f
......@@ -33,5 +33,8 @@ pod 'MagicalRecord','~> 2.2'
pod 'Mobile-Buy-SDK',:git => 'https://github.com/houweibin/mobile-buy-sdk-ios'
#pod 'Mobile-Buy-SDK',:path => '../Pods/mobile-buy-sdk-ios'
pod 'JLRoutes'
pod 'iCarousel', '~> 1.8'
pod 'MagicalRecord','~> 2.2'
pod 'CHTCollectionViewWaterfallLayout', '~> 0.9.5'
end
......@@ -208,6 +208,27 @@
C03943C01DD1FCE900141475 /* KWMProductType.m in Sources */ = {isa = PBXBuildFile; fileRef = C03943BF1DD1FCE900141475 /* KWMProductType.m */; };
C03943C31DD1FD3F00141475 /* KWMProductTypeResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C03943C21DD1FD3F00141475 /* KWMProductTypeResult.m */; };
C03A05061E35DC5800BAA889 /* KWMNewGiftCardVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C03A05051E35DC5800BAA889 /* KWMNewGiftCardVC.m */; };
C043927A1F0F99310027ABA3 /* KWMHomeData.m in Sources */ = {isa = PBXBuildFile; fileRef = C04392791F0F99310027ABA3 /* KWMHomeData.m */; };
C043927D1F0F9A2A0027ABA3 /* KWMAdvertisement.m in Sources */ = {isa = PBXBuildFile; fileRef = C043927C1F0F9A2A0027ABA3 /* KWMAdvertisement.m */; };
C04392801F0F9A3D0027ABA3 /* KWMHotSales.m in Sources */ = {isa = PBXBuildFile; fileRef = C043927F1F0F9A3D0027ABA3 /* KWMHotSales.m */; };
C04834231F13215500A5BFB4 /* KWMBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = C04834221F13215500A5BFB4 /* KWMBannerView.m */; };
C048342B1F1324B400A5BFB4 /* KWMAdHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = C048342A1F1324B400A5BFB4 /* KWMAdHeader.m */; };
C048342E1F13254200A5BFB4 /* KWMMenuHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = C048342D1F13254200A5BFB4 /* KWMMenuHeader.m */; };
C04834341F1325A000A5BFB4 /* KWMClothingSetsHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = C04834331F1325A000A5BFB4 /* KWMClothingSetsHeader.m */; };
C04834371F1325CB00A5BFB4 /* KWMHotSalesHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = C04834361F1325CB00A5BFB4 /* KWMHotSalesHeader.m */; };
C048343B1F13274300A5BFB4 /* KWMNewHomeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C04834391F13274300A5BFB4 /* KWMNewHomeVC.m */; };
C048343C1F13274300A5BFB4 /* KWMNewHomeVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = C048343A1F13274300A5BFB4 /* KWMNewHomeVC.xib */; };
C048343E1F13288F00A5BFB4 /* KWMMenuHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = C048343D1F13288F00A5BFB4 /* KWMMenuHeader.xib */; };
C04834411F13350F00A5BFB4 /* KWMRecommendHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = C04834401F13350F00A5BFB4 /* KWMRecommendHeader.m */; };
C04834451F1337A800A5BFB4 /* KWMNewHomeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C04834431F1337A800A5BFB4 /* KWMNewHomeCell.m */; };
C04834461F1337A800A5BFB4 /* KWMNewHomeCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C04834441F1337A800A5BFB4 /* KWMNewHomeCell.xib */; };
C04834481F1338F200A5BFB4 /* KWMRecommendHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = C04834471F1338F200A5BFB4 /* KWMRecommendHeader.xib */; };
C048344A1F13391A00A5BFB4 /* KWMClothingSetsHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = C04834491F13391A00A5BFB4 /* KWMClothingSetsHeader.xib */; };
C048344C1F13393D00A5BFB4 /* KWMHotSalesHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = C048344B1F13393D00A5BFB4 /* KWMHotSalesHeader.xib */; };
C04834531F13590500A5BFB4 /* KWMProductBannerItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = C048344E1F13590500A5BFB4 /* KWMProductBannerItemView.m */; };
C04834541F13590500A5BFB4 /* KWMProductBannerItemView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C048344F1F13590500A5BFB4 /* KWMProductBannerItemView.xib */; };
C04834551F13590500A5BFB4 /* KWMClothingSetsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C04834511F13590500A5BFB4 /* KWMClothingSetsCell.m */; };
C04834561F13590500A5BFB4 /* KWMClothingSetsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C04834521F13590500A5BFB4 /* KWMClothingSetsCell.xib */; };
C048B8E21EF3C04B000DA7AF /* KWMBeforePayData.m in Sources */ = {isa = PBXBuildFile; fileRef = C048B8E11EF3C04B000DA7AF /* KWMBeforePayData.m */; };
C048B8E51EF3F20B000DA7AF /* KWMCollectionRefreshUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C048B8E41EF3F20B000DA7AF /* KWMCollectionRefreshUtil.m */; };
C05910941E34A729002990B3 /* KWMNewGiftCardCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C05910921E34A729002990B3 /* KWMNewGiftCardCell.m */; };
......@@ -709,6 +730,40 @@
C03943C21DD1FD3F00141475 /* KWMProductTypeResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMProductTypeResult.m; sourceTree = "<group>"; };
C03A05041E35DC5800BAA889 /* KWMNewGiftCardVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMNewGiftCardVC.h; sourceTree = "<group>"; };
C03A05051E35DC5800BAA889 /* KWMNewGiftCardVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMNewGiftCardVC.m; sourceTree = "<group>"; };
C04392781F0F99310027ABA3 /* KWMHomeData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMHomeData.h; sourceTree = "<group>"; };
C04392791F0F99310027ABA3 /* KWMHomeData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMHomeData.m; sourceTree = "<group>"; };
C043927B1F0F9A2A0027ABA3 /* KWMAdvertisement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMAdvertisement.h; sourceTree = "<group>"; };
C043927C1F0F9A2A0027ABA3 /* KWMAdvertisement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMAdvertisement.m; sourceTree = "<group>"; };
C043927E1F0F9A3D0027ABA3 /* KWMHotSales.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMHotSales.h; sourceTree = "<group>"; };
C043927F1F0F9A3D0027ABA3 /* KWMHotSales.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMHotSales.m; sourceTree = "<group>"; };
C04834211F13215500A5BFB4 /* KWMBannerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMBannerView.h; sourceTree = "<group>"; };
C04834221F13215500A5BFB4 /* KWMBannerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMBannerView.m; sourceTree = "<group>"; };
C04834291F1324B400A5BFB4 /* KWMAdHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMAdHeader.h; sourceTree = "<group>"; };
C048342A1F1324B400A5BFB4 /* KWMAdHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMAdHeader.m; sourceTree = "<group>"; };
C048342C1F13254200A5BFB4 /* KWMMenuHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMMenuHeader.h; sourceTree = "<group>"; };
C048342D1F13254200A5BFB4 /* KWMMenuHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMMenuHeader.m; sourceTree = "<group>"; };
C04834321F1325A000A5BFB4 /* KWMClothingSetsHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMClothingSetsHeader.h; sourceTree = "<group>"; };
C04834331F1325A000A5BFB4 /* KWMClothingSetsHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMClothingSetsHeader.m; sourceTree = "<group>"; };
C04834351F1325CB00A5BFB4 /* KWMHotSalesHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMHotSalesHeader.h; sourceTree = "<group>"; };
C04834361F1325CB00A5BFB4 /* KWMHotSalesHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMHotSalesHeader.m; sourceTree = "<group>"; };
C04834381F13274300A5BFB4 /* KWMNewHomeVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMNewHomeVC.h; sourceTree = "<group>"; };
C04834391F13274300A5BFB4 /* KWMNewHomeVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMNewHomeVC.m; sourceTree = "<group>"; };
C048343A1F13274300A5BFB4 /* KWMNewHomeVC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMNewHomeVC.xib; sourceTree = "<group>"; };
C048343D1F13288F00A5BFB4 /* KWMMenuHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMMenuHeader.xib; sourceTree = "<group>"; };
C048343F1F13350F00A5BFB4 /* KWMRecommendHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMRecommendHeader.h; sourceTree = "<group>"; };
C04834401F13350F00A5BFB4 /* KWMRecommendHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMRecommendHeader.m; sourceTree = "<group>"; };
C04834421F1337A800A5BFB4 /* KWMNewHomeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMNewHomeCell.h; sourceTree = "<group>"; };
C04834431F1337A800A5BFB4 /* KWMNewHomeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMNewHomeCell.m; sourceTree = "<group>"; };
C04834441F1337A800A5BFB4 /* KWMNewHomeCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMNewHomeCell.xib; sourceTree = "<group>"; };
C04834471F1338F200A5BFB4 /* KWMRecommendHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMRecommendHeader.xib; sourceTree = "<group>"; };
C04834491F13391A00A5BFB4 /* KWMClothingSetsHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMClothingSetsHeader.xib; sourceTree = "<group>"; };
C048344B1F13393D00A5BFB4 /* KWMHotSalesHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMHotSalesHeader.xib; sourceTree = "<group>"; };
C048344D1F13590500A5BFB4 /* KWMProductBannerItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMProductBannerItemView.h; sourceTree = "<group>"; };
C048344E1F13590500A5BFB4 /* KWMProductBannerItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMProductBannerItemView.m; sourceTree = "<group>"; };
C048344F1F13590500A5BFB4 /* KWMProductBannerItemView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMProductBannerItemView.xib; sourceTree = "<group>"; };
C04834501F13590500A5BFB4 /* KWMClothingSetsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMClothingSetsCell.h; sourceTree = "<group>"; };
C04834511F13590500A5BFB4 /* KWMClothingSetsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMClothingSetsCell.m; sourceTree = "<group>"; };
C04834521F13590500A5BFB4 /* KWMClothingSetsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMClothingSetsCell.xib; sourceTree = "<group>"; };
C048B8E01EF3C04B000DA7AF /* KWMBeforePayData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMBeforePayData.h; sourceTree = "<group>"; };
C048B8E11EF3C04B000DA7AF /* KWMBeforePayData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMBeforePayData.m; sourceTree = "<group>"; };
C048B8E31EF3F20B000DA7AF /* KWMCollectionRefreshUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCollectionRefreshUtil.h; sourceTree = "<group>"; };
......@@ -1320,6 +1375,12 @@
C08870EA1F03481C00C9C1C8 /* KWMCustomsClearance.m */,
C0028EC61F0DE80500744C14 /* KWMWish.h */,
C0028EC71F0DE80500744C14 /* KWMWish.m */,
C04392781F0F99310027ABA3 /* KWMHomeData.h */,
C04392791F0F99310027ABA3 /* KWMHomeData.m */,
C043927B1F0F9A2A0027ABA3 /* KWMAdvertisement.h */,
C043927C1F0F9A2A0027ABA3 /* KWMAdvertisement.m */,
C043927E1F0F9A3D0027ABA3 /* KWMHotSales.h */,
C043927F1F0F9A3D0027ABA3 /* KWMHotSales.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -1327,6 +1388,7 @@
C034E6C31D6AECF9006EE129 /* UI */ = {
isa = PBXGroup;
children = (
C04834241F13219A00A5BFB4 /* NewHome */,
C0A6B3A81F01FC5300D85673 /* NewProduct */,
C0243BAE1EFBD5A10013CFA7 /* Category */,
C0F586411E24F820001248E2 /* Product */,
......@@ -1389,6 +1451,8 @@
C034E8381D6B10A0006EE129 /* EGO */,
C0AF03981DD5BFB20060623F /* UIViewController+BackButtonHandler.h */,
C0AF03991DD5BFB20060623F /* UIViewController+BackButtonHandler.m */,
C04834211F13215500A5BFB4 /* KWMBannerView.h */,
C04834221F13215500A5BFB4 /* KWMBannerView.m */,
C034E6F21D6AF197006EE129 /* KWMPickView.h */,
C034E6F31D6AF197006EE129 /* KWMPickView.m */,
C034E6F41D6AF197006EE129 /* KWMPickView.xib */,
......@@ -1846,6 +1910,47 @@
path = Cemarose;
sourceTree = "<group>";
};
C04834241F13219A00A5BFB4 /* NewHome */ = {
isa = PBXGroup;
children = (
C04834251F13242600A5BFB4 /* Cell */,
C04834381F13274300A5BFB4 /* KWMNewHomeVC.h */,
C04834391F13274300A5BFB4 /* KWMNewHomeVC.m */,
C048343A1F13274300A5BFB4 /* KWMNewHomeVC.xib */,
);
path = NewHome;
sourceTree = "<group>";
};
C04834251F13242600A5BFB4 /* Cell */ = {
isa = PBXGroup;
children = (
C04834291F1324B400A5BFB4 /* KWMAdHeader.h */,
C048342A1F1324B400A5BFB4 /* KWMAdHeader.m */,
C048343D1F13288F00A5BFB4 /* KWMMenuHeader.xib */,
C048342C1F13254200A5BFB4 /* KWMMenuHeader.h */,
C048342D1F13254200A5BFB4 /* KWMMenuHeader.m */,
C04834471F1338F200A5BFB4 /* KWMRecommendHeader.xib */,
C048343F1F13350F00A5BFB4 /* KWMRecommendHeader.h */,
C04834401F13350F00A5BFB4 /* KWMRecommendHeader.m */,
C04834491F13391A00A5BFB4 /* KWMClothingSetsHeader.xib */,
C04834321F1325A000A5BFB4 /* KWMClothingSetsHeader.h */,
C04834331F1325A000A5BFB4 /* KWMClothingSetsHeader.m */,
C048344B1F13393D00A5BFB4 /* KWMHotSalesHeader.xib */,
C04834351F1325CB00A5BFB4 /* KWMHotSalesHeader.h */,
C04834361F1325CB00A5BFB4 /* KWMHotSalesHeader.m */,
C048344F1F13590500A5BFB4 /* KWMProductBannerItemView.xib */,
C048344D1F13590500A5BFB4 /* KWMProductBannerItemView.h */,
C048344E1F13590500A5BFB4 /* KWMProductBannerItemView.m */,
C04834521F13590500A5BFB4 /* KWMClothingSetsCell.xib */,
C04834501F13590500A5BFB4 /* KWMClothingSetsCell.h */,
C04834511F13590500A5BFB4 /* KWMClothingSetsCell.m */,
C04834441F1337A800A5BFB4 /* KWMNewHomeCell.xib */,
C04834421F1337A800A5BFB4 /* KWMNewHomeCell.h */,
C04834431F1337A800A5BFB4 /* KWMNewHomeCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
C06665021D75A2E500F02EF4 /* Cell */ = {
isa = PBXGroup;
children = (
......@@ -2235,11 +2340,13 @@
C034E8591D6B10A0006EE129 /* SVProgressHUD.bundle in Resources */,
C0243BC11EFBD5A10013CFA7 /* KWMRightProductCell.xib in Resources */,
801230F31DD30704008C7904 /* KWMSearchBrandsCell.xib in Resources */,
C048344A1F13391A00A5BFB4 /* KWMClothingSetsHeader.xib in Resources */,
C03120A71EF29B2900E49EFA /* 更新日志.txt in Resources */,
C084F4591D6D976F00A0625D /* KWMSearchBar.xib in Resources */,
C0DD53381EE55190002D1E0C /* KWMLoadingView.xib in Resources */,
C0F586811E24F820001248E2 /* KWMNewTypeView.xib in Resources */,
C0AF039F1DD5C8EE0060623F /* KWMNeedAddressView.xib in Resources */,
C048343C1F13274300A5BFB4 /* KWMNewHomeVC.xib in Resources */,
C084F4541D6D8CA700A0625D /* KWMBlogCell.xib in Resources */,
C05910951E34A729002990B3 /* KWMNewGiftCardCell.xib in Resources */,
C0CC14091D7823B0007B5986 /* KWMSizeCell.xib in Resources */,
......@@ -2254,11 +2361,13 @@
C0F5869D1E25D3B6001248E2 /* KWMProductDetailView.xib in Resources */,
C034E69D1D6AEB12006EE129 /* LaunchScreen.storyboard in Resources */,
C0A6B3C11F01FC5300D85673 /* KWMProductColorCell.xib in Resources */,
C048344C1F13393D00A5BFB4 /* KWMHotSalesHeader.xib in Resources */,
80E844291D7FB1130042AED2 /* KWMRuleView.xib in Resources */,
C034E6F61D6AF197006EE129 /* KWMPickView.xib in Resources */,
C0F586771E24F820001248E2 /* KWMCollectionCell.xib in Resources */,
C0243BBD1EFBD5A10013CFA7 /* Category.storyboard in Resources */,
C0F586791E24F820001248E2 /* KWMDetailCell.xib in Resources */,
C04834481F1338F200A5BFB4 /* KWMRecommendHeader.xib in Resources */,
C0F5867F1E24F820001248E2 /* KWMNewGoodsCell.xib in Resources */,
C0DD53101EE54A9E002D1E0C /* KWMBarandSelectView.xib in Resources */,
C066650C1D75A2E500F02EF4 /* Mine.storyboard in Resources */,
......@@ -2276,6 +2385,7 @@
C0CCB3D41EEA765B00BC2FB8 /* KWMNormalFilterView.xib in Resources */,
C066650A1D75A2E500F02EF4 /* KWMOrderCell.xib in Resources */,
8091DFB81D6EC1C60020519C /* KWMThreeView.xib in Resources */,
C048343E1F13288F00A5BFB4 /* KWMMenuHeader.xib in Resources */,
8091DFB01D6EAD6F0020519C /* KWMSecondView.xib in Resources */,
8091DFA61D6EA0840020519C /* KWMLastView.xib in Resources */,
C03120A51EF29B2900E49EFA /* AlipaySDK.bundle in Resources */,
......@@ -2284,6 +2394,7 @@
C0DD53151EE54B96002D1E0C /* KWMSearchBrandView.xib in Resources */,
80C801511D78136400002306 /* KWMTBVSectionHeardView.xib in Resources */,
80F82E621D704E34008B470B /* KWMBrandCell.xib in Resources */,
C04834541F13590500A5BFB4 /* KWMProductBannerItemView.xib in Resources */,
C0A6B3CA1F01FC5300D85673 /* NewProduct.storyboard in Resources */,
C0A6B3BF1F01FC5300D85673 /* KWMFirstDetailView.xib in Resources */,
801230F81DD32B49008C7904 /* KWMInformationView.xib in Resources */,
......@@ -2291,6 +2402,7 @@
C034E8691D6B10A0006EE129 /* PhotoBroswerVC.xib in Resources */,
C0CC14051D7823B0007B5986 /* KWMDeleteView.xib in Resources */,
C034E6981D6AEB12006EE129 /* Main.storyboard in Resources */,
C04834461F1337A800A5BFB4 /* KWMNewHomeCell.xib in Resources */,
C0CC14071D7823B0007B5986 /* KWMShopCarCell.xib in Resources */,
C0CCB3BA1EEA579900BC2FB8 /* KWMFilterView.xib in Resources */,
C0CCB3C21EEA59A200BC2FB8 /* KWMFilterViewCell.xib in Resources */,
......@@ -2299,6 +2411,7 @@
804771821D6D32A70086B4DC /* Login.storyboard in Resources */,
C0DD53241EE55062002D1E0C /* KWMCarCountView.xib in Resources */,
C0A6B3C51F01FC5300D85673 /* KWMSecondDetailView.xib in Resources */,
C04834561F13590500A5BFB4 /* KWMClothingSetsCell.xib in Resources */,
C0F5868B1E24F820001248E2 /* New.storyboard in Resources */,
C02C7DA81E66B2AE008DC29C /* KWMFilterCell.xib in Resources */,
);
......@@ -2374,6 +2487,7 @@
buildActionMask = 2147483647;
files = (
C084F4531D6D8CA700A0625D /* KWMBlogCell.m in Sources */,
C04834451F1337A800A5BFB4 /* KWMNewHomeCell.m in Sources */,
C0DD53361EE55190002D1E0C /* KWMLoadingHeader.m in Sources */,
807AF4A21DC984950000A326 /* KWMArticlesResult.m in Sources */,
C048B8E51EF3F20B000DA7AF /* KWMCollectionRefreshUtil.m in Sources */,
......@@ -2381,9 +2495,11 @@
8019E9541DC89CF300CAD7BF /* KWMNewGoodsModel.m in Sources */,
C034E7B01D6AFBDA006EE129 /* KWMWebViewVC.m in Sources */,
C034E84C1D6B10A0006EE129 /* UIImage+Extend.m in Sources */,
C04834531F13590500A5BFB4 /* KWMProductBannerItemView.m in Sources */,
C0CC141A1D79847A007B5986 /* KWMSelectAddressVC.m in Sources */,
C034E7001D6AF205006EE129 /* KWMButton.m in Sources */,
C0A6B3C91F01FC5300D85673 /* KWMVariantsVC.m in Sources */,
C04392801F0F9A3D0027ABA3 /* KWMHotSales.m in Sources */,
C0F5867A1E24F820001248E2 /* KWMDoubleTitleView.m in Sources */,
C0A6B3C01F01FC5300D85673 /* KWMProductColorCell.m in Sources */,
8091DFBB1D6EC1DD0020519C /* KWMThreeView.m in Sources */,
......@@ -2395,6 +2511,7 @@
C0A6B3BE1F01FC5300D85673 /* KWMFirstDetailView.m in Sources */,
C048B8E21EF3C04B000DA7AF /* KWMBeforePayData.m in Sources */,
C03846941DB89EEB008C3BAB /* KWMCemaroseResult.m in Sources */,
C04834411F13350F00A5BFB4 /* KWMRecommendHeader.m in Sources */,
C0F586951E25C17A001248E2 /* KWMProductDetailVC.m in Sources */,
C0F586871E24F820001248E2 /* KWMNewTypeSelectedVC.m in Sources */,
C0A6B3C61F01FC5300D85673 /* KWMThirdDetailView.m in Sources */,
......@@ -2402,9 +2519,11 @@
C034E7B91D6B0A8D006EE129 /* KWMHomeVC.m in Sources */,
C0CCB3BD1EEA589200BC2FB8 /* KWMFilter.m in Sources */,
C0F5868F1E24F821001248E2 /* SVerticalView.m in Sources */,
C048343B1F13274300A5BFB4 /* KWMNewHomeVC.m in Sources */,
801F87BC1DD1A9B90038FA4C /* KWMNewProducts.m in Sources */,
C0CC14061D7823B0007B5986 /* KWMShopCarCell.m in Sources */,
C0243BC81EFBD6060013CFA7 /* KWMCategoryFilterTab.m in Sources */,
C04834371F1325CB00A5BFB4 /* KWMHotSalesHeader.m in Sources */,
9B8298E31EF22BE200743438 /* KWMCurrencyUtil.m in Sources */,
C034E6951D6AEB12006EE129 /* ViewController.m in Sources */,
C0DD53231EE55062002D1E0C /* KWMCarCountView.m in Sources */,
......@@ -2416,7 +2535,9 @@
C08FDA2A1D9B583400EBDB0D /* KWMGiftCardVC.m in Sources */,
804771801D6D326D0086B4DC /* KWMLoginVC.m in Sources */,
C034E83F1D6B10A0006EE129 /* CoreArchive.m in Sources */,
C043927A1F0F99310027ABA3 /* KWMHomeData.m in Sources */,
C034E8611D6B10A0006EE129 /* PBBlurImageView.m in Sources */,
C043927D1F0F9A2A0027ABA3 /* KWMAdvertisement.m in Sources */,
C034E6DE1D6AEF53006EE129 /* KWMAPIManager.m in Sources */,
C034E8541D6B10A0006EE129 /* UIButton+SD.m in Sources */,
C0F5868C1E24F821001248E2 /* ATPagingView.m in Sources */,
......@@ -2440,6 +2561,7 @@
C0F5867E1E24F820001248E2 /* KWMNewGoodsCell.m in Sources */,
C032D3071DD87E5F008D3155 /* KWMImage.m in Sources */,
9BE61CFE1ECD66BC0031D21E /* KWMShoppingCart.m in Sources */,
C04834341F1325A000A5BFB4 /* KWMClothingSetsHeader.m in Sources */,
C0F586761E24F820001248E2 /* KWMCollectionCell.m in Sources */,
C034E8421D6B10A0006EE129 /* NSArray+Extend.m in Sources */,
C034E85B1D6B10A0006EE129 /* LFRoundProgressView.m in Sources */,
......@@ -2521,6 +2643,7 @@
8091DFA11D6E878C0020519C /* KWMGuideVC.m in Sources */,
C034E84A1D6B10A0006EE129 /* UIImage+Color.m in Sources */,
801230F21DD30704008C7904 /* KWMSearchBrandsCell.m in Sources */,
C048342E1F13254200A5BFB4 /* KWMMenuHeader.m in Sources */,
C0DD531E1EE54F5D002D1E0C /* KWMMineTitleView.m in Sources */,
805C04351DD1FA4900ACC071 /* KWMBrandsTypeModel.m in Sources */,
C08827A61E28B4AF006A8B91 /* KWMPageControl.m in Sources */,
......@@ -2540,6 +2663,7 @@
C034E85A1D6B10A0006EE129 /* SVProgressHUD.m in Sources */,
C0243BBE1EFBD5A10013CFA7 /* KWMLeftCategoryCell.m in Sources */,
807AF4A81DC984950000A326 /* KWMSearchResult.m in Sources */,
C04834231F13215500A5BFB4 /* KWMBannerView.m in Sources */,
C0243BC41EFBD5A10013CFA7 /* KWMProductFilterVC.m in Sources */,
C0DD533B1EE55190002D1E0C /* KWMSuperLoadingView.m in Sources */,
C034E85D1D6B10A0006EE129 /* PBConst.m in Sources */,
......@@ -2558,6 +2682,7 @@
C034E7041D6AF205006EE129 /* RTSpinKitView.m in Sources */,
C0CCB3B91EEA579900BC2FB8 /* KWMFilterView.m in Sources */,
C05910941E34A729002990B3 /* KWMNewGiftCardCell.m in Sources */,
C04834551F13590500A5BFB4 /* KWMClothingSetsCell.m in Sources */,
C0243BC31EFBD5A10013CFA7 /* KWMCategoryVC.m in Sources */,
C034E8411D6B10A0006EE129 /* CALayer+Transition.m in Sources */,
C077966F1EEAA2BE00CD6859 /* KWMFilterUtil.m in Sources */,
......@@ -2572,6 +2697,7 @@
C034E7031D6AF205006EE129 /* KWMLineView.m in Sources */,
C0243BC21EFBD5A10013CFA7 /* KWMBrandFilterVC.m in Sources */,
807AF4A41DC984950000A326 /* KWMBrandsResult.m in Sources */,
C048342B1F1324B400A5BFB4 /* KWMAdHeader.m in Sources */,
C034E8471D6B10A0006EE129 /* UIColor+Extend.m in Sources */,
C0DD53351EE55190002D1E0C /* ArcToCircleLayer.m in Sources */,
C091EE361DDEEA9400A382B9 /* KWMVariants.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_home_about_shipping@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_home_about_shipping@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_home_favorite_product@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_home_favorite_product@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_home_hot_product@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_home_hot_product@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_home_new_product@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_home_new_product@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "test_banner_1@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "test_banner_1@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "test_banner_2@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "test_banner_2@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "test_suit@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "test_suit@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -724,7 +724,7 @@
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="NBO-61-l1q" kind="relationship" relationship="rootViewController" id="0Rm-QP-yVX"/>
<segue destination="NBO-61-l1q" kind="relationship" relationship="rootViewController" id="vPW-jg-RE6"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7Z2-Md-Vzb" userLabel="First Responder" sceneMemberID="firstResponder"/>
......@@ -1193,6 +1193,60 @@
</objects>
<point key="canvasLocation" x="361" y="2035"/>
</scene>
<!--新首页-->
<scene sceneID="6mO-YL-KC8">
<objects>
<viewController storyboardIdentifier="KWMNewHomeVC" useStoryboardIdentifierAsRestorationIdentifier="YES" id="kxV-Ho-iPP" userLabel="新首页" customClass="KWMNewHomeVC" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Iv3-Qt-qCa"/>
<viewControllerLayoutGuide type="bottom" id="7nS-iD-8eZ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="fiQ-A6-I4g">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="T1z-z9-rlz">
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="BcI-5v-hSE">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="XBe-Y7-KXB">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</collectionViewCell>
</cells>
<connections>
<outlet property="dataSource" destination="kxV-Ho-iPP" id="P4G-75-qA8"/>
<outlet property="delegate" destination="kxV-Ho-iPP" id="5qe-Uz-vxL"/>
</connections>
</collectionView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="T1z-z9-rlz" secondAttribute="trailing" id="0wc-Yi-qru"/>
<constraint firstItem="7nS-iD-8eZ" firstAttribute="top" secondItem="T1z-z9-rlz" secondAttribute="bottom" id="e8Y-7q-Dxx"/>
<constraint firstItem="T1z-z9-rlz" firstAttribute="leading" secondItem="fiQ-A6-I4g" secondAttribute="leading" id="u26-Oo-qx3"/>
<constraint firstItem="T1z-z9-rlz" firstAttribute="top" secondItem="Iv3-Qt-qCa" secondAttribute="bottom" constant="24" id="w7n-oP-oiG"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="xTg-gj-jEd"/>
<connections>
<outlet property="cvHome" destination="T1z-z9-rlz" id="HYR-6b-gcC"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="FmK-HG-RdK" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1169" y="1380"/>
</scene>
</scenes>
<resources>
<image name="button_mine_log out" width="19" height="20"/>
......
//
// KWMAdvertisement.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/7.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
@interface KWMAdvertisement : KWMBaseModel
//标题
@property (nonatomic) NSString *title;
//图片地址
@property (nonatomic) NSString *image;
//链接
@property (nonatomic) NSString *url;
@end
//
// KWMAdvertisement.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/7.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMAdvertisement.h"
@implementation KWMAdvertisement
@end
//
// KWMHomeData.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/7.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
#import "KWMAdvertisement.h"
#import "KWMHotSales.h"
@interface KWMHomeData : KWMBaseModel
@property (nonatomic) NSArray *adBanner;
@property (nonatomic) KWMAdvertisement *clothingSets;
@property (nonatomic) KWMHotSales *hotSales;
@end
//
// KWMHomeData.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/7.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMHomeData.h"
@implementation KWMHomeData
@end
//
// KWMHotSales.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/7.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
@interface KWMHotSales : KWMBaseModel
//大图商品数量
@property (nonatomic) NSNumber *singleShowCount;
@end
//
// KWMHotSales.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/7.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMHotSales.h"
@implementation KWMHotSales
@end
......@@ -71,7 +71,7 @@
[self initTbvLeft];
[self initCvRight];
self.sort = BUYCollectionSortCreatedAscending;
self.sort = BUYCollectionSortCreatedDescending;
self.selectBrands = @"";
}
......@@ -215,20 +215,18 @@
[tags addObject:self.selectBrands];
}
[self.client getProductsPage:page inCollection:@(171596038) withTags:tags sortOrder:self.sort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[self.client getProductsPage:page inCollection:@(Collection_All_ID) withTags:tags sortOrder:self.sort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[weakSelf.refreshUtil hideLoading];
weakSelf.filterTab.userInteractionEnabled = true;
if(error){
[weakSelf showError:error];
}
else{
weakSelf.refreshUtil.page = page;
weakSelf.refreshUtil.hasNextPage = !reachedEnd;
[weakSelf.refreshUtil appendDataList:products];
}
}];
}
......
......@@ -35,13 +35,13 @@
-(NSInteger)getSelectSortPosition:(BUYCollectionSort)sort{
switch (sort) {
case BUYCollectionSortCreatedAscending:
return 0;
case BUYCollectionSortCreatedDescending:
return 0;
case BUYCollectionSortCreatedAscending:
return 1;
case BUYCollectionSortPriceAscending:
return 2;
case BUYCollectionSortPriceDescending:
return 2;
case BUYCollectionSortPriceAscending:
return 3;
default:
return 0;
......@@ -68,7 +68,7 @@
return self.filterView.selectedTags;
}
-(void)kwm_onClickFilter:(KWMFilterView *)filterView{
-(void)kwm_onFilterFinish:(KWMFilterView *)filterView{
if(self.delegate){
[self.delegate kwm_onCompleProductFilter:filterView];
}
......
//
// KWMAdHeader.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
#import "KWMBannerView.h"
#import "KWMAdvertisement.h"
@protocol KWMAdDelegate <NSObject>
- (void)kwm_gotoWebView:(NSString *)url;
@end
@interface KWMAdHeader : UIView<KWMBannerViewDelegate>
+ (NSString *)kwmTag;
-(void)startBannerTimer;
-(void)endBannerTimer;
@property (nonatomic) NSArray<KWMAdvertisement *> *adArray;
@property(nonatomic,weak) id<KWMAdDelegate> delegate;
@end
//
// KWMAdHeader.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMAdHeader.h"
#import "UIImageView+WebCache.h"
@interface KWMAdHeader()
@property (nonatomic,strong) KWMBannerView *bannerView;
@end
@implementation KWMAdHeader
+(NSString *)kwmTag{
return @"KWMAdHeader";
}
- (id)init{
if (self=[super init]){
[self addView];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self addView];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
if (self =[super initWithFrame:frame]) {
[self addView];
}
return self;
}
-(void)addView{
self.bannerView = [[KWMBannerView alloc]initWithFrame:self.frame];
self.bannerView.delegate = self;
[self addSubview:self.bannerView];
}
-(void)startBannerTimer{
[self.bannerView addTimer];
}
-(void)endBannerTimer{
[self.bannerView removeTimer];
}
-(void)setAdArray:(NSArray<KWMAdvertisement *> *)adArray{
_adArray = adArray;
[self.bannerView reloadData];
}
#pragma mark - KWMBannerViewDelegate
-(UIView *)bannerView:(KWMBannerView *)bannerView reusingView:(UIView *)reusingView pageAtIndex:(NSInteger)index{
UIView *itemView = reusingView?reusingView:nil;
UIImageView *topBannerItem = nil;
if(!itemView){
topBannerItem = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, bannerView.frame.size.width, bannerView.frame.size.height)];
}else{
topBannerItem = (UIImageView *)itemView;
}
KWMAdvertisement *ad = [self.adArray objectAtIndex:index];
NSURL *imageURL = [NSURL URLWithString:ad.image];
[topBannerItem sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
//topBannerItem.image = [UIImage imageNamed:@"test_banner_1"];
topBannerItem.contentMode=UIViewContentModeScaleAspectFill;
itemView = topBannerItem;
return itemView;
}
-(NSInteger)numberOfPagesForBanner:(KWMBannerView *)bannerView{
return self.adArray?self.adArray.count:0;
}
-(void)bannerView:(KWMBannerView *)bannerView onClickPage:(NSInteger)index{
KWMAdvertisement *ad = [self.adArray objectAtIndex:index];
if(self.delegate){
[self.delegate kwm_gotoWebView:ad.url];
}
}
@end
//
// KWMSuitCell.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/5.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@interface KWMClothingSetsCell : UICollectionViewCell
@property(nonatomic) BUYProduct *product;
@end
//
// KWMSuitCell.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/5.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMClothingSetsCell.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
@interface KWMClothingSetsCell()
@property(nonatomic,weak) IBOutlet UILabel *lbName;
@property(nonatomic,weak) IBOutlet UILabel *lbPrice;
@property(nonatomic,weak) IBOutlet UIImageView *ivProduct;
@end
@implementation KWMClothingSetsCell
- (void)awakeFromNib {
[super awakeFromNib];
}
-(void)setProduct:(BUYProduct *)product{
_product = product;
if(product){
NSString *imageUrl = [KWMImageUtil getProductImageUrl:product ImageSize:SmallImage];
NSURL *imageURL = [NSURL URLWithString:imageUrl];
[self.ivProduct sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
self.lbName.text = product.title;
if(product.variantsArray.count>0){
BUYProductVariant *variant = product.variantsArray.firstObject;
self.lbPrice.text = [KWMStringUtil price:variant.price];
}
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="KWMClothingSetsCell">
<rect key="frame" x="0.0" y="0.0" width="66" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="66" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HJW-BD-Yxt">
<rect key="frame" x="0.0" y="0.0" width="66" height="100"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="test_home_cloth_2" translatesAutoresizingMaskIntoConstraints="NO" id="9za-nW-9Xw">
<rect key="frame" x="0.0" y="0.0" width="66" height="66"/>
<constraints>
<constraint firstAttribute="width" secondItem="9za-nW-9Xw" secondAttribute="height" multiplier="1:1" id="0g9-Jd-NWL"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CARAMEL" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yLu-gy-qUp">
<rect key="frame" x="0.0" y="66" width="66" height="15.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="11"/>
<color key="textColor" red="0.3411764705882353" green="0.3411764705882353" blue="0.3411764705882353" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥2900" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y7j-iw-wgF">
<rect key="frame" x="0.0" y="81.5" width="31" height="13"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="9"/>
<color key="textColor" red="0.59215686274509804" green="0.59215686274509804" blue="0.59215686274509804" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥2450" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ETG-Ir-uXq">
<rect key="frame" x="35" y="81.5" width="31" height="13"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="9"/>
<color key="textColor" red="0.59215686274509804" green="0.59215686274509804" blue="0.59215686274509804" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Y7j-iw-wgF" firstAttribute="leading" secondItem="HJW-BD-Yxt" secondAttribute="leading" id="5ZM-eJ-GGC"/>
<constraint firstItem="Y7j-iw-wgF" firstAttribute="top" secondItem="yLu-gy-qUp" secondAttribute="bottom" id="BgQ-jF-bdC"/>
<constraint firstAttribute="trailing" secondItem="ETG-Ir-uXq" secondAttribute="trailing" id="Gkl-Fj-jok"/>
<constraint firstAttribute="trailing" secondItem="yLu-gy-qUp" secondAttribute="trailing" id="J6w-IL-OFe"/>
<constraint firstItem="yLu-gy-qUp" firstAttribute="top" secondItem="9za-nW-9Xw" secondAttribute="bottom" id="Sjr-vz-04G"/>
<constraint firstItem="9za-nW-9Xw" firstAttribute="leading" secondItem="HJW-BD-Yxt" secondAttribute="leading" id="WTp-pJ-BqU"/>
<constraint firstAttribute="trailing" secondItem="9za-nW-9Xw" secondAttribute="trailing" id="lNG-tE-Czx"/>
<constraint firstItem="yLu-gy-qUp" firstAttribute="leading" secondItem="HJW-BD-Yxt" secondAttribute="leading" id="qrw-fg-pgo"/>
<constraint firstItem="ETG-Ir-uXq" firstAttribute="top" secondItem="yLu-gy-qUp" secondAttribute="bottom" id="r1H-oy-KBr"/>
<constraint firstItem="9za-nW-9Xw" firstAttribute="top" secondItem="HJW-BD-Yxt" secondAttribute="top" id="r31-zi-pm2"/>
</constraints>
</view>
</subviews>
</view>
<constraints>
<constraint firstAttribute="bottom" secondItem="HJW-BD-Yxt" secondAttribute="bottom" id="4iA-WQ-OGj"/>
<constraint firstAttribute="trailing" secondItem="HJW-BD-Yxt" secondAttribute="trailing" id="MbS-uF-BDP"/>
<constraint firstItem="HJW-BD-Yxt" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="xt9-ym-xFa"/>
<constraint firstItem="HJW-BD-Yxt" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="yXo-lP-ZkK"/>
</constraints>
<size key="customSize" width="84" height="78"/>
<connections>
<outlet property="ivProduct" destination="9za-nW-9Xw" id="o4P-wq-5gE"/>
<outlet property="lbName" destination="yLu-gy-qUp" id="EyX-Dv-lZp"/>
<outlet property="lbPrice" destination="ETG-Ir-uXq" id="gGI-mJ-6Ms"/>
</connections>
<point key="canvasLocation" x="75" y="122"/>
</collectionViewCell>
</objects>
<resources>
<image name="test_home_cloth_2" width="140" height="140"/>
</resources>
</document>
//
// KWMClothingSetsHeader.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@protocol KWMClothingSetsDelegate <NSObject>
- (void)kwm_onClickProduct:(BUYProduct *)product;
@end
@interface KWMClothingSetsHeader : UIView<UICollectionViewDataSource,UICollectionViewDelegate>
+ (NSString *)kwmTag;
@property(nonatomic,weak) id<KWMClothingSetsDelegate> delegate;
@property(nonatomic) NSArray *productArray;
@property(nonatomic) NSString *headerImage;
@end
//
// KWMClothingSetsHeader.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMClothingSetsHeader.h"
#import "KWMClothingSetsCell.h"
#import "UIImageView+WebCache.h"
@interface KWMClothingSetsHeader()
@property (nonatomic,weak) IBOutlet UIView *vView;
@property (nonatomic,weak) IBOutlet UICollectionView *cvSets;
@property (nonatomic,weak) IBOutlet UIImageView *ivHeader;
@end
@implementation KWMClothingSetsHeader
+(NSString *)kwmTag{
return @"KWMClothingSetsHeader";
}
- (id)init{
if (self=[super init]){
[self addView];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self addView];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
if (self =[super initWithFrame:frame]) {
[self addView];
}
return self;
}
-(void)addView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self
options:nil];
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
[self initView];
}
-(void)initView{
self.cvSets.delegate = self;
self.cvSets.dataSource = self;
[self.cvSets registerNib:[UINib nibWithNibName:NSStringFromClass([KWMClothingSetsCell class]) bundle:nil] forCellWithReuseIdentifier:NSStringFromClass([KWMClothingSetsCell class])];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
layout.minimumLineSpacing = 20;
layout.sectionInset = UIEdgeInsetsMake(0, 20, 0, 0);
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.cvSets.collectionViewLayout = layout;
}
-(void)setProductArray:(NSArray *)productArray{
_productArray = productArray;
[self.cvSets reloadData];
}
-(void)setHeaderImage:(NSString *)headerImage{
_headerImage = headerImage;
NSURL *imageURL = [NSURL URLWithString:headerImage];
[self.ivHeader sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
}
#pragma mark - UICollectionViewDataSource
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
KWMClothingSetsCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMClothingSetsCell class]) forIndexPath:indexPath];
BUYProduct *product = [self.productArray objectAtIndex:indexPath.row];
cell.product = product;
return cell;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGSize size = CGSizeMake(66, 100);
return size;
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.productArray?self.productArray.count:0;
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMClothingSetsHeader">
<connections>
<outlet property="cvSets" destination="Vrm-Ee-B8d" id="Gd3-Qy-Yyl"/>
<outlet property="ivHeader" destination="Xzr-zM-E25" id="Baj-uk-PJK"/>
<outlet property="vView" destination="iN0-l3-epB" id="lK1-FX-gaB"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="310"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nBP-0Q-eKB" userLabel="推荐搭配title view">
<rect key="frame" x="0.0" y="0.0" width="375" height="190"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="test_suit" translatesAutoresizingMaskIntoConstraints="NO" id="Xzr-zM-E25">
<rect key="frame" x="0.0" y="0.0" width="375" height="190"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_triangle" translatesAutoresizingMaskIntoConstraints="NO" id="LvJ-FP-Yc1">
<rect key="frame" x="177" y="181" width="20" height="10"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="eNY-P5-Ji7"/>
<constraint firstAttribute="height" constant="10" id="oBh-wd-7za"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="0.90588235289999997" green="0.81960784310000001" blue="0.74117647060000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Xzr-zM-E25" firstAttribute="top" secondItem="nBP-0Q-eKB" secondAttribute="top" id="4oD-P2-9Xz"/>
<constraint firstItem="Xzr-zM-E25" firstAttribute="leading" secondItem="nBP-0Q-eKB" secondAttribute="leading" id="Fci-xu-TIa"/>
<constraint firstAttribute="bottom" secondItem="LvJ-FP-Yc1" secondAttribute="bottom" constant="-1" id="SAq-Iw-I6t"/>
<constraint firstAttribute="height" constant="190" id="Ssh-cP-PRt"/>
<constraint firstAttribute="bottom" secondItem="Xzr-zM-E25" secondAttribute="bottom" id="UhQ-tF-lG6"/>
<constraint firstAttribute="trailing" secondItem="Xzr-zM-E25" secondAttribute="trailing" id="dj0-cH-YiI"/>
<constraint firstItem="LvJ-FP-Yc1" firstAttribute="centerX" secondItem="nBP-0Q-eKB" secondAttribute="centerX" id="yqu-ba-mQR"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d3i-H3-n3M" userLabel="推荐搭配view">
<rect key="frame" x="0.0" y="200" width="375" height="110"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Vrm-Ee-B8d">
<rect key="frame" x="0.0" y="0.0" width="375" height="110"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="yJj-6q-jus">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
</collectionView>
</subviews>
<color key="backgroundColor" red="0.94509803920000002" green="0.57254901960000004" blue="0.60392156860000001" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="Vrm-Ee-B8d" secondAttribute="trailing" id="4Ee-9q-Qw4"/>
<constraint firstItem="Vrm-Ee-B8d" firstAttribute="leading" secondItem="d3i-H3-n3M" secondAttribute="leading" id="QHG-5e-T4g"/>
<constraint firstAttribute="height" constant="110" id="ape-VU-LEB"/>
<constraint firstItem="Vrm-Ee-B8d" firstAttribute="top" secondItem="d3i-H3-n3M" secondAttribute="top" id="sK4-AC-qhp"/>
<constraint firstAttribute="bottom" secondItem="Vrm-Ee-B8d" secondAttribute="bottom" id="wyf-yo-UKD"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="d3i-H3-n3M" firstAttribute="top" secondItem="nBP-0Q-eKB" secondAttribute="bottom" constant="10" id="AWM-jC-Dgh"/>
<constraint firstAttribute="trailing" secondItem="nBP-0Q-eKB" secondAttribute="trailing" id="FsT-9E-ABs"/>
<constraint firstItem="nBP-0Q-eKB" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Ir3-VU-W52"/>
<constraint firstItem="d3i-H3-n3M" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="eci-1V-z0s"/>
<constraint firstAttribute="trailing" secondItem="d3i-H3-n3M" secondAttribute="trailing" id="miR-QW-5Az"/>
<constraint firstItem="nBP-0Q-eKB" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="onh-Xr-uix"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="34.5" y="107"/>
</view>
</objects>
<resources>
<image name="ic_triangle" width="16" height="16"/>
<image name="test_suit" width="375" height="212"/>
</resources>
</document>
//
// KWMHotSalesHeader.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "KWMBannerView.h"
#import <Buy/Buy.h>
@protocol KWMHotSalesDelegate <NSObject>
- (void)kwm_onClickProduct:(BUYProduct *)product;
@end
@interface KWMHotSalesHeader : UIView<KWMBannerViewDelegate>
+ (NSString *)kwmTag;
-(void)startBannerTimer;
-(void)endBannerTimer;
@property(nonatomic,weak) id<KWMHotSalesDelegate> delegate;
@property(nonatomic) NSArray *singleShowArray;
@property(nonatomic) NSArray *bannerArray;
@end
//
// KWMHotSalesHeader.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMHotSalesHeader.h"
#import "KWMProductBannerItemView.h"
#import "UIImageView+WebCache.h"
@interface KWMHotSalesHeader()
@property (nonatomic,weak) IBOutlet UIView *vView;
@property (nonatomic,weak) IBOutlet KWMBannerView *bannerView;
@end
@implementation KWMHotSalesHeader
+(NSString *)kwmTag{
return @"KWMHotSalesHeader";
}
- (id)init{
if (self=[super init]){
[self addView];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self addView];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
if (self =[super initWithFrame:frame]) {
[self addView];
}
return self;
}
-(void)addView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self
options:nil];
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
[self initView];
}
-(void)initView{
self.bannerView.delegate = self;
}
-(void)startBannerTimer{
[self.bannerView addTimer];
}
-(void)endBannerTimer{
[self.bannerView removeTimer];
}
#pragma mark - KWMBannerViewDelegate
-(UIView *)bannerView:(KWMBannerView *)bannerView reusingView:(UIView *)reusingView pageAtIndex:(NSInteger)index{
UIView *itemView = reusingView?reusingView:nil;
KWMProductBannerItemView *productBannerItem = nil;
if(!itemView){
productBannerItem = [[KWMProductBannerItemView alloc]initWithFrame:CGRectMake(0, 0, bannerView.frame.size.width, bannerView.frame.size.height)];
}else{
productBannerItem = (KWMProductBannerItemView *)itemView;
}
itemView = productBannerItem;
return itemView;
}
-(NSInteger)numberOfPagesForBanner:(KWMBannerView *)bannerView{
return 4;
}
-(void)bannerView:(KWMBannerView *)bannerView onClickPage:(NSInteger)index{
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMHotSalesHeader">
<connections>
<outlet property="bannerView" destination="Ruv-UI-DGw" id="USH-xg-KHp"/>
<outlet property="vView" destination="iN0-l3-epB" id="bI2-U9-soo"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="300"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d0n-L5-xP1" userLabel="热卖单品title view">
<rect key="frame" x="0.0" y="10" width="375" height="50"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uhq-ZL-9OL">
<rect key="frame" x="97.5" y="24.5" width="40" height="1"/>
<color key="backgroundColor" red="0.84705882349999995" green="0.85882352939999995" blue="0.87058823529999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="hzU-8w-40e"/>
<constraint firstAttribute="height" constant="1" id="xaE-u5-Def"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ILX-tg-IwY">
<rect key="frame" x="237.5" y="24.5" width="40" height="1"/>
<color key="backgroundColor" red="0.84705882349999995" green="0.85882352939999995" blue="0.87058823529999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Nec-hp-m8B"/>
<constraint firstAttribute="width" constant="40" id="Rei-3E-m0o"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="热卖单品" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eec-tG-wTs">
<rect key="frame" x="159.5" y="15" width="56" height="20"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="14"/>
<color key="textColor" red="0.31764705879999999" green="0.31764705879999999" blue="0.31764705879999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="5Yc-uM-1JE"/>
<constraint firstItem="eec-tG-wTs" firstAttribute="centerY" secondItem="d0n-L5-xP1" secondAttribute="centerY" id="I3v-8v-sbb"/>
<constraint firstItem="uhq-ZL-9OL" firstAttribute="centerY" secondItem="d0n-L5-xP1" secondAttribute="centerY" id="Kd2-sq-d0s"/>
<constraint firstItem="ILX-tg-IwY" firstAttribute="centerX" secondItem="d0n-L5-xP1" secondAttribute="centerX" constant="70" id="ebd-7K-pU1"/>
<constraint firstItem="uhq-ZL-9OL" firstAttribute="centerX" secondItem="d0n-L5-xP1" secondAttribute="centerX" constant="-70" id="fE4-tP-dve"/>
<constraint firstItem="eec-tG-wTs" firstAttribute="centerX" secondItem="d0n-L5-xP1" secondAttribute="centerX" id="kdF-5D-r65"/>
<constraint firstItem="ILX-tg-IwY" firstAttribute="centerY" secondItem="d0n-L5-xP1" secondAttribute="centerY" id="r8p-Ru-bb6"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ruv-UI-DGw" userLabel="热卖单品Banner" customClass="KWMBannerView">
<rect key="frame" x="0.0" y="60" width="375" height="190"/>
<color key="backgroundColor" red="0.90588235289999997" green="0.81960784310000001" blue="0.74117647060000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="190" id="NbW-Kh-s5O"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dwm-lO-Zce" userLabel="singleShowView">
<rect key="frame" x="0.0" y="250" width="375" height="50"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Ruv-UI-DGw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="9fw-Ph-Q4P"/>
<constraint firstItem="Ruv-UI-DGw" firstAttribute="top" secondItem="d0n-L5-xP1" secondAttribute="bottom" id="BTm-DX-XK4"/>
<constraint firstAttribute="bottom" secondItem="Dwm-lO-Zce" secondAttribute="bottom" id="Kxi-PL-odG"/>
<constraint firstAttribute="trailing" secondItem="Ruv-UI-DGw" secondAttribute="trailing" id="RLP-eB-Asb"/>
<constraint firstItem="d0n-L5-xP1" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="aWf-1E-iKC"/>
<constraint firstItem="d0n-L5-xP1" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="g82-sr-LTG"/>
<constraint firstAttribute="trailing" secondItem="d0n-L5-xP1" secondAttribute="trailing" id="iHt-uY-XiY"/>
<constraint firstAttribute="trailing" secondItem="Dwm-lO-Zce" secondAttribute="trailing" id="q59-1g-wOJ"/>
<constraint firstItem="Dwm-lO-Zce" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="vxZ-CO-Z64"/>
<constraint firstItem="Dwm-lO-Zce" firstAttribute="top" secondItem="Ruv-UI-DGw" secondAttribute="bottom" id="y5m-bf-H2m"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="34.5" y="107"/>
</view>
</objects>
</document>
//
// KWMMenuHeader.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
@protocol KWMMenuDelegate <NSObject>
- (void)kwm_onClickNewMenu;
- (void)kwm_onClickHotMenu;
- (void)kwm_onClickWishMenu;
- (void)kwm_onClickDeliveryMenu;
@end
@interface KWMMenuHeader : UIView
+ (NSString *)kwmTag;
@property(nonatomic,weak) id<KWMMenuDelegate> delegate;
@end
//
// KWMMenuHeader.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMMenuHeader.h"
@interface KWMMenuHeader()
@property (nonatomic,weak) IBOutlet UIView *vView;
@end
@implementation KWMMenuHeader
+(NSString *)kwmTag{
return @"KWMMenuHeader";
}
- (id)init{
if (self=[super init]){
[self addView];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self addView];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
if (self =[super initWithFrame:frame]) {
[self addView];
}
return self;
}
-(void) addView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self
options:nil];
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMMenuHeader">
<connections>
<outlet property="vView" destination="iN0-l3-epB" id="lxd-bJ-cLo"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u4V-4f-pEs" userLabel="快捷入口view">
<rect key="frame" x="0.0" y="20" width="375" height="80"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vyx-ed-YkS" userLabel="最新单品">
<rect key="frame" x="10" y="0.0" width="89" height="80"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_home_new_product" translatesAutoresizingMaskIntoConstraints="NO" id="4Bg-sB-Fk4">
<rect key="frame" x="25" y="0.0" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="ROx-Wz-0XX"/>
<constraint firstAttribute="width" constant="40" id="Z7q-xQ-3CA"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="最新单品" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c40-0Y-Obt">
<rect key="frame" x="21" y="50" width="48" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.13725490200000001" green="0.14117647059999999" blue="0.16078431369999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="4Bg-sB-Fk4" firstAttribute="top" secondItem="Vyx-ed-YkS" secondAttribute="top" id="Qys-rx-muq"/>
<constraint firstItem="4Bg-sB-Fk4" firstAttribute="centerX" secondItem="Vyx-ed-YkS" secondAttribute="centerX" id="WEr-ts-Nib"/>
<constraint firstItem="c40-0Y-Obt" firstAttribute="top" secondItem="4Bg-sB-Fk4" secondAttribute="bottom" constant="10" id="u96-ve-TeV"/>
<constraint firstItem="c40-0Y-Obt" firstAttribute="centerX" secondItem="Vyx-ed-YkS" secondAttribute="centerX" id="vjx-GI-Sjs"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="92D-Xx-Bd9" userLabel="火爆热卖">
<rect key="frame" x="99" y="0.0" width="88.5" height="80"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_home_hot_product" translatesAutoresizingMaskIntoConstraints="NO" id="JdT-c1-AgH">
<rect key="frame" x="24" y="0.0" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="X3i-4k-qD6"/>
<constraint firstAttribute="height" constant="40" id="m2N-Ea-82N"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="火爆热卖" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3sg-P6-odK">
<rect key="frame" x="20.5" y="50" width="48" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.13725490200000001" green="0.14117647059999999" blue="0.16078431369999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="JdT-c1-AgH" firstAttribute="top" secondItem="92D-Xx-Bd9" secondAttribute="top" id="4xb-8P-Bfq"/>
<constraint firstItem="3sg-P6-odK" firstAttribute="top" secondItem="JdT-c1-AgH" secondAttribute="bottom" constant="10" id="SHS-AO-PBc"/>
<constraint firstItem="3sg-P6-odK" firstAttribute="centerX" secondItem="92D-Xx-Bd9" secondAttribute="centerX" id="g4G-UD-0fN"/>
<constraint firstItem="JdT-c1-AgH" firstAttribute="centerX" secondItem="92D-Xx-Bd9" secondAttribute="centerX" id="pGd-bq-ZI1"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PAq-6Z-msb" userLabel="我喜欢的">
<rect key="frame" x="187.5" y="0.0" width="89" height="80"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_home_favorite_product" translatesAutoresizingMaskIntoConstraints="NO" id="Pfa-Sa-Cv9">
<rect key="frame" x="25" y="0.0" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="8i5-Xk-Yzu"/>
<constraint firstAttribute="width" constant="40" id="p2z-yO-hLm"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="我喜欢的" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2Fh-Tj-POc">
<rect key="frame" x="20.5" y="50" width="48" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.13725490200000001" green="0.14117647059999999" blue="0.16078431369999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="2Fh-Tj-POc" firstAttribute="centerX" secondItem="PAq-6Z-msb" secondAttribute="centerX" id="SWN-bO-gb1"/>
<constraint firstItem="Pfa-Sa-Cv9" firstAttribute="centerX" secondItem="PAq-6Z-msb" secondAttribute="centerX" id="bqR-bR-Fwr"/>
<constraint firstItem="2Fh-Tj-POc" firstAttribute="top" secondItem="Pfa-Sa-Cv9" secondAttribute="bottom" constant="10" id="dJl-Bc-0PQ"/>
<constraint firstItem="Pfa-Sa-Cv9" firstAttribute="top" secondItem="PAq-6Z-msb" secondAttribute="top" id="szi-Li-o6n"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fxs-MB-T7q" userLabel="直邮说明">
<rect key="frame" x="276.5" y="0.0" width="88.5" height="80"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_home_about_shipping" translatesAutoresizingMaskIntoConstraints="NO" id="keV-Nx-QNu">
<rect key="frame" x="24" y="0.0" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="39o-Op-HHl"/>
<constraint firstAttribute="width" constant="40" id="n6V-12-EnZ"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="直邮说明" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Izf-6L-av5">
<rect key="frame" x="20.5" y="50" width="48" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.13725490200000001" green="0.14117647059999999" blue="0.16078431369999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Izf-6L-av5" firstAttribute="top" secondItem="keV-Nx-QNu" secondAttribute="bottom" constant="10" id="2b4-9n-z6h"/>
<constraint firstItem="keV-Nx-QNu" firstAttribute="top" secondItem="fxs-MB-T7q" secondAttribute="top" id="2dK-0c-oKe"/>
<constraint firstItem="Izf-6L-av5" firstAttribute="centerX" secondItem="fxs-MB-T7q" secondAttribute="centerX" id="3rs-0K-XLv"/>
<constraint firstItem="keV-Nx-QNu" firstAttribute="centerX" secondItem="fxs-MB-T7q" secondAttribute="centerX" id="8go-Zp-Y2W"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Vyx-ed-YkS" firstAttribute="leading" secondItem="u4V-4f-pEs" secondAttribute="leading" constant="10" id="12i-ls-WaK"/>
<constraint firstItem="fxs-MB-T7q" firstAttribute="leading" secondItem="PAq-6Z-msb" secondAttribute="trailing" id="CEM-fa-2oF"/>
<constraint firstItem="PAq-6Z-msb" firstAttribute="leading" secondItem="92D-Xx-Bd9" secondAttribute="trailing" id="MyQ-qk-Uer"/>
<constraint firstAttribute="height" constant="80" id="TOK-qB-8XU"/>
<constraint firstAttribute="bottom" secondItem="PAq-6Z-msb" secondAttribute="bottom" id="VVG-Xg-nZI"/>
<constraint firstItem="PAq-6Z-msb" firstAttribute="width" secondItem="Vyx-ed-YkS" secondAttribute="width" id="VtG-T5-cZP"/>
<constraint firstItem="92D-Xx-Bd9" firstAttribute="width" secondItem="Vyx-ed-YkS" secondAttribute="width" id="WUk-SN-Cy3"/>
<constraint firstItem="fxs-MB-T7q" firstAttribute="top" secondItem="u4V-4f-pEs" secondAttribute="top" id="XV2-4S-sU9"/>
<constraint firstItem="92D-Xx-Bd9" firstAttribute="top" secondItem="u4V-4f-pEs" secondAttribute="top" id="aKm-od-9LU"/>
<constraint firstAttribute="trailing" secondItem="fxs-MB-T7q" secondAttribute="trailing" constant="10" id="fhj-Mi-TlU"/>
<constraint firstAttribute="bottom" secondItem="92D-Xx-Bd9" secondAttribute="bottom" id="gly-WO-Ljh"/>
<constraint firstAttribute="bottom" secondItem="Vyx-ed-YkS" secondAttribute="bottom" id="hpt-2c-UNZ"/>
<constraint firstItem="Vyx-ed-YkS" firstAttribute="top" secondItem="u4V-4f-pEs" secondAttribute="top" id="k2w-t0-e6Y"/>
<constraint firstItem="PAq-6Z-msb" firstAttribute="top" secondItem="u4V-4f-pEs" secondAttribute="top" id="mRl-9q-zMQ"/>
<constraint firstItem="fxs-MB-T7q" firstAttribute="width" secondItem="Vyx-ed-YkS" secondAttribute="width" id="ng3-pj-19f"/>
<constraint firstItem="92D-Xx-Bd9" firstAttribute="leading" secondItem="Vyx-ed-YkS" secondAttribute="trailing" id="qao-oW-QJs"/>
<constraint firstAttribute="bottom" secondItem="fxs-MB-T7q" secondAttribute="bottom" id="y0q-P9-gQt"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="u4V-4f-pEs" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="20" id="JqQ-5R-bub"/>
<constraint firstAttribute="trailing" secondItem="u4V-4f-pEs" secondAttribute="trailing" id="KH1-LN-xeO"/>
<constraint firstItem="u4V-4f-pEs" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="dtT-rb-i68"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
<image name="ic_home_about_shipping" width="40" height="40"/>
<image name="ic_home_favorite_product" width="40" height="40"/>
<image name="ic_home_hot_product" width="40" height="40"/>
<image name="ic_home_new_product" width="40" height="40"/>
</resources>
</document>
//
// KWMNewHomeCell.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/2.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@interface KWMNewHomeCell : UICollectionViewCell
@property(nonatomic,weak) IBOutlet UIView *vContent;
//文本是否居中
@property(nonatomic) BOOL textAlignCenter;
@property(nonatomic) BUYProduct *product;
+(NSInteger)acturlHeight:(BUYProduct *)product width:(NSInteger)width;
@end
//
// KWMNewHomeCell.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/2.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMNewHomeCell.h"
#import "UIView+Prettify.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
@interface KWMNewHomeCell()
@property(nonatomic,weak) IBOutlet UILabel *lbBrand;
@property(nonatomic,weak) IBOutlet UILabel *lbName;
@property(nonatomic,weak) IBOutlet UILabel *lbPrice;
@property(nonatomic,weak) IBOutlet UIImageView *ivProduct;
@end
@implementation KWMNewHomeCell
- (void)awakeFromNib {
[super awakeFromNib];
[self.vContent initDefaultShadow];
}
-(void)setTextAlignCenter:(BOOL)textAlignCenter{
if(textAlignCenter){
NSTextAlignment textAlignment = textAlignCenter?NSTextAlignmentCenter:NSTextAlignmentLeft;
self.lbBrand.textAlignment = textAlignment;
self.lbName.textAlignment = textAlignment;
self.lbPrice.textAlignment = textAlignment;
self.lbName.numberOfLines = 1;
self.lbBrand.numberOfLines = 1;
}
}
-(void)setProduct:(BUYProduct *)product{
_product = product;
if(product){
NSString *imageUrl = [KWMImageUtil getProductImageUrl:product ImageSize:SmallImage];
NSURL *imageURL = [NSURL URLWithString:imageUrl];
[self.ivProduct sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
self.lbBrand.text = product.vendor;
self.lbName.text = product.title;
if(product.variantsArray.count>0){
BUYProductVariant *variant = product.variantsArray.firstObject;
self.lbPrice.text = [KWMStringUtil price:variant.price];
}
}
}
+(NSInteger)acturlHeight:(BUYProduct *)product width:(NSInteger)width{
NSInteger lbNameWidth = width - 60;
UIFont *font = [UIFont systemFontOfSize:12];
if(SYSTEM_VERSION_LESS_THAN(@"9.0")){
[UIFont fontWithName:@"PingFang SC" size:12];
}
NSInteger lbNameHeight = [KWMStringUtil getLabelHeight:product.title labelFont:font textWidth:lbNameWidth].height;
return 250 - 13 + lbNameHeight;
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" tag="1111" contentMode="center" id="gTV-IL-0wX" customClass="KWMNewHomeCell">
<rect key="frame" x="0.0" y="0.0" width="184" height="250"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="184" height="250"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view tag="999" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eUm-tt-XRm">
<rect key="frame" x="0.0" y="0.0" width="184" height="250"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PUL-8B-4lT">
<rect key="frame" x="10" y="10" width="164" height="230"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="test_home_cloth_2" translatesAutoresizingMaskIntoConstraints="NO" id="Yw1-oo-Px9">
<rect key="frame" x="10" y="10" width="144" height="144"/>
<constraints>
<constraint firstAttribute="width" secondItem="Yw1-oo-Px9" secondAttribute="height" multiplier="1:1" id="Plg-nh-9IY"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="EMILE ET IDA" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iip-8b-kmO">
<rect key="frame" x="20" y="174" width="124" height="17"/>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.3411764705882353" green="0.3411764705882353" blue="0.3411764705882353" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Baby Girls Pink Cotton Dress" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VtC-9N-HwV">
<rect key="frame" x="20" y="191" width="124" height="13"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="9"/>
<color key="textColor" red="0.3411764705882353" green="0.3411764705882353" blue="0.3411764705882353" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥245" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="I9K-1A-41L">
<rect key="frame" x="20" y="204" width="124" height="15.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Semibold" family="PingFang SC" pointSize="11"/>
<color key="textColor" red="0.94509803921568625" green="0.5725490196078431" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="iip-8b-kmO" firstAttribute="top" secondItem="Yw1-oo-Px9" secondAttribute="bottom" constant="20" id="5x3-U5-Tk4"/>
<constraint firstItem="Yw1-oo-Px9" firstAttribute="top" secondItem="PUL-8B-4lT" secondAttribute="top" constant="10" id="AFL-Yl-vYR"/>
<constraint firstItem="VtC-9N-HwV" firstAttribute="top" secondItem="iip-8b-kmO" secondAttribute="bottom" id="CUr-b2-Mlj"/>
<constraint firstItem="Yw1-oo-Px9" firstAttribute="leading" secondItem="PUL-8B-4lT" secondAttribute="leading" constant="10" id="HHD-Te-aIz"/>
<constraint firstItem="VtC-9N-HwV" firstAttribute="leading" secondItem="PUL-8B-4lT" secondAttribute="leading" constant="20" id="IDU-jP-oLa"/>
<constraint firstAttribute="trailing" secondItem="I9K-1A-41L" secondAttribute="trailing" constant="20" id="MbK-01-xMo"/>
<constraint firstItem="I9K-1A-41L" firstAttribute="leading" secondItem="PUL-8B-4lT" secondAttribute="leading" constant="20" id="UT0-th-1oq"/>
<constraint firstAttribute="trailing" secondItem="Yw1-oo-Px9" secondAttribute="trailing" constant="10" id="VHa-rc-KaE"/>
<constraint firstAttribute="trailing" secondItem="VtC-9N-HwV" secondAttribute="trailing" constant="20" id="Wpj-A5-jni"/>
<constraint firstAttribute="trailing" secondItem="iip-8b-kmO" secondAttribute="trailing" constant="20" id="YCX-w6-xX0"/>
<constraint firstItem="iip-8b-kmO" firstAttribute="leading" secondItem="PUL-8B-4lT" secondAttribute="leading" constant="20" id="b3U-cr-ZDD"/>
<constraint firstItem="I9K-1A-41L" firstAttribute="top" secondItem="VtC-9N-HwV" secondAttribute="bottom" id="hD3-ec-XTJ"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="PUL-8B-4lT" secondAttribute="bottom" constant="10" id="1dM-Eh-HNy"/>
<constraint firstItem="PUL-8B-4lT" firstAttribute="leading" secondItem="eUm-tt-XRm" secondAttribute="leading" constant="10" id="7mj-32-Otd"/>
<constraint firstAttribute="trailing" secondItem="PUL-8B-4lT" secondAttribute="trailing" constant="10" id="Gjy-El-ETO"/>
<constraint firstItem="PUL-8B-4lT" firstAttribute="top" secondItem="eUm-tt-XRm" secondAttribute="top" constant="10" id="gle-W7-xpx"/>
</constraints>
</view>
</subviews>
</view>
<constraints>
<constraint firstItem="eUm-tt-XRm" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="Kbh-Gc-SDc"/>
<constraint firstAttribute="trailing" secondItem="eUm-tt-XRm" secondAttribute="trailing" id="c3O-1E-opH"/>
<constraint firstAttribute="bottom" secondItem="eUm-tt-XRm" secondAttribute="bottom" id="l6S-fV-SJb"/>
<constraint firstItem="eUm-tt-XRm" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="zg2-VO-6we"/>
</constraints>
<size key="customSize" width="145" height="199"/>
<connections>
<outlet property="lbBrand" destination="iip-8b-kmO" id="kWY-VC-0aX"/>
<outlet property="lbName" destination="VtC-9N-HwV" id="fk8-4v-a3w"/>
<outlet property="lbPrice" destination="I9K-1A-41L" id="AIn-iA-Kep"/>
<outlet property="vContent" destination="PUL-8B-4lT" id="HaA-xv-gdY"/>
</connections>
<point key="canvasLocation" x="81.5" y="182.5"/>
</collectionViewCell>
</objects>
<resources>
<image name="test_home_cloth_2" width="140" height="140"/>
</resources>
</document>
//
// KWMProductBannerItemView.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/6.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KWMProductBannerItemView : UIView
@end
//
// KWMProductBannerItemView.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/6.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMProductBannerItemView.h"
@interface KWMProductBannerItemView()
@property(nonatomic,weak) IBOutlet UIView *vContent;
@end
@implementation KWMProductBannerItemView
-(instancetype)initWithFrame:(CGRect)frame{
if(self = [super initWithFrame:frame]){
[self initView];
}
return self;
}
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
if(self = [super initWithCoder:aDecoder]){
[self initView];
}
return self;
}
//初始化
-(void)initView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([KWMProductBannerItemView class]) owner:self options:nil];
self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vContent];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMProductBannerItemView">
<connections>
<outlet property="vContent" destination="iN0-l3-epB" id="rUH-Gz-s4z"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="190"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d5I-Jk-u2e">
<rect key="frame" x="0.0" y="0.0" width="375" height="190"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="test_banner_2" translatesAutoresizingMaskIntoConstraints="NO" id="e8E-hq-YPY">
<rect key="frame" x="0.0" y="0.0" width="375" height="190"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FUE-dq-5n6" userLabel="商品信息">
<rect key="frame" x="187.5" y="0.0" width="187.5" height="170"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gqI-UE-aVc">
<rect key="frame" x="142.5" y="141" width="25" height="14"/>
<attributedString key="attributedText">
<fragment content="¥">
<attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<font key="NSFont" size="7" name="PingFangSC-Regular"/>
</attributes>
</fragment>
<fragment content="880">
<attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<font key="NSFont" size="10" name="PingFangSC-Regular"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l0b-N1-QSE">
<rect key="frame" x="98" y="141" width="29.5" height="14"/>
<attributedString key="attributedText">
<fragment content="¥">
<attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<font key="NSFont" size="7" name="PingFangSC-Regular"/>
</attributes>
</fragment>
<fragment content="1200">
<attributes>
<color key="NSColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<font key="NSFont" size="10" name="PingFangSC-Regular"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Baby Girls Pink Cotton Dress" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PDD-Zm-9cr">
<rect key="frame" x="31.5" y="127" width="136" height="14"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CARAMEL" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dzs-Ez-twO">
<rect key="frame" x="80" y="101.5" width="87" height="25.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="Dzs-Ez-twO" secondAttribute="trailing" constant="20" id="8MQ-ZI-ZHb"/>
<constraint firstAttribute="trailing" secondItem="PDD-Zm-9cr" secondAttribute="trailing" constant="20" id="9Ev-aV-nZo"/>
<constraint firstItem="l0b-N1-QSE" firstAttribute="top" secondItem="PDD-Zm-9cr" secondAttribute="bottom" id="AXG-nE-kFs"/>
<constraint firstItem="PDD-Zm-9cr" firstAttribute="top" secondItem="Dzs-Ez-twO" secondAttribute="bottom" id="jYG-hT-q5P"/>
<constraint firstAttribute="bottom" secondItem="gqI-UE-aVc" secondAttribute="bottom" constant="15" id="noz-yo-JpT"/>
<constraint firstAttribute="bottom" secondItem="l0b-N1-QSE" secondAttribute="bottom" constant="15" id="nsC-YQ-yQM"/>
<constraint firstItem="gqI-UE-aVc" firstAttribute="leading" secondItem="l0b-N1-QSE" secondAttribute="trailing" constant="15" id="oVH-EC-ywQ"/>
<constraint firstAttribute="trailing" secondItem="gqI-UE-aVc" secondAttribute="trailing" constant="20" id="sFH-Bq-Sfk"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="e8E-hq-YPY" firstAttribute="leading" secondItem="d5I-Jk-u2e" secondAttribute="leading" id="0Qm-0k-z0A"/>
<constraint firstAttribute="bottom" secondItem="e8E-hq-YPY" secondAttribute="bottom" id="4Rb-kL-rLu"/>
<constraint firstItem="e8E-hq-YPY" firstAttribute="top" secondItem="d5I-Jk-u2e" secondAttribute="top" id="5j8-kh-GHZ"/>
<constraint firstAttribute="bottom" secondItem="FUE-dq-5n6" secondAttribute="bottom" constant="20" id="6k8-eF-uYf"/>
<constraint firstAttribute="trailing" secondItem="FUE-dq-5n6" secondAttribute="trailing" id="Sqx-Vh-hsq"/>
<constraint firstItem="FUE-dq-5n6" firstAttribute="top" secondItem="d5I-Jk-u2e" secondAttribute="top" id="dGf-oG-WVx"/>
<constraint firstAttribute="trailing" secondItem="e8E-hq-YPY" secondAttribute="trailing" id="e21-c1-FBV"/>
<constraint firstItem="FUE-dq-5n6" firstAttribute="width" secondItem="d5I-Jk-u2e" secondAttribute="width" multiplier="0.5" id="jqh-we-QJP"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="d5I-Jk-u2e" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="DF9-Ns-NOe"/>
<constraint firstAttribute="trailing" secondItem="d5I-Jk-u2e" secondAttribute="trailing" id="O7r-5R-oqM"/>
<constraint firstItem="d5I-Jk-u2e" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Xdn-n5-6i6"/>
<constraint firstAttribute="bottom" secondItem="d5I-Jk-u2e" secondAttribute="bottom" id="iZv-pE-RuC"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="16" y="90"/>
</view>
</objects>
<resources>
<image name="test_banner_2" width="375" height="212"/>
</resources>
</document>
//
// KWMRecommendHeader.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@protocol KWMRecommendDelegate <NSObject>
- (void)kwm_onClickProduct:(BUYProduct *)product;
@end
@interface KWMRecommendHeader : UIView<UICollectionViewDataSource,UICollectionViewDelegate>
+ (NSString *)kwmTag;
@property(nonatomic,weak) id<KWMRecommendDelegate> delegate;
@property(nonatomic) NSArray *productArray;
@end
//
// KWMRecommendHeader.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMRecommendHeader.h"
#import "KWMCollectionCell.h"
@interface KWMRecommendHeader()
@property (nonatomic,weak) IBOutlet UIView *vView;
@property (nonatomic,weak) IBOutlet UICollectionView *cvRecommend;
@end
@implementation KWMRecommendHeader
+(NSString *)kwmTag{
return @"KWMRecommendHeader";
}
- (id)init{
if (self=[super init]){
[self addView];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self addView];
}
return self;
}
-(instancetype)initWithFrame:(CGRect)frame{
if (self =[super initWithFrame:frame]) {
[self addView];
}
return self;
}
-(void)addView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self
options:nil];
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
[self initView];
}
-(void)initView{
self.cvRecommend.delegate = self;
self.cvRecommend.dataSource = self;
[self.cvRecommend registerNib:[UINib nibWithNibName:NSStringFromClass([KWMCollectionCell class]) bundle:nil] forCellWithReuseIdentifier:NSStringFromClass([KWMCollectionCell class])];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 0;
layout.sectionInset = UIEdgeInsetsMake(0, 20, 0, 0);
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.cvRecommend.collectionViewLayout = layout;
}
-(void)setProductArray:(NSArray *)productArray{
_productArray = productArray;
[self.cvRecommend reloadData];
}
#pragma mark - UICollectionViewDataSource
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
KWMCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMCollectionCell class]) forIndexPath:indexPath];
BUYProduct *product = [self.productArray objectAtIndex:indexPath.row];
[cell setData:product];
return cell;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGSize size = CGSizeMake(134, 180);
return size;
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.productArray?self.productArray.count:0;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
BUYProduct *product = [self.productArray objectAtIndex:indexPath.row];
if(self.delegate){
[self.delegate kwm_onClickProduct:product];
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMRecommendHeader">
<connections>
<outlet property="cvRecommend" destination="YkQ-i0-Pi8" id="k1I-3x-9pe"/>
<outlet property="vView" destination="iN0-l3-epB" id="4mj-ET-3eS"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="230"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="INK-4h-HDz" userLabel="主推单品title view">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Oxh-Z4-5Du">
<rect key="frame" x="97.5" y="24.5" width="40" height="1"/>
<color key="backgroundColor" red="0.84705882349999995" green="0.85882352939999995" blue="0.87058823529999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="dN7-5L-uPZ"/>
<constraint firstAttribute="width" constant="40" id="u4w-ir-uYu"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fhz-dH-m9M">
<rect key="frame" x="237.5" y="24.5" width="40" height="1"/>
<color key="backgroundColor" red="0.84705882349999995" green="0.85882352939999995" blue="0.87058823529999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="Q9Q-rN-rC2"/>
<constraint firstAttribute="height" constant="1" id="mTX-4g-wc5"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="主推单品" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7Fq-VX-XvA">
<rect key="frame" x="159.5" y="15" width="56" height="20"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="14"/>
<color key="textColor" red="0.31764705879999999" green="0.31764705879999999" blue="0.31764705879999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="7Fq-VX-XvA" firstAttribute="centerY" secondItem="INK-4h-HDz" secondAttribute="centerY" id="GUe-O7-zhD"/>
<constraint firstItem="Oxh-Z4-5Du" firstAttribute="centerY" secondItem="INK-4h-HDz" secondAttribute="centerY" id="ITn-hx-4NT"/>
<constraint firstItem="Fhz-dH-m9M" firstAttribute="centerY" secondItem="INK-4h-HDz" secondAttribute="centerY" id="Kf2-Pe-l0z"/>
<constraint firstItem="7Fq-VX-XvA" firstAttribute="centerX" secondItem="INK-4h-HDz" secondAttribute="centerX" id="dYW-od-kCg"/>
<constraint firstItem="Fhz-dH-m9M" firstAttribute="centerX" secondItem="INK-4h-HDz" secondAttribute="centerX" constant="70" id="i4I-Eo-hi5"/>
<constraint firstItem="Oxh-Z4-5Du" firstAttribute="centerX" secondItem="INK-4h-HDz" secondAttribute="centerX" constant="-70" id="i8R-P6-nyJ"/>
<constraint firstAttribute="height" constant="50" id="oy0-m9-5BJ"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="34o-As-5pe" userLabel="主推单品view">
<rect key="frame" x="0.0" y="50" width="375" height="180"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="YkQ-i0-Pi8">
<rect key="frame" x="0.0" y="0.0" width="375" height="180"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="vfk-q0-t1d">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
</collectionView>
</subviews>
<constraints>
<constraint firstItem="YkQ-i0-Pi8" firstAttribute="top" secondItem="34o-As-5pe" secondAttribute="top" id="4Qd-a8-3pl"/>
<constraint firstItem="YkQ-i0-Pi8" firstAttribute="leading" secondItem="34o-As-5pe" secondAttribute="leading" id="bgA-TL-ipu"/>
<constraint firstAttribute="height" constant="180" id="onq-ka-ELe"/>
<constraint firstAttribute="bottom" secondItem="YkQ-i0-Pi8" secondAttribute="bottom" id="r6l-pn-vDm"/>
<constraint firstAttribute="trailing" secondItem="YkQ-i0-Pi8" secondAttribute="trailing" id="tpm-sS-9NT"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="INK-4h-HDz" secondAttribute="trailing" id="1cJ-MT-eT0"/>
<constraint firstItem="INK-4h-HDz" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="98o-Bp-hPz"/>
<constraint firstItem="34o-As-5pe" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="ALu-k7-LMK"/>
<constraint firstItem="INK-4h-HDz" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Tbg-nl-U5C"/>
<constraint firstAttribute="trailing" secondItem="34o-As-5pe" secondAttribute="trailing" id="m0q-mr-OrX"/>
<constraint firstItem="34o-As-5pe" firstAttribute="top" secondItem="INK-4h-HDz" secondAttribute="bottom" id="p0w-Sf-0ew"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="34.5" y="107"/>
</view>
</objects>
</document>
//
// KWMNewHomeVC.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBaseVC.h"
#import "KWMSearchBar.h"
#import <CHTCollectionViewWaterfallLayout.h>
#import "KWMAdHeader.h"
#import "KWMMenuHeader.h"
#import "KWMRecommendHeader.h"
#import "KWMClothingSetsHeader.h"
#import "KWMHotSalesHeader.h"
@interface KWMNewHomeVC : KWMBaseVC<CHTCollectionViewDelegateWaterfallLayout,UICollectionViewDataSource,KWMSearchBarDelegate,KWMAdDelegate,KWMMenuDelegate,KWMRecommendDelegate,KWMClothingSetsDelegate,KWMHotSalesDelegate>
@end
//
// KWMNewHomeVC.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/10.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMNewHomeVC.h"
#import "KWMShopCartVC.h"
#import "KWMNewHomeCell.h"
#import "KWMSearchBar.h"
#import "KWMHomeData.h"
#import "KWMShoppingCart.h"
typedef enum{
HeaderAd=0,
HeaderMenu=1,
HeaderRecommend=2,
HeaderClothingSets=3,
HeaderHotSales=4,
}Header;
@interface KWMNewHomeVC ()
@property(nonatomic,weak) IBOutlet UICollectionView *cvHome;
@property(nonatomic,strong) KWMAdHeader *adHeader;
@property(nonatomic,strong) KWMMenuHeader *menuHeader;
@property(nonatomic,strong) KWMRecommendHeader *recommendHeader;
@property(nonatomic,strong) KWMClothingSetsHeader *clothingSetsHeader;
@property(nonatomic,strong) KWMHotSalesHeader *hotSalesHeader;
@property(nonatomic,strong) KWMSearchBar *titleView;
@property(nonatomic) KWMHomeData *homeData;
@property(nonatomic) NSArray<BUYProduct *>* productArray;
@end
@implementation KWMNewHomeVC
- (void)viewDidLoad {
[super viewDidLoad];
[self initView];
[self requestProduct:@""];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if(self.adHeader){
[self.adHeader startBannerTimer];
}
if(self.hotSalesHeader){
[self.hotSalesHeader startBannerTimer];
}
[self.navigationController setNavigationBarHidden:YES];
if (self.titleView) {
NSInteger count = [[KWMShoppingCart sharedInstance] count].integerValue;
self.titleView.count = count;
[self.titleView resumeView];
}
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
if(self.adHeader){
[self.adHeader endBannerTimer];
}
if(self.hotSalesHeader){
[self.hotSalesHeader endBannerTimer];
}
}
- (void)initTestData{
KWMHomeData *homeData = [KWMHomeData new];
KWMHotSales *hotSales = [KWMHotSales new];
hotSales.singleShowCount = @(3);
KWMAdvertisement *clothingSets = [KWMAdvertisement new];
clothingSets.image = @"http://o42yton8r.qnssl.com/s/files/1/1089/5284/collections/b_8d773a6f-6a70-4d15-a280-e4dd13a7a744_large.jpg?v=1464083899";
clothingSets.url = @"http://www.baidu.com";
clothingSets.title = @"boy";
NSMutableArray *adBanner = [NSMutableArray array];
[adBanner addObject:[clothingSets copy]];
[adBanner addObject:[clothingSets copy]];
[adBanner addObject:[clothingSets copy]];
homeData.hotSales = hotSales;
homeData.clothingSets = clothingSets;
homeData.adBanner = adBanner;
self.homeData = homeData;
[self initData];
}
- (void)initData{
if(self.homeData){
self.adHeader.adArray = self.homeData.adBanner;
self.recommendHeader.productArray = self.productArray;
self.clothingSetsHeader.productArray = self.productArray;
self.clothingSetsHeader.headerImage = self.homeData.clothingSets.image;
NSMutableArray *testArray = [NSMutableArray array];
[testArray addObject:[self.productArray objectAtIndex:0]];
[testArray addObject:[self.productArray objectAtIndex:1]];
[testArray addObject:[self.productArray objectAtIndex:2]];
self.hotSalesHeader.singleShowArray = testArray;
self.hotSalesHeader.bannerArray = testArray;
[self.cvHome reloadData];
}
}
- (void)initView{
self.title = @"首页";
self.adHeader = [[KWMAdHeader alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 275)];
self.menuHeader = [[KWMMenuHeader alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 100)];
self.recommendHeader = [[KWMRecommendHeader alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 230)];
self.clothingSetsHeader = [[KWMClothingSetsHeader alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 310)];
self.hotSalesHeader = [[KWMHotSalesHeader alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, 250)];
self.adHeader.delegate = self;
self.menuHeader.delegate = self;
self.recommendHeader.delegate = self;
self.clothingSetsHeader.delegate = self;
self.hotSalesHeader.delegate = self;
[self initTitleView];
[self initCollectionView];
}
-(void)initTitleView{
self.titleView = [[KWMSearchBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
self.titleView.delegate = self;
self.titleView.btnSearch.hidden = YES;
[self.view addSubview:self.titleView];
}
- (void)initCollectionView{
CHTCollectionViewWaterfallLayout *layout = [[CHTCollectionViewWaterfallLayout alloc] init];
layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
layout.minimumColumnSpacing = 10;
layout.minimumInteritemSpacing = 10;
layout.columnCount = 2;
self.cvHome.collectionViewLayout = layout;
[self.cvHome registerNib:[UINib nibWithNibName:NSStringFromClass([KWMNewHomeCell class]) bundle:nil] forCellWithReuseIdentifier:NSStringFromClass([KWMNewHomeCell class])];
[self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMAdHeader kwmTag]];
[self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMHotSalesHeader kwmTag]];
[self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMRecommendHeader kwmTag]];
[self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMClothingSetsHeader kwmTag]];
[self.cvHome registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMMenuHeader kwmTag]];
}
#pragma mark - KWMAdDelegate
-(void)kwm_gotoWebView:(NSString *)url{
}
#pragma mark - KWMMenuDelegate
-(void)kwm_onClickHotMenu{
}
-(void)kwm_onClickNewMenu{
}
-(void)kwm_onClickWishMenu{
}
-(void)kwm_onClickDeliveryMenu{
}
#pragma makr - KWMRecommendDelegate KWMClothingSetsDelegate KWMHotSalesDelegate
-(void)kwm_onClickProduct:(BUYProduct *)product{
}
#pragma mark - UICollectionViewDataSource
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 5;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
if(section == HeaderHotSales){
return self.productArray ? self.productArray.count:0;
}
return 0;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
KWMNewHomeCell *homeCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMNewHomeCell class]) forIndexPath:indexPath];
return homeCell;
}
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
UICollectionReusableView *headerView;
if (kind == CHTCollectionElementKindSectionHeader) {
switch (indexPath.section) {
case HeaderAd:
headerView = [collectionView dequeueReusableSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMAdHeader kwmTag] forIndexPath:indexPath];
if(headerView.subviews.count == 0){
[headerView addSubview:self.adHeader];
}
break;
case HeaderMenu:
headerView = [collectionView dequeueReusableSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMMenuHeader kwmTag] forIndexPath:indexPath];
if(headerView.subviews.count == 0){
[headerView addSubview:self.menuHeader];
}
break;
case HeaderRecommend:
headerView = [collectionView dequeueReusableSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMRecommendHeader kwmTag] forIndexPath:indexPath];
if(headerView.subviews.count == 0){
[headerView addSubview:self.recommendHeader];
}
break;
case HeaderClothingSets:
headerView = [collectionView dequeueReusableSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMClothingSetsHeader kwmTag] forIndexPath:indexPath];
if(headerView.subviews.count == 0){
[headerView addSubview:self.clothingSetsHeader];
}
break;
case HeaderHotSales:
headerView = [collectionView dequeueReusableSupplementaryViewOfKind:CHTCollectionElementKindSectionHeader withReuseIdentifier:[KWMHotSalesHeader kwmTag] forIndexPath:indexPath];
if(headerView.subviews.count == 0){
[headerView addSubview:self.hotSalesHeader];
}
break;
default:
break;
}
}
return headerView;
}
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout heightForHeaderInSection:(NSInteger)section{
NSInteger height = 0;
switch (section) {
case HeaderAd:
height = 275;
break;
case HeaderMenu:
height = 100;
break;
case HeaderRecommend:
height = 230;
break;
case HeaderClothingSets:
height = 310;
break;
case HeaderHotSales:
height = 250;
break;
default:
break;
}
return height;
}
#pragma mark - CHTCollectionViewDelegateWaterfallLayout
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGSize size = CGSizeMake((UI_SCREEN_WIDTH-30)/2, 230+(indexPath.row * 20));
// CGSize size = CGSizeMake((UI_SCREEN_WIDTH-30), 230+(indexPath.row * 20));
return size;
}
#pragma mark - KWMSearchBarDelegate
- (void)kwm_onClickShopCar{
//购物车
KWMShopCartVC *contactVC = (KWMShopCartVC *)[KWMBaseVC findControllerBy:[KWMShopCartVC kwmTag] fromStoryboard:@"ShopCart"];
[self.navigationController pushViewController:contactVC animated:YES];
}
#pragma makr - api
- (void)requestProduct:(NSString *)tag{
NSMutableArray *tags = nil;
if(tag){
tags = [NSMutableArray array];
[tags addObject:tag];
}
__weak KWMNewHomeVC *weakSelf = self;
[self showLoading];
[self.client getProductsPage:1 inCollection:@(Collection_All_ID) withTags:tags sortOrder:BUYCollectionSortBestSelling completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
[weakSelf hideLoading];
if(error){
[weakSelf showError:error];
}
else if(products && products.count>0){
weakSelf.productArray = products;
[weakSelf.cvHome reloadData];
[weakSelf initTestData];
}
}];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMNewHomeVC">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</objects>
</document>
//
// KWMBannerView.h
// iCemarose
//
// Created by HouWeiBin on 2017/5/31.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <iCarousel/iCarousel.h>
#import "KWMPageControl.h"
@class KWMBannerView;
@protocol KWMBannerViewDelegate <NSObject>
//页面滑动监听
@optional
-(void)bannerView:(KWMBannerView *)bannerView onPageIndexChange:(NSInteger)index;
//更新背景view
-(void)bannerView:(KWMBannerView *)bannerView backgroundView:(UIView *)backgroundView updateBackgroundViewAtIndex:(NSInteger)index;
//更新前景view
-(void)bannerView:(KWMBannerView *)bannerView foregroundView:(UIView *)foregroundView updateForegroundViewAtIndex:(NSInteger)index;
@required
//页面被点击 注意:小心前景view foregroundView挡住事件的情况
-(void)bannerView:(KWMBannerView *)bannerView onClickPage:(NSInteger)index;
//index对应页面view
-(UIView *)bannerView:(KWMBannerView *)bannerView reusingView:(UIView *)reusingView pageAtIndex:(NSInteger)index;
//页数
-(NSInteger)numberOfPagesForBanner:(KWMBannerView *)bannerView;
@end
@interface KWMBannerView : UIView<iCarouselDataSource, iCarouselDelegate>
//backgroundView默认会添加一个,如果不需要定制化,可以直接使用已有的
@property (nonatomic,strong) UIView *backgroundView;
//foregroundView默认会添加一个,如果不需要定制化,可以直接使用已有的
@property (nonatomic,strong) UIView *foregroundView;
@property (nonatomic,assign,readonly) NSInteger pageIndex;
@property(nonatomic,weak) id<KWMBannerViewDelegate> delegate;
-(void)reloadData;
-(void) addTimer;
-(void) removeTimer;
@end
//
// KWMBannerView.m
// iCemarose
//
// Created by HouWeiBin on 2017/5/31.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMBannerView.h"
@implementation KWMBannerView{
iCarousel *carousel;
NSTimer *timer;
BOOL isFirstLoad;
BOOL isScroll;
}
-(void)addTimer{
[self removeTimer];
isFirstLoad = YES;
timer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(doTimer) userInfo:nil repeats:YES];
[timer setFireDate:[NSDate distantPast]];//开启
}
-(void)removeTimer{
//结束
if([timer isValid]){
[timer invalidate];
timer = nil;
}
}
-(void)doTimer{
NSInteger pageCount = self.delegate?[self.delegate numberOfPagesForBanner:self]:0;
if(pageCount > 0 && !isScroll){
if(isFirstLoad){ //避免出现第一次显示就是第二页的情况
isFirstLoad = NO;
return;
}
NSInteger currentIndex = self.pageIndex;
currentIndex ++;
[carousel scrollToItemAtIndex:currentIndex animated:YES];
[self updateUIOnPageChange];
}
}
-(instancetype)init{
self = [super init];
if(self){
}
return self;
}
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self initBannerView:frame];
}
return self;
}
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
self = [super initWithCoder:aDecoder];
if (self) {
[self initBannerView:self.frame];
}
return self;
}
-(void)awakeFromNib{
[super awakeFromNib];
}
-(void)setDelegate:(id<KWMBannerViewDelegate>)delegate{
_delegate = delegate;
if(delegate){
[self reloadData];
}
}
-(void)reloadData{
if(carousel){
[carousel reloadData];
}
if(self.foregroundView && self.foregroundView.tag == 1002){
KWMPageControl *pageControl = (KWMPageControl *)self.foregroundView;
//pageControl圆点右对齐
NSInteger count = self.delegate?[self.delegate numberOfPagesForBanner:self]:0;
CGSize pageControlSize = [pageControl sizeForNumberOfPages:count];
CGFloat paddingLeft = (pageControl.bounds.size.width - pageControlSize.width) / 2 - 15;
[pageControl setBounds:CGRectMake(-paddingLeft, pageControl.bounds.origin.y,
pageControl.bounds.size.width, pageControl.bounds.size.height)];
}
}
-(void)initBannerView:(CGRect)frame{
carousel = [[iCarousel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
carousel.delegate = self;
carousel.dataSource = self;
carousel.decelerationRate = 0.5;
carousel.type = iCarouselTypeLinear;
carousel.clipsToBounds = YES;
[self addSubview:carousel];
UIImageView *noDataImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
noDataImageView.contentMode = UIViewContentModeCenter;
UIImage *noDataImage = [UIImage imageNamed:@"ic_logo"];
noDataImageView.image = noDataImage;
noDataImageView.tag = 1001;//用于判断是否默认背景view
self.backgroundView = noDataImageView;
CGRect pageControlFrame = CGRectMake(0, frame.size.height - 20, frame.size.width, 20);
UIImage *defaultImage = [UIImage imageNamed:@"ic_page_1"];
UIImage *currentImage = [UIImage imageNamed:@"ic_page_2"];
KWMPageControl *pageControl = [[KWMPageControl alloc]initWithFrame:pageControlFrame currentImage:currentImage andDefaultImage:defaultImage];
pageControl.numberOfPages = 4;
pageControl.currentPage = 0;
pageControl.tag = 1002;//用于判断是否默认前景view
self.foregroundView = pageControl;
}
-(NSInteger)pageIndex{
if(carousel){
return carousel.currentItemIndex;
}
return 0;
}
-(void)setBackgroundView:(UIView *)backgroundView{
_backgroundView = backgroundView;
UIView *oldBackgroundView = [self viewWithTag:101];
if(oldBackgroundView){
[oldBackgroundView removeFromSuperview];
}
oldBackgroundView = [self viewWithTag:1001];
if(oldBackgroundView){
[oldBackgroundView removeFromSuperview];
}
if(backgroundView){
backgroundView.tag = 101;
[self addSubview:backgroundView];
[self sendSubviewToBack:backgroundView];
}
}
-(void)setForegroundView:(UIView *)foregroundView{
_foregroundView = foregroundView;
UIView *oldForegroundView = [self viewWithTag:102];
if(oldForegroundView){
[oldForegroundView removeFromSuperview];
}
oldForegroundView = [self viewWithTag:1002];
if(oldForegroundView){
[oldForegroundView removeFromSuperview];
}
if(foregroundView){
//设置tag前先判断是否默认foregroundView,以免覆盖了tag
foregroundView.tag = foregroundView.tag == 1002?1002:102;
[self addSubview:foregroundView];
[self bringSubviewToFront:foregroundView];
}
}
-(void)updateUIOnPageChange{
if(self.foregroundView && self.foregroundView.tag == 1002){
KWMPageControl *pageControl = (KWMPageControl *)self.foregroundView;
pageControl.currentPage = self.pageIndex;
}
if(self.delegate){
if([self.delegate respondsToSelector:@selector(bannerView:onPageIndexChange:)]){
[self.delegate bannerView:self onPageIndexChange:self.pageIndex];
}
if([self.delegate respondsToSelector:@selector(bannerView:backgroundView:updateBackgroundViewAtIndex:)]
&& self.backgroundView){
[self.delegate bannerView:self backgroundView:self.backgroundView updateBackgroundViewAtIndex:self.pageIndex];
}
if([self.delegate respondsToSelector:@selector(bannerView:foregroundView:updateForegroundViewAtIndex:)]
&& self.foregroundView){
[self.delegate bannerView:self foregroundView:self.backgroundView updateForegroundViewAtIndex:self.pageIndex];
}
}
}
#pragma mark iCarousel methods
- (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
if(self.delegate){
return [self.delegate numberOfPagesForBanner:self];
}
return 0;
}
- (NSUInteger)numberOfVisibleItemsInCarousel:(iCarousel *)carousel
{
return 3;
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view{
if(self.delegate){
return [self.delegate bannerView:self reusingView:view pageAtIndex:index];
}
return nil;
}
-(void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index{
if(self.delegate){
[self.delegate bannerView:self onClickPage:index];
}
}
- (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate{
[self updateUIOnPageChange];
}
- (void)carouselDidEndDecelerating:(iCarousel *)carousel{
[self updateUIOnPageChange];
}
- (CGFloat)carouselItemWidth:(iCarousel *)carousel
{
return self.frame.size.width;
}
-(void)carouselDidEndScrollingAnimation:(iCarousel *)carousel{
isScroll = NO;
}
-(void)carouselDidScroll:(iCarousel *)carousel{
isScroll = YES;
}
- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
{
switch (option)
{
case iCarouselOptionWrap:
{
return YES;
}
default:
{
return value;
}
}
}
@end
......@@ -104,6 +104,9 @@
#define BigImage 3
//collection all的id
#define Collection_All_ID 191372166
//默认欧元汇率,如果安装后第一次请求最新汇率数据失败,会使用该汇率显示价格
//#define ExchangeRate 7.6625
//#define ExchangeRateString @"7.6625"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment