Commit 8183aac2 by houweibin

1,新商品筛选

2,删去和优化部分代码。
parent 3030a13a
......@@ -183,6 +183,7 @@
C066650C1D75A2E500F02EF4 /* Mine.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C06665081D75A2E500F02EF4 /* Mine.storyboard */; };
C066650F1D7675FC00F02EF4 /* KWMAboutUsVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C066650E1D7675FC00F02EF4 /* KWMAboutUsVC.m */; };
C06665121D767A0A00F02EF4 /* KWMContactUsVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C06665111D767A0A00F02EF4 /* KWMContactUsVC.m */; };
C077966F1EEAA2BE00CD6859 /* KWMFilterUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = C077966E1EEAA2BE00CD6859 /* KWMFilterUtil.m */; };
C084F4531D6D8CA700A0625D /* KWMBlogCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C084F4511D6D8CA700A0625D /* KWMBlogCell.m */; };
C084F4541D6D8CA700A0625D /* KWMBlogCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C084F4521D6D8CA700A0625D /* KWMBlogCell.xib */; };
C084F4571D6D975400A0625D /* KWMSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = C084F4561D6D975400A0625D /* KWMSearchBar.m */; };
......@@ -207,6 +208,18 @@
C0CC14161D79826F007B5986 /* KWMAddressCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CC14141D79826F007B5986 /* KWMAddressCell.m */; };
C0CC14171D79826F007B5986 /* KWMAddressCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0CC14151D79826F007B5986 /* KWMAddressCell.xib */; };
C0CC141A1D79847A007B5986 /* KWMSelectAddressVC.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CC14191D79847A007B5986 /* KWMSelectAddressVC.m */; };
C0CCB3B91EEA579900BC2FB8 /* KWMFilterView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CCB3B71EEA579900BC2FB8 /* KWMFilterView.m */; };
C0CCB3BA1EEA579900BC2FB8 /* KWMFilterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0CCB3B81EEA579900BC2FB8 /* KWMFilterView.xib */; };
C0CCB3BD1EEA589200BC2FB8 /* KWMFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CCB3BC1EEA589200BC2FB8 /* KWMFilter.m */; };
C0CCB3C11EEA59A200BC2FB8 /* KWMFilterViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CCB3BF1EEA59A200BC2FB8 /* KWMFilterViewCell.m */; };
C0CCB3C21EEA59A200BC2FB8 /* KWMFilterViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0CCB3C01EEA59A200BC2FB8 /* KWMFilterViewCell.xib */; };
C0CCB3C51EEA5A1100BC2FB8 /* UIView+Prettify.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CCB3C41EEA5A1100BC2FB8 /* UIView+Prettify.m */; };
C0CCB3CF1EEA765B00BC2FB8 /* KWMFilterTabItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CCB3C71EEA765B00BC2FB8 /* KWMFilterTabItem.m */; };
C0CCB3D01EEA765B00BC2FB8 /* KWMFilterTabItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0CCB3C81EEA765B00BC2FB8 /* KWMFilterTabItem.xib */; };
C0CCB3D11EEA765B00BC2FB8 /* KWMNormalFilterTab.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CCB3CA1EEA765B00BC2FB8 /* KWMNormalFilterTab.m */; };
C0CCB3D21EEA765B00BC2FB8 /* KWMNormalFilterTab.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0CCB3CB1EEA765B00BC2FB8 /* KWMNormalFilterTab.xib */; };
C0CCB3D31EEA765B00BC2FB8 /* KWMNormalFilterView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0CCB3CD1EEA765B00BC2FB8 /* KWMNormalFilterView.m */; };
C0CCB3D41EEA765B00BC2FB8 /* KWMNormalFilterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0CCB3CE1EEA765B00BC2FB8 /* KWMNormalFilterView.xib */; };
C0D7CA9E1EA7384E005AE3A3 /* KWMPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = C08827A51E28B4AF006A8B91 /* KWMPageControl.m */; };
C0D7CAA11EA843AD005AE3A3 /* KWMOrder.m in Sources */ = {isa = PBXBuildFile; fileRef = C0D7CAA01EA843AD005AE3A3 /* KWMOrder.m */; };
C0D7CAA41EA846AA005AE3A3 /* KWMOrdersResult.m in Sources */ = {isa = PBXBuildFile; fileRef = C0D7CAA31EA846AA005AE3A3 /* KWMOrdersResult.m */; };
......@@ -605,6 +618,8 @@
C066650E1D7675FC00F02EF4 /* KWMAboutUsVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMAboutUsVC.m; sourceTree = "<group>"; };
C06665101D767A0A00F02EF4 /* KWMContactUsVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMContactUsVC.h; sourceTree = "<group>"; };
C06665111D767A0A00F02EF4 /* KWMContactUsVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMContactUsVC.m; sourceTree = "<group>"; };
C077966D1EEAA2BE00CD6859 /* KWMFilterUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMFilterUtil.h; sourceTree = "<group>"; };
C077966E1EEAA2BE00CD6859 /* KWMFilterUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMFilterUtil.m; sourceTree = "<group>"; };
C084F4501D6D8CA700A0625D /* KWMBlogCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMBlogCell.h; sourceTree = "<group>"; };
C084F4511D6D8CA700A0625D /* KWMBlogCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMBlogCell.m; sourceTree = "<group>"; };
C084F4521D6D8CA700A0625D /* KWMBlogCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMBlogCell.xib; sourceTree = "<group>"; };
......@@ -646,6 +661,25 @@
C0CC14151D79826F007B5986 /* KWMAddressCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMAddressCell.xib; sourceTree = "<group>"; };
C0CC14181D79847A007B5986 /* KWMSelectAddressVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMSelectAddressVC.h; sourceTree = "<group>"; };
C0CC14191D79847A007B5986 /* KWMSelectAddressVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMSelectAddressVC.m; sourceTree = "<group>"; };
C0CCB3B61EEA579900BC2FB8 /* KWMFilterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMFilterView.h; sourceTree = "<group>"; };
C0CCB3B71EEA579900BC2FB8 /* KWMFilterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMFilterView.m; sourceTree = "<group>"; };
C0CCB3B81EEA579900BC2FB8 /* KWMFilterView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMFilterView.xib; sourceTree = "<group>"; };
C0CCB3BB1EEA589200BC2FB8 /* KWMFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMFilter.h; sourceTree = "<group>"; };
C0CCB3BC1EEA589200BC2FB8 /* KWMFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMFilter.m; sourceTree = "<group>"; };
C0CCB3BE1EEA59A200BC2FB8 /* KWMFilterViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMFilterViewCell.h; sourceTree = "<group>"; };
C0CCB3BF1EEA59A200BC2FB8 /* KWMFilterViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMFilterViewCell.m; sourceTree = "<group>"; };
C0CCB3C01EEA59A200BC2FB8 /* KWMFilterViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMFilterViewCell.xib; sourceTree = "<group>"; };
C0CCB3C31EEA5A1100BC2FB8 /* UIView+Prettify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Prettify.h"; sourceTree = "<group>"; };
C0CCB3C41EEA5A1100BC2FB8 /* UIView+Prettify.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Prettify.m"; sourceTree = "<group>"; };
C0CCB3C61EEA765B00BC2FB8 /* KWMFilterTabItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMFilterTabItem.h; sourceTree = "<group>"; };
C0CCB3C71EEA765B00BC2FB8 /* KWMFilterTabItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMFilterTabItem.m; sourceTree = "<group>"; };
C0CCB3C81EEA765B00BC2FB8 /* KWMFilterTabItem.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMFilterTabItem.xib; sourceTree = "<group>"; };
C0CCB3C91EEA765B00BC2FB8 /* KWMNormalFilterTab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMNormalFilterTab.h; sourceTree = "<group>"; };
C0CCB3CA1EEA765B00BC2FB8 /* KWMNormalFilterTab.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMNormalFilterTab.m; sourceTree = "<group>"; };
C0CCB3CB1EEA765B00BC2FB8 /* KWMNormalFilterTab.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMNormalFilterTab.xib; sourceTree = "<group>"; };
C0CCB3CC1EEA765B00BC2FB8 /* KWMNormalFilterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMNormalFilterView.h; sourceTree = "<group>"; };
C0CCB3CD1EEA765B00BC2FB8 /* KWMNormalFilterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMNormalFilterView.m; sourceTree = "<group>"; };
C0CCB3CE1EEA765B00BC2FB8 /* KWMNormalFilterView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMNormalFilterView.xib; sourceTree = "<group>"; };
C0D7CA9F1EA843AD005AE3A3 /* KWMOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMOrder.h; sourceTree = "<group>"; };
C0D7CAA01EA843AD005AE3A3 /* KWMOrder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMOrder.m; sourceTree = "<group>"; };
C0D7CAA21EA846AA005AE3A3 /* KWMOrdersResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMOrdersResult.h; sourceTree = "<group>"; };
......@@ -1077,6 +1111,8 @@
C0D7CAA01EA843AD005AE3A3 /* KWMOrder.m */,
9BE61CFC1ECD66BC0031D21E /* KWMShoppingCart.h */,
9BE61CFD1ECD66BC0031D21E /* KWMShoppingCart.m */,
C0CCB3BB1EEA589200BC2FB8 /* KWMFilter.h */,
C0CCB3BC1EEA589200BC2FB8 /* KWMFilter.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -1108,6 +1144,8 @@
C034E6C41D6AECF9006EE129 /* Util */ = {
isa = PBXGroup;
children = (
C077966D1EEAA2BE00CD6859 /* KWMFilterUtil.h */,
C077966E1EEAA2BE00CD6859 /* KWMFilterUtil.m */,
C02C7D991E642DED008DC29C /* KWMWeChatUtil.h */,
C02C7D9A1E642DED008DC29C /* KWMWeChatUtil.m */,
C034E6D01D6AEF1B006EE129 /* KWMImageUtil.h */,
......@@ -1157,6 +1195,8 @@
801230F41DD32B39008C7904 /* KWMInformationView.h */,
801230F51DD32B39008C7904 /* KWMInformationView.m */,
801230F71DD32B49008C7904 /* KWMInformationView.xib */,
C0CCB3C31EEA5A1100BC2FB8 /* UIView+Prettify.h */,
C0CCB3C41EEA5A1100BC2FB8 /* UIView+Prettify.m */,
);
path = View;
sourceTree = "<group>";
......@@ -1645,6 +1685,21 @@
C0CCB3B51EEA520C00BC2FB8 /* FilterView */ = {
isa = PBXGroup;
children = (
C0CCB3BE1EEA59A200BC2FB8 /* KWMFilterViewCell.h */,
C0CCB3BF1EEA59A200BC2FB8 /* KWMFilterViewCell.m */,
C0CCB3C01EEA59A200BC2FB8 /* KWMFilterViewCell.xib */,
C0CCB3B61EEA579900BC2FB8 /* KWMFilterView.h */,
C0CCB3B71EEA579900BC2FB8 /* KWMFilterView.m */,
C0CCB3B81EEA579900BC2FB8 /* KWMFilterView.xib */,
C0CCB3C61EEA765B00BC2FB8 /* KWMFilterTabItem.h */,
C0CCB3C71EEA765B00BC2FB8 /* KWMFilterTabItem.m */,
C0CCB3C81EEA765B00BC2FB8 /* KWMFilterTabItem.xib */,
C0CCB3C91EEA765B00BC2FB8 /* KWMNormalFilterTab.h */,
C0CCB3CA1EEA765B00BC2FB8 /* KWMNormalFilterTab.m */,
C0CCB3CB1EEA765B00BC2FB8 /* KWMNormalFilterTab.xib */,
C0CCB3CC1EEA765B00BC2FB8 /* KWMNormalFilterView.h */,
C0CCB3CD1EEA765B00BC2FB8 /* KWMNormalFilterView.m */,
C0CCB3CE1EEA765B00BC2FB8 /* KWMNormalFilterView.xib */,
);
path = FilterView;
sourceTree = "<group>";
......@@ -1918,6 +1973,7 @@
C0CC14091D7823B0007B5986 /* KWMSizeCell.xib in Resources */,
8091DFAE1D6EA6DC0020519C /* KWMFirstView.xib in Resources */,
C02C7DB51E67B56D008DC29C /* KWMFilterHeaderView.xib in Resources */,
C0CCB3D21EEA765B00BC2FB8 /* KWMNormalFilterTab.xib in Resources */,
C034E8671D6B10A0006EE129 /* PhotoItemView.xib in Resources */,
C0DD533A1EE55190002D1E0C /* KWMSplashView.xib in Resources */,
8091DFA31D6E8CCA0020519C /* Guide.storyboard in Resources */,
......@@ -1935,11 +1991,13 @@
C034E6EB1D6AF0A0006EE129 /* Localizable.strings in Resources */,
C0F586AE1E279574001248E2 /* KWMBottomView.xib in Resources */,
C0392DBA1DCC38450051AC8E /* KWMShippingCell.xib in Resources */,
C0CCB3D01EEA765B00BC2FB8 /* KWMFilterTabItem.xib in Resources */,
80DD275B1DC2FE6800CDC5B5 /* Home.storyboard in Resources */,
80A611AF1D6DB0CD00709E09 /* ShopCart.storyboard in Resources */,
C02C7D811E640D82008DC29C /* README.txt in Resources */,
C0DD531F1EE54F5D002D1E0C /* KWMMineTitleView.xib in Resources */,
C034E8531D6B10A0006EE129 /* CoreSDWebImage.bundle in Resources */,
C0CCB3D41EEA765B00BC2FB8 /* KWMNormalFilterView.xib in Resources */,
C066650A1D75A2E500F02EF4 /* KWMOrderCell.xib in Resources */,
8091DFB81D6EC1C60020519C /* KWMThreeView.xib in Resources */,
8091DFB01D6EAD6F0020519C /* KWMSecondView.xib in Resources */,
......@@ -1955,6 +2013,8 @@
C0CC14051D7823B0007B5986 /* KWMDeleteView.xib in Resources */,
C034E6981D6AEB12006EE129 /* Main.storyboard in Resources */,
C0CC14071D7823B0007B5986 /* KWMShopCarCell.xib in Resources */,
C0CCB3BA1EEA579900BC2FB8 /* KWMFilterView.xib in Resources */,
C0CCB3C21EEA59A200BC2FB8 /* KWMFilterViewCell.xib in Resources */,
C0CC14171D79826F007B5986 /* KWMAddressCell.xib in Resources */,
804771821D6D32A70086B4DC /* Login.storyboard in Resources */,
C0DD53241EE55062002D1E0C /* KWMCarCountView.xib in Resources */,
......@@ -2051,6 +2111,7 @@
C0F586871E24F820001248E2 /* KWMNewTypeSelectedVC.m in Sources */,
80598D471D99193400BF0F97 /* KWMInformationVC.m in Sources */,
C034E7B91D6B0A8D006EE129 /* KWMHomeVC.m in Sources */,
C0CCB3BD1EEA589200BC2FB8 /* KWMFilter.m in Sources */,
C0F5868F1E24F821001248E2 /* SVerticalView.m in Sources */,
801F87BC1DD1A9B90038FA4C /* KWMNewProducts.m in Sources */,
C0CC14061D7823B0007B5986 /* KWMShopCarCell.m in Sources */,
......@@ -2075,8 +2136,10 @@
C0392DB91DCC38450051AC8E /* KWMShippingCell.m in Sources */,
C02C7DA31E66AA97008DC29C /* KWMFilterVC.m in Sources */,
C034E8681D6B10A0006EE129 /* PhotoBroswerVC.m in Sources */,
C0CCB3D31EEA765B00BC2FB8 /* KWMNormalFilterView.m in Sources */,
8091DFB31D6EADE60020519C /* KWMSecondView.m in Sources */,
C034E8501D6B10A0006EE129 /* UIView+Extend.m in Sources */,
C0CCB3CF1EEA765B00BC2FB8 /* KWMFilterTabItem.m in Sources */,
80ED0A4C1D93B99E00B28DF2 /* KWMShopCartData.m in Sources */,
C034E85C1D6B10A0006EE129 /* UIView+PBExtend.m in Sources */,
C0F5867E1E24F820001248E2 /* KWMNewGoodsCell.m in Sources */,
......@@ -2114,6 +2177,7 @@
C0F5869B1E25D05F001248E2 /* KWMProductDetailView.m in Sources */,
C06665091D75A2E500F02EF4 /* KWMOrderCell.m in Sources */,
C0DD53141EE54B96002D1E0C /* KWMSearchBrandView.m in Sources */,
C0CCB3C51EEA5A1100BC2FB8 /* UIView+Prettify.m in Sources */,
C034E8621D6B10A0006EE129 /* PBPGView.m in Sources */,
C02C7DB41E67B56D008DC29C /* KWMFilterHeaderView.m in Sources */,
80ED0A371D93840A00B28DF2 /* DB_shopCart.xcdatamodeld in Sources */,
......@@ -2127,6 +2191,7 @@
C0FC278E1D9B73B000C5CFFE /* KWMGiftCardCell.m in Sources */,
8077F79A1D73E39000A2E2E2 /* KWMBrandCaramelCell.m in Sources */,
9BE61D011ECD71610031D21E /* KWMCartResult.m in Sources */,
C0CCB3C11EEA59A200BC2FB8 /* KWMFilterViewCell.m in Sources */,
C084F4571D6D975400A0625D /* KWMSearchBar.m in Sources */,
C0DD534D1EE6AE06002D1E0C /* BaseCell.m in Sources */,
C0E8AE091D7D030B00C193DC /* KWMEditAddressVC.m in Sources */,
......@@ -2170,6 +2235,7 @@
807AF4A81DC984950000A326 /* KWMSearchResult.m in Sources */,
C0DD533B1EE55190002D1E0C /* KWMSuperLoadingView.m in Sources */,
C034E85D1D6B10A0006EE129 /* PBConst.m in Sources */,
C0CCB3D11EEA765B00BC2FB8 /* KWMNormalFilterTab.m in Sources */,
C0CC140F1D7926DF007B5986 /* KWMBeforePayVC.m in Sources */,
C034E8441D6B10A0006EE129 /* NSObject+Extend.m in Sources */,
80A611B21D6DB0EC00709E09 /* KWMShopCartVC.m in Sources */,
......@@ -2180,8 +2246,10 @@
C034E6DA1D6AEF1B006EE129 /* KWMTextFieldUtil.m in Sources */,
C0F5868D1E24F821001248E2 /* SHorizontalView.m in Sources */,
C034E7041D6AF205006EE129 /* RTSpinKitView.m in Sources */,
C0CCB3B91EEA579900BC2FB8 /* KWMFilterView.m in Sources */,
C05910941E34A729002990B3 /* KWMNewGiftCardCell.m in Sources */,
C034E8411D6B10A0006EE129 /* CALayer+Transition.m in Sources */,
C077966F1EEAA2BE00CD6859 /* KWMFilterUtil.m in Sources */,
C034E8631D6B10A0006EE129 /* PBSaveBtn.m in Sources */,
807AF4A71DC984950000A326 /* KWMProducts.m in Sources */,
C0F5868A1E24F820001248E2 /* KWMSelectedGoodsVC.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_down@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_down@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// KWMBrandsImage.h
// iCemarose
//
// Created by 陈荣科 on 2016/11/8.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWMBaseModel.h"
@interface KWMBrandsImage : KWMBaseModel
@property (nonatomic) NSString *handle;
@property (nonatomic) NSDictionary *image;
@property (nonatomic) NSString *title;
- (NSString *)getImageScr;
@end
//
// KWMBrandsImage.m
// iCemarose
//
// Created by 陈荣科 on 2016/11/8.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWMBrandsImage.h"
@implementation KWMBrandsImage
- (NSString *)getImageScr{
return [_image objectForKey:@"scr"];
}
@end
//
// KWMFilter.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/7.
// Copyright © 2017年 kollway. All rights reserved.
//
// 筛选model
//
#import <JSONModel/JSONModel.h>
#import <Foundation/Foundation.h>
@interface KWMFilter : KWMBaseModel
//filter tag group name
@property (nonatomic) NSString *group;
//tags
@property(nonatomic) NSMutableArray<NSString *> *tags;
@end
//
// KWMFilter.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/7.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMFilter.h"
@implementation KWMFilter
@end
......@@ -7,6 +7,7 @@
//
#import <JSONModel/JSONModel.h>
#import "KWMBaseModel.h"
@interface KWMOrder : KWMBaseModel
......
......@@ -21,8 +21,8 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="IcS-3H-XUB">
<rect key="frame" x="0.0" y="74" width="375" height="593"/>
<tableView contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="IcS-3H-XUB">
<rect key="frame" x="0.0" y="104" width="375" height="563"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<view key="tableHeaderView" clipsSubviews="YES" contentMode="scaleToFill" id="m0g-lT-Bac">
<rect key="frame" x="0.0" y="0.0" width="375" height="210"/>
......@@ -38,7 +38,7 @@
<constraint firstAttribute="height" constant="210" id="o7z-ZG-ytp"/>
</constraints>
</view>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="09X-K0-Zki">
<textView hidden="YES" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="09X-K0-Zki">
<rect key="frame" x="0.0" y="251" width="375" height="128"/>
<constraints>
<constraint firstAttribute="height" constant="128" id="ibt-xg-ahc"/>
......@@ -48,7 +48,7 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" alpha="0.5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lgS-Wb-cuc">
<button hidden="YES" opaque="NO" alpha="0.5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lgS-Wb-cuc">
<rect key="frame" x="0.0" y="190" width="375" height="20"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
......@@ -83,10 +83,6 @@
<outlet property="delegate" destination="eiC-Xl-2es" id="dM4-Gw-Ouq"/>
</connections>
</tableView>
<view hidden="YES" alpha="0.29999999999999999" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hkC-I1-C67">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="evT-5t-rty">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<subviews>
......@@ -108,7 +104,7 @@
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.95686274509803915" green="0.96078431372549022" blue="0.96862745098039216" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="R23-SN-2Bb" firstAttribute="centerX" secondItem="evT-5t-rty" secondAttribute="centerX" id="A4k-v1-iTU"/>
<constraint firstItem="R23-SN-2Bb" firstAttribute="top" secondItem="hEs-Nl-jTX" secondAttribute="bottom" constant="18" id="Tv4-ZZ-2PM"/>
......@@ -116,15 +112,15 @@
<constraint firstItem="R23-SN-2Bb" firstAttribute="centerY" secondItem="evT-5t-rty" secondAttribute="centerY" id="w2g-0d-F8E"/>
</constraints>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hDa-nl-Tlr" userLabel="v筛选(新)">
<rect key="frame" x="0.0" y="64" width="375" height="0.0"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hDa-nl-Tlr" customClass="KWMNormalFilterTab">
<rect key="frame" x="0.0" y="64" width="375" height="30"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" id="HK4-OE-vEa"/>
<constraint firstAttribute="height" constant="30" id="HK4-OE-vEa"/>
</constraints>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Cy8-TS-7aW">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Cy8-TS-7aW" customClass="KWMNormalFilterView">
<rect key="frame" x="0.0" y="94" width="375" height="573"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</subviews>
......@@ -132,11 +128,8 @@
<constraints>
<constraint firstItem="hDa-nl-Tlr" firstAttribute="top" secondItem="zpX-41-Ngk" secondAttribute="top" constant="64" id="1ku-fw-1rl"/>
<constraint firstAttribute="trailing" secondItem="evT-5t-rty" secondAttribute="trailing" id="67h-A6-5jJ"/>
<constraint firstAttribute="trailing" secondItem="hkC-I1-C67" secondAttribute="trailing" id="71Z-y2-6LQ"/>
<constraint firstItem="3n2-hH-xH7" firstAttribute="top" secondItem="hkC-I1-C67" secondAttribute="bottom" id="8n4-Ym-DBt"/>
<constraint firstItem="IcS-3H-XUB" firstAttribute="leading" secondItem="zpX-41-Ngk" secondAttribute="leading" id="CIl-uD-o0w"/>
<constraint firstAttribute="trailing" secondItem="IcS-3H-XUB" secondAttribute="trailing" id="Cv2-YS-e4D"/>
<constraint firstItem="hkC-I1-C67" firstAttribute="top" secondItem="gML-uH-K3J" secondAttribute="bottom" id="EOU-LB-816"/>
<constraint firstItem="hDa-nl-Tlr" firstAttribute="leading" secondItem="zpX-41-Ngk" secondAttribute="leading" id="NhL-d5-aXA"/>
<constraint firstItem="evT-5t-rty" firstAttribute="leading" secondItem="zpX-41-Ngk" secondAttribute="leading" id="Og9-68-h35"/>
<constraint firstItem="3n2-hH-xH7" firstAttribute="top" secondItem="Cy8-TS-7aW" secondAttribute="bottom" id="PIf-9Z-uEf"/>
......@@ -148,20 +141,20 @@
<constraint firstAttribute="trailing" secondItem="Cy8-TS-7aW" secondAttribute="trailing" id="iCF-U2-txU"/>
<constraint firstItem="Cy8-TS-7aW" firstAttribute="top" secondItem="hDa-nl-Tlr" secondAttribute="bottom" id="kzM-OO-4XA"/>
<constraint firstItem="3n2-hH-xH7" firstAttribute="top" secondItem="IcS-3H-XUB" secondAttribute="bottom" id="s35-CK-Hrw"/>
<constraint firstItem="hkC-I1-C67" firstAttribute="leading" secondItem="zpX-41-Ngk" secondAttribute="leading" id="uWV-7g-3iq"/>
</constraints>
</view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="375" height="667"/>
<connections>
<outlet property="btnBottom" destination="lgS-Wb-cuc" id="yWf-RS-4uY"/>
<outlet property="filterTab" destination="hDa-nl-Tlr" id="bN8-Bj-AEj"/>
<outlet property="filterView" destination="Cy8-TS-7aW" id="bXn-6V-4bg"/>
<outlet property="ivBrand" destination="bSu-Ww-ztC" id="i4m-wL-R2a"/>
<outlet property="tbvBrandCaramel" destination="IcS-3H-XUB" id="Op2-g8-Z4j"/>
<outlet property="tvDescription" destination="09X-K0-Zki" id="rlf-aR-PPB"/>
<outlet property="tvDescriptionTop" destination="PQT-t1-A4h" id="cht-8x-qdf"/>
<outlet property="vBackgroudTop" destination="9ij-Of-WPP" id="FgA-b2-2oQ"/>
<outlet property="vBackground" destination="RSg-ot-hh6" id="npW-oZ-LuL"/>
<outlet property="vBlurred" destination="hkC-I1-C67" id="TWz-Ts-ve0"/>
<outlet property="vNoneGoods" destination="evT-5t-rty" id="cte-zL-TVM"/>
</connections>
</viewController>
......
......@@ -10,8 +10,10 @@
#import "KWMBarandSelectView.h"
#import "Buy/Buy.h"
#import "KWMNewGoodsModel.h"
#import "KWMNormalFilterTab.h"
#import "KWMNormalFilterView.h"
@interface KWMBrandCaramelVC : KWMBasePageVC<KWMBarandSelectViewDelegate>
@interface KWMBrandCaramelVC : KWMBasePageVC<KWMBarandSelectViewDelegate,KWMNormalFilterTabDelegate,KWMFilterDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tbvBrandCaramel;
@property (weak, nonatomic) IBOutlet UITextView *tvDescription;
......@@ -20,17 +22,16 @@
@property (weak, nonatomic) IBOutlet UIImageView *ivBrand;
//@property (weak, nonatomic) IBOutlet UIView *vScreen;//筛选view
@property (weak, nonatomic) IBOutlet UIView *vBlurred;//模糊背景
@property (weak, nonatomic) IBOutlet UIView *vNoneGoods;//没有商品
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *vBackgroudTop;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tvDescriptionTop;
@property (weak, nonatomic) IBOutlet KWMNormalFilterTab *filterTab;
@property (weak, nonatomic) IBOutlet KWMNormalFilterView *filterView;
@property (nonatomic) BOOL isLoading;
@property (nonatomic) BUYCollectionSort collectionSort;
@property (nonatomic) BUYCollection *collection;
@property (nonatomic) NSString *brand;
@property (nonatomic) NSString *handle;//搜索品牌字段
......
......@@ -15,9 +15,10 @@
#import "UIImageView+WebCache.h"
#import "KWMImageUtil.h"
#import "KWMStringUtil.h"
#import "KWMFilterUtil.h"
#import "UIColor+SAMAdditions.h"
#import "MJRefresh.h"
#import "KWMFilterVC.h"
#import "KWMImageBlurUtil.h"
#import "KWMShoppingCart.h"
@interface KWMBrandCaramelVC ()<UITableViewDelegate,UITableViewDataSource,KWMBrandCaramelCellDelegate>
......@@ -56,21 +57,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.collectionSort = BUYCollectionSortCreatedDescending;
self.automaticallyAdjustsScrollViewInsets = NO;
self.tvDescription.editable = NO;
mark = -1;
self.vNoneGoods.backgroundColor = [UIColor colorWithRed:244.0/255 green:245.0/255 blue:247.0/255 alpha:1];
self.tbvBrandCaramel.separatorStyle = UITableViewCellSeparatorStyleNone;
_tvDescription.hidden = YES;
_btnBottom.hidden = YES;
if (_backColor) {
_ivBrand.backgroundColor = _backColor;
}else{
[self setBackColor];
}
[self initView];
[self getCollection:_handle];
if(self.goodModel){
......@@ -108,7 +95,6 @@
}
-(void)loadData{
// [self showLoading];
if(self.collection!=nil && self.collection.identifier!=nil){
[self getProcduct:self.collection.identifier];
}
......@@ -116,7 +102,6 @@
-(void)reLoadData{
self.currentPage = 0;
// [self showLoading];
if(self.collection!=nil && self.collection.identifier!=nil){
[self getProcduct:self.collection.identifier];
}}
......@@ -137,7 +122,10 @@ static NSString *idStr = @"KWMBrandCaramelCell";
isUp = NO;
backgroundTop = 210;
tvTop = 255;
mark = -1;
self.automaticallyAdjustsScrollViewInsets = NO;
self.hasNextPage = NO;
self.tbvBrandCaramel.delegate = self;
self.tbvBrandCaramel.showsVerticalScrollIndicator = NO;
[self.tbvBrandCaramel registerNib:[UINib nibWithNibName:idStr bundle:nil] forCellReuseIdentifier:idStr];
......@@ -146,6 +134,15 @@ static NSString *idStr = @"KWMBrandCaramelCell";
if(self.goodModel!=nil && self.goodModel.comments!=nil && ![self.goodModel.comments isEqualToString:@"品牌"]){
self.tbvBrandCaramel.tableHeaderView = [[UIView alloc] initWithFrame:CGRectZero];
}
if (_backColor) {
_ivBrand.backgroundColor = _backColor;
}else{
[self setBackColor];
}
self.filterView.delegate = self;
self.filterTab.delegate = self;
}
......@@ -187,11 +184,6 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
-(void)kwm_onClickSort:(BUYCollectionSort)sort{
self.hasNextPage = YES;
self.collectionSort = sort;
[self reLoadData];
}
#pragma mark -- KWMBarandSelectViewDelegate
//点击返回按钮回调
......@@ -206,6 +198,25 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[self.navigationController pushViewController:shopCartVC animated:YES];
}
#pragma mark -- KWMFilterDelegate
-(void)kwm_onFilterFinish:(KWMFilterView *)filterView{
self.filterView.hidden = YES;
[self.filterTab close];
[self reLoadData];
[self.tbvBrandCaramel.mj_header beginRefreshing];
[self.tbvBrandCaramel setContentOffset:CGPointMake(0,0) animated:YES];
}
-(void)kwm_onClickFilterBlank:(KWMFilterView *)filterView{
[self.filterTab close];
}
#pragma mark -- KWMNormalFilterTabDelegate
-(void)kwm_onClickTab:(KWMFilterMode)filterMode isExpandView:(BOOL)isExpand{
self.filterView.hidden = !isExpand;
self.filterView.filterMode = filterMode;
}
#pragma mark -- KWMBrandCaramelCellDelegate
//点击左边商品回调
......@@ -322,37 +333,35 @@ static NSString *idStr = @"KWMBrandCaramelCell";
- (void)getProcduct:(NSNumber *)collectionId{
BUYCollectionSort collectionSort = self.collectionSort;
if(collectionId == nil){
return;
}
__weak KWMBrandCaramelVC *weakSelf = self;
NSInteger tagetPage = self.currentPage.integerValue + 1;
NSArray *tags = nil;
//初始化排序及筛选tag
BUYCollectionSort collectionSort = self.filterView.selectedSort;
NSMutableArray *tags = [KWMFilterUtil getTagsByFilterArray:self.filterView.selectedTags];
if(self.isSale){
NSString *tag;
tag = @"sale";
tags = [NSArray arrayWithObjects:tag, nil];
[tags addObject:@"sale"];
}
NSInteger tagetPage = self.currentPage.integerValue + 1;
[self.client getProductsPage:tagetPage inCollection:collectionId withTags:tags sortOrder:collectionSort completion:^(NSArray *products,NSUInteger page, BOOL reachedEnd, NSError *error){
if (error != nil) {
if (error) {
[self showError:error];
NSLog(@"Error fetching products: %@", error);
}else if (products.count == 0 && weakSelf.dataList.count == 0){
_vNoneGoods.hidden = NO;
}else if (products.count == 0 && tagetPage == 1){
weakSelf.vNoneGoods.hidden = NO;
[weakSelf.dataList removeAllObjects];
[self.tbvBrandCaramel reloadData];
}else if (error == nil && products) {
if(tagetPage == 1){
if(tagetPage == 1 && (tags.count == 0 || (tags.count == 1 && weakSelf.isSale)) ){
[weakSelf.userDao saveCollectionCache:products collectionId:collectionId tags:tags];
}
weakSelf.hasNextPage = !reachedEnd;
[weakSelf appendDataList:products setPage:page];
_vNoneGoods.hidden = YES;
weakSelf.vNoneGoods.hidden = YES;
[self.tbvBrandCaramel reloadData];
}
[weakSelf hideLoading];
......
......@@ -11,9 +11,11 @@
#import "KWMDoubleTitleView.h"
#import "KWMBrandCaramelCell.h"
#import "UIColor+SAMAdditions.h"
#import "KWMNormalFilterTab.h"
#import "KWMNormalFilterView.h"
//选中的商品列表
@interface KWMSelectedGoodsVC : KWMBasePageVC<KWMBrandCaramelCellDelegate>
@interface KWMSelectedGoodsVC : KWMBasePageVC<KWMBrandCaramelCellDelegate,KWMNormalFilterTabDelegate,KWMFilterDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tbvSelectedGoods;
......@@ -23,12 +25,10 @@
@property (weak, nonatomic) IBOutlet UIView *vHeard;
@property (weak, nonatomic) IBOutlet KWMDoubleTitleView *vDoubleTitle;
@property (weak, nonatomic) IBOutlet UIView *vNoData;
@property (weak, nonatomic) IBOutlet UIImageView *testImageView;
//双重标题view的高度
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightDoubleTitle;
@property (weak, nonatomic) IBOutlet KWMNormalFilterTab *filterTab;
@property (weak, nonatomic) IBOutlet KWMNormalFilterView *filterView;
@property (nonatomic) BOOL isLoading;
......
......@@ -10,6 +10,8 @@
#import "KWMProductDetailVC.h"
#import "KWMBeforePayVC.h"
#import "KWMMineTitleView.h"
#import "MJRefresh.h"
#import "KWMFilterUtil.h"
#import "KWMStringUtil.h"
#import "KWMImageBlurUtil.h"
......@@ -47,6 +49,8 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
- (void)initView{
self.hasNextPage = NO;
self.collectionSort = BUYCollectionSortCreatedDescending;
if(self.productType != nil){
//初始化双行标题栏
......@@ -72,6 +76,10 @@ static NSString *idStr = @"KWMBrandCaramelCell";
vStopTap = [[UIView alloc] initWithFrame:CGRectMake(0, 20, UI_SCREEN_WIDTH, 44)];
vStopTap.backgroundColor = [UIColor clearColor];
_vHeard.backgroundColor = [UIColor sam_colorWithHex:@"F4F5F7"];
self.filterView.delegate = self;
self.filterTab.delegate = self;
[self initCacheData];
}
......@@ -111,12 +119,12 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}
-(void)loadData{
[self requesProductList:self.collectionSort];
[self requestProductList];
}
-(void)reLoadData{
self.currentPage = 0;
[self requesProductList:self.collectionSort];
[self requestProductList];
}
......@@ -133,6 +141,26 @@ static NSString *idStr = @"KWMBrandCaramelCell";
}];
}
#pragma mark -- KWMFilterDelegate
-(void)kwm_onFilterFinish:(KWMFilterView *)filterView{
self.filterView.hidden = YES;
[self.filterTab close];
[self reLoadData];
[self.tbvSelectedGoods.mj_header beginRefreshing];
[self.tbvSelectedGoods setContentOffset:CGPointMake(0,0) animated:YES];
}
-(void)kwm_onClickFilterBlank:(KWMFilterView *)filterView{
[self.filterTab close];
}
#pragma mark -- KWMNormalFilterTabDelegate
-(void)kwm_onClickTab:(KWMFilterMode)filterMode isExpandView:(BOOL)isExpand{
self.filterView.hidden = !isExpand;
self.filterView.filterMode = filterMode;
}
#pragma mark -- KWMBrandCaramelCellDelegate
//点击左边商品回调
......@@ -210,14 +238,8 @@ static NSString *idStr = @"KWMBrandCaramelCell";
return (UI_SCREEN_WIDTH/2 - 20 + 64);
}
- (void)requesProductList:(BUYCollectionSort)collectionSort{
if(!self.hasNextPage){
[self showToast:NSLocalizedString(@"WarnLastPage", @"WarnLastPage")];
[self hideLoading];
return;
}
- (void)requestProductList{
NSNumber *collectionId;
NSArray *tags;
if([TestModel isEqualToString:@"YES"]){
//测试
self.collection = [[BUYCollection alloc] init];
......@@ -226,29 +248,31 @@ static NSString *idStr = @"KWMBrandCaramelCell";
if(self.collection!=nil){
collectionId = self.collection.identifier;
}
//初始化排序及筛选tag
BUYCollectionSort collectionSort = self.filterView.selectedSort;
NSMutableArray *tags = [KWMFilterUtil getTagsByFilterArray:self.filterView.selectedTags];
if(self.productType!=nil){
if(![KWMStringUtil isEmpty:self.productType.collectionId]){
NSInteger num = [self.productType.collectionId integerValue];
collectionId = @(num);
}
NSString *tag;
if(self.tagType == 0){
tag = @"baby";
[tags addObject:@"baby"];
}else if(self.tagType == 1){
tag = @"girls";
[tags addObject:@"girls"];
}else if(self.tagType == 2){
tag = @"boys";
[tags addObject:@"boys"];
}else if(self.tagType == 3){
tag = @"shoes";
[tags addObject:@"shoes"];
}
tags = [NSArray arrayWithObjects:tag, nil];
}
if(collectionId == nil){
return;
}
[self showLoading];
self.isLoading = YES;
__weak KWMSelectedGoodsVC *weakSelf = self;
NSInteger tagetPage = self.currentPage.integerValue + 1;
......@@ -258,11 +282,20 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[weakSelf hideLoading];
if(tagetPage == 1){
[weakSelf.userDao saveCollectionCache:products collectionId:collectionId tags:tags];
if(tags.count == 1){
[weakSelf.userDao saveCollectionCache:products collectionId:collectionId tags:tags];
}
if(!products || products.count == 0){
self.vNoData.hidden = NO;
[weakSelf.dataList removeAllObjects];
[weakSelf.tbvSelectedGoods reloadData];
return;
}
}
weakSelf.isLoading = NO;
if (error == nil && products) {
self.vNoData.hidden = YES;
weakSelf.hasNextPage = !reachedEnd;
[weakSelf appendDataList:products setPage:page];
}
......
......@@ -137,56 +137,84 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="fcD-Y9-l8X">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="ZQ3-np-q9I" userLabel="vLine">
<rect key="frame" x="0.0" y="0.0" width="375" height="5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.82461414700000002" green="0.82461414700000002" blue="0.82461414700000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="5" id="h0I-AY-wFy"/>
</constraints>
</view>
<tableView contentMode="scaleToFill" alwaysBounceVertical="YES" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="fcD-Y9-l8X">
<rect key="frame" x="0.0" y="60" width="375" height="607"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="pw7-pT-2H3" id="sC2-7I-R6R"/>
<outlet property="delegate" destination="pw7-pT-2H3" id="cC8-uM-bQU"/>
</connections>
</tableView>
<view hidden="YES" alpha="0.29999999999999999" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UZg-qo-bkR">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lom-2Q-mUs">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂无商品" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XMM-dc-y7m">
<rect key="frame" x="155" y="323" width="66" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="6mx-bk-vjd"/>
<constraint firstAttribute="width" constant="66" id="kNa-HG-AQL"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Light" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.20436698719999999" green="0.20436698719999999" blue="0.20436698719999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_brand_not quite available" translatesAutoresizingMaskIntoConstraints="NO" id="pCp-qx-Ddg">
<rect key="frame" x="169" y="262" width="38" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="N0w-Ag-QqD"/>
<constraint firstAttribute="width" constant="37.530000000000001" id="odN-jL-V5A"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="0.95686274510000002" green="0.96078431369999995" blue="0.96862745100000003" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="XMM-dc-y7m" firstAttribute="top" secondItem="pCp-qx-Ddg" secondAttribute="bottom" constant="18" id="95e-Q5-geT"/>
<constraint firstItem="XMM-dc-y7m" firstAttribute="centerY" secondItem="lom-2Q-mUs" secondAttribute="centerY" id="EVq-dk-dhV"/>
<constraint firstItem="pCp-qx-Ddg" firstAttribute="centerX" secondItem="XMM-dc-y7m" secondAttribute="centerX" id="MPq-6m-nnO"/>
<constraint firstItem="XMM-dc-y7m" firstAttribute="centerX" secondItem="lom-2Q-mUs" secondAttribute="centerX" id="vHV-J1-LZm"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xb7-hV-2Zd" customClass="KWMNormalFilterTab">
<rect key="frame" x="0.0" y="20" width="375" height="30"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="W8Z-0A-bJw"/>
</constraints>
</view>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PWv-M7-7vS">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" red="0.99607843137254903" green="0.99607843137254903" blue="0.99607843137254903" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7qB-Q5-gG1" customClass="KWMNormalFilterView">
<rect key="frame" x="0.0" y="50" width="375" height="617"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.95686274509803915" green="0.96078431372549022" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="fcD-Y9-l8X" firstAttribute="leading" secondItem="X6T-Nd-zWM" secondAttribute="leading" id="4Hh-SK-YRP"/>
<constraint firstAttribute="bottom" secondItem="7qB-Q5-gG1" secondAttribute="bottom" id="52O-es-KBh"/>
<constraint firstItem="7qB-Q5-gG1" firstAttribute="leading" secondItem="X6T-Nd-zWM" secondAttribute="leading" id="5sg-sz-gBV"/>
<constraint firstAttribute="trailing" secondItem="fcD-Y9-l8X" secondAttribute="trailing" id="AHs-2L-9Oy"/>
<constraint firstItem="PWv-M7-7vS" firstAttribute="leading" secondItem="X6T-Nd-zWM" secondAttribute="leading" id="Alc-zB-QAz"/>
<constraint firstAttribute="trailing" secondItem="UZg-qo-bkR" secondAttribute="trailing" id="BA3-KF-7nx"/>
<constraint firstItem="fcD-Y9-l8X" firstAttribute="top" secondItem="BBC-0e-AMD" secondAttribute="bottom" id="EVY-OG-ebc"/>
<constraint firstItem="UZg-qo-bkR" firstAttribute="leading" secondItem="X6T-Nd-zWM" secondAttribute="leading" id="dTo-B0-vi1"/>
<constraint firstItem="lom-2Q-mUs" firstAttribute="top" secondItem="X6T-Nd-zWM" secondAttribute="top" id="Imt-9W-VgJ"/>
<constraint firstItem="lom-2Q-mUs" firstAttribute="leading" secondItem="X6T-Nd-zWM" secondAttribute="leading" id="LsI-78-515"/>
<constraint firstItem="fcD-Y9-l8X" firstAttribute="top" secondItem="xb7-hV-2Zd" secondAttribute="bottom" constant="10" id="QVC-Aj-qoP"/>
<constraint firstAttribute="trailing" secondItem="lom-2Q-mUs" secondAttribute="trailing" id="WKi-FN-cf1"/>
<constraint firstAttribute="trailing" secondItem="7qB-Q5-gG1" secondAttribute="trailing" id="Y3q-BV-TGt"/>
<constraint firstItem="xz3-5e-tlv" firstAttribute="top" secondItem="lom-2Q-mUs" secondAttribute="bottom" id="bWn-ll-1dm"/>
<constraint firstItem="7qB-Q5-gG1" firstAttribute="top" secondItem="xb7-hV-2Zd" secondAttribute="bottom" id="dWR-EP-dfj"/>
<constraint firstItem="xz3-5e-tlv" firstAttribute="top" secondItem="fcD-Y9-l8X" secondAttribute="bottom" id="eZr-L7-7fH"/>
<constraint firstItem="PWv-M7-7vS" firstAttribute="top" secondItem="BBC-0e-AMD" secondAttribute="bottom" id="hyH-ED-JXw"/>
<constraint firstItem="xz3-5e-tlv" firstAttribute="top" secondItem="PWv-M7-7vS" secondAttribute="bottom" id="kLS-v4-xqF"/>
<constraint firstAttribute="trailing" secondItem="PWv-M7-7vS" secondAttribute="trailing" id="l2J-WA-8do"/>
<constraint firstItem="UZg-qo-bkR" firstAttribute="top" secondItem="BBC-0e-AMD" secondAttribute="bottom" id="oeK-7i-mk1"/>
<constraint firstItem="xz3-5e-tlv" firstAttribute="top" secondItem="UZg-qo-bkR" secondAttribute="bottom" id="tnV-35-3hO"/>
<constraint firstItem="xb7-hV-2Zd" firstAttribute="top" secondItem="BBC-0e-AMD" secondAttribute="bottom" id="fRt-Zr-fSP"/>
<constraint firstAttribute="trailing" secondItem="xb7-hV-2Zd" secondAttribute="trailing" id="gwj-MW-Qsn"/>
<constraint firstItem="xb7-hV-2Zd" firstAttribute="leading" secondItem="X6T-Nd-zWM" secondAttribute="leading" id="ire-8T-wjq"/>
</constraints>
</view>
<connections>
<outlet property="filterTab" destination="xb7-hV-2Zd" id="j70-Te-eqs"/>
<outlet property="filterView" destination="7qB-Q5-gG1" id="h6l-q0-4M6"/>
<outlet property="tbvSelectedGoods" destination="fcD-Y9-l8X" id="Dem-kS-25O"/>
<outlet property="vBackground" destination="UZg-qo-bkR" id="JQg-We-lk1"/>
<outlet property="vHeard" destination="ZQ3-np-q9I" id="Xrs-R6-EGM"/>
<outlet property="vNoData" destination="lom-2Q-mUs" id="xLj-pR-VrK"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="rjD-hg-tmV" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1326" y="-299"/>
<point key="canvasLocation" x="1325.5999999999999" y="-299.10044977511245"/>
</scene>
<!--搜索反馈-->
<scene sceneID="lLS-0p-8iT">
......
//
// KWMFilterUtil.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "KWMFilter.h"
@interface KWMFilterUtil : NSObject
+(NSString *) transformTag:(KWMFilter *) filter tag:(NSString *)tag;
+(NSMutableArray<NSString *>*) getTagsByFilterArray:(NSArray<KWMFilter *>*)filterArray;
@end
//
// KWMFilterUtil.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMFilterUtil.h"
#import "KWMFilter.h"
#import "KWMStringUtil.h"
@implementation KWMFilterUtil
+(NSMutableArray<NSString *> *)getTagsByFilterArray:(NSArray<KWMFilter *> *)filterArray{
NSMutableArray<NSString *> *tags = [NSMutableArray array];
for(KWMFilter *filter in filterArray){
if(filter.tags){
for(NSString *tag in filter.tags){
[tags addObject:[self transformTag:filter tag:tag]];
}
}
}
return tags;
}
+(NSString *)transformTag:(KWMFilter *)filter tag:(NSString *)tag{
NSString *mTag = [tag copy];
//"Spring/Summer 2017" => Spring-Summer-2017
if([filter.group isEqualToString:@"SEASON"]){
mTag = [mTag stringByReplacingOccurrencesOfString:@"/" withString:@"-"];
return [tag stringByReplacingOccurrencesOfString:@" " withString:@"-"];
}
//1 month=> size-01m
else if([filter.group isEqualToString:@"SIZE"]){
//不合规则的区别待遇
if([tag isEqualToString:@"0 month"]){
return @"size-0m";
}else if([tag isEqualToString:@"3 month"]){
return @"size-3m";
}else if([tag isEqualToString:@"3 month"]){
return @"size-9m";
}
NSString *numberString = [self getNumberString:tag];
numberString = numberString.length == 1 ? [NSString stringWithFormat:@"0%@",numberString]:numberString;
if([tag rangeOfString:@"year"].location == NSNotFound){
return [NSString stringWithFormat:@"size-%@m",numberString];
}else{
return [NSString stringWithFormat:@"size-%@a",numberString];
}
}
//12 => shoe-size-1
else if([filter.group isEqualToString:@"Shoe Size"]){
return [NSString stringWithFormat:@"shoe-size-%@",tag];
}
//Trousers & Shorts => trousers-shorts
else if([filter.group isEqualToString:@"PRODUCT TYPE"]){
return [KWMStringUtil deleteOtherCharExceptLetterWithLine:tag];
}
return mTag;
}
+(NSString *)getNumberString:(NSString *)string{
NSCharacterSet* nonDigits =[[NSCharacterSet decimalDigitCharacterSet] invertedSet];
return [string stringByTrimmingCharactersInSet:nonDigits];
}
@end
......@@ -38,6 +38,7 @@
+(NSString *) dateformatToHours:(long long) time;
+(CGSize)boundingRectWithSize:(CGSize)size text:(NSString *)text testSize:(CGFloat) testSize;
+(CGSize)getLabelWidth:(NSString *)text labelFont:(UIFont *)aLabelFont textHeight:(CGFloat) textHeight;
+(CGSize)getLabelHeight:(NSString *)text labelFont:(UIFont *)aLabelFont textWidth:(CGFloat) textWidth;
+(NSString *)dateFormatTimeString:(long long)time;
+(NSString *)deleteBlankForString:(NSString *)text;
+(NSNumber *)stringToNumber:(NSString *)numberString;
......
......@@ -389,6 +389,20 @@ static NSDateFormatter *monthDayFormatter;
return rect.size;
}
//计算文本内容的高度
+(CGSize)getLabelHeight:(NSString *)text labelFont:(UIFont *)aLabelFont textWidth:(CGFloat) textWidth{
CGSize constraint = CGSizeMake(textWidth, MAXFLOAT);
CGRect rect = [text boundingRectWithSize:constraint
options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
attributes:@{
NSFontAttributeName : aLabelFont
}
context:nil];
return rect.size;
}
//删除出字母以外的字符补充为@"-"
static NSString *kEnglishNum = @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+ (NSString *)deleteOtherCharExceptLetterWithLine:(NSString *)str{
......
//
// KWMFilterTab.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "KWMFilterView.h"
@class KWMFilterTabItem;
@protocol FilterTabItemDelegate <NSObject>
- (void)kwm_onClickTabItem:(KWMFilterTabItem *)item isExpandView:(BOOL) isExpand;
@end
@interface KWMFilterTabItem : UIView
@property(nonatomic,weak) id<FilterTabItemDelegate> delegate;
@property(nonatomic) KWMFilterMode filterMode;
@property(nonatomic) BOOL isExpand;
@end
//
// KWMFilterTab.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMFilterTabItem.h"
#import "UIColor+SAMAdditions.h"
@interface KWMFilterTabItem()
@property(nonatomic,weak) IBOutlet UIView *containerView;
@property(nonatomic,weak) IBOutlet UILabel *lbTitle;
@property(nonatomic,weak) IBOutlet UIImageView *ivArrow;
-(IBAction)onClickTab:(id)sender;
@end
@implementation KWMFilterTabItem
-(void)awakeFromNib{
[super awakeFromNib];
[self initView];
}
-(void)initView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self
options:nil];
self.containerView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.containerView];
self.filterMode = ModeFilter;
}
-(void)setFilterMode:(KWMFilterMode)filterMode{
_filterMode = filterMode;
if(filterMode == ModeFilter){
self.lbTitle.text = @"筛选";
}else if(filterMode == ModeSort){
self.lbTitle.text = @"排序";
}else if(filterMode == ModeBrand){
self.lbTitle.text = @"品牌";
}
}
-(void)onClickTab:(id)sender{
if(self.delegate != nil){
[self.delegate kwm_onClickTabItem:self isExpandView:!self.isExpand];
}
}
-(void)setIsExpand:(BOOL)isExpand{
_isExpand = isExpand;
if(isExpand){
self.lbTitle.textColor = [UIColor sam_colorWithHex:@"F1929A"];
[self.ivArrow setTransform:CGAffineTransformMakeRotation(M_PI)];
}else{
self.lbTitle.textColor = [UIColor sam_colorWithHex:@"515151"];
[self.ivArrow setTransform:CGAffineTransformMakeRotation(0)];
}
}
@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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMFilterTabItem">
<connections>
<outlet property="containerView" destination="iN0-l3-epB" id="4uJ-11-hEK"/>
<outlet property="ivArrow" destination="1wv-Qf-Mpm" id="yVW-0M-4Mr"/>
<outlet property="lbTitle" destination="XKx-az-aVp" id="fwZ-S3-5SU"/>
</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="188" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="X29-gf-6cs">
<rect key="frame" x="0.0" y="0.0" width="188" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="筛选" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XKx-az-aVp">
<rect key="frame" x="79.5" y="0.0" width="29" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_arrow_down" translatesAutoresizingMaskIntoConstraints="NO" id="1wv-Qf-Mpm">
<rect key="frame" x="108.5" y="0.0" width="15" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="15" id="8q0-rm-EbE"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<constraints>
<constraint firstItem="1wv-Qf-Mpm" firstAttribute="leading" secondItem="XKx-az-aVp" secondAttribute="trailing" id="B0g-2J-cmY"/>
<constraint firstItem="1wv-Qf-Mpm" firstAttribute="top" secondItem="X29-gf-6cs" secondAttribute="top" id="BQe-6Z-CzL"/>
<constraint firstAttribute="bottom" secondItem="XKx-az-aVp" secondAttribute="bottom" id="ERZ-D0-O2D"/>
<constraint firstAttribute="centerX" secondItem="XKx-az-aVp" secondAttribute="centerX" id="FG6-97-cCo"/>
<constraint firstItem="XKx-az-aVp" firstAttribute="top" secondItem="X29-gf-6cs" secondAttribute="top" id="Wex-w2-URJ"/>
<constraint firstAttribute="bottom" secondItem="1wv-Qf-Mpm" secondAttribute="bottom" id="s9e-lu-b26"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="X29-gf-6cs" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Ghd-H3-FZ6"/>
<constraint firstAttribute="trailing" secondItem="X29-gf-6cs" secondAttribute="trailing" id="UPA-c4-Vvd"/>
<constraint firstAttribute="bottom" secondItem="X29-gf-6cs" secondAttribute="bottom" id="nLy-LP-Ubo"/>
<constraint firstItem="X29-gf-6cs" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="oTe-ex-8Bj"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outletCollection property="gestureRecognizers" destination="etY-WT-T62" appends="YES" id="Mmr-Wn-3Rk"/>
</connections>
</view>
<tapGestureRecognizer id="etY-WT-T62" userLabel="tapContainer">
<connections>
<action selector="onClickTab:" destination="-1" id="Swg-04-MCg"/>
</connections>
</tapGestureRecognizer>
</objects>
<resources>
<image name="ic_arrow_down" width="6" height="5"/>
</resources>
</document>
//
// KWMFilterView.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "KWMFilter.h"
#import <Buy/Buy.h>
typedef NS_ENUM(NSInteger, KWMFilterMode) {
ModeFilter,
ModeSort,
ModeBrand //品牌筛选
};
@class KWMFilterView;
@protocol KWMFilterDelegate <NSObject>
@required
- (void)kwm_onFilterFinish:(KWMFilterView *)filterView;
@optional
- (void)kwm_onClickFilterBlank:(KWMFilterView *)filterView;
@end
@interface KWMFilterView : UIView<UICollectionViewDelegate,UICollectionViewDataSource>
@property(nonatomic) KWMFilterMode filterMode;
@property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags;
@property(nonatomic) BUYCollectionSort selectedSort;
@property(nonatomic,weak) id<KWMFilterDelegate> delegate;
@end
//
// KWMFilterView.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMFilterView.h"
#import "KWMFilterViewCell.h"
#import "UIColor+SAMAdditions.h"
#import "KWMStringUtil.h"
static NSString *filterDataString = @"[{\"group\":\"SEASON\",\"tags\":[\"Spring/Summer 2017\",\"Autumn/Winter 2016\",\"Spring/Summer 2016\",\"Autumn/Winter 2015\"]},{\"group\":\"GENDER\",\"tags\":[\"Girls\",\"Boys\"]},{\"group\":\"SIZE\",\"tags\":[\"0 month\",\"3 month\",\"6 month\",\"9 month\",\"12 month\",\"18 month\",\"2 year\",\"3 year\",\"4 year\",\"5 year\",\"6 year\",\"7 year\",\"8 year\",\"10 year\",\"12 year\",\"14 year\",\"16 year\"]},{\"group\":\"Shoe Size\",\"tags\":[\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\",\"32\",\"33\",\"34\",\"35\",\"37\",\"38\",\"39\"]},{\"group\":\"PRODUCT TYPE\",\"tags\":[\"Accessories\",\"Babysuits\",\"Coats & Jackets\",\"Dresses\",\"Leggings\",\"Raincoat\",\"Sets\",\"Shoes\",\"Skirts\",\"Swimwear\",\"Tights\",\"Tops\",\"Toys\",\"Trousers & Shorts\",\"Underwear\"]}]";
@interface KWMFilterView()
@property(weak,nonatomic) IBOutlet UIView *vContent;
@property(weak,nonatomic) IBOutlet UICollectionView *cvFilter;
//默认为0 新-旧款 1-3依次对应 旧-新款 高-低价 低-高价
@property(nonatomic) NSInteger selectedSortPosition;
-(IBAction)onClickFilter:(id)sender;
@end
@implementation KWMFilterView{
NSArray<KWMFilter *>*filterData;
NSArray *sortData;
NSArray<NSString *>*sortStringData;
}
-(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([KWMFilterView class]) owner:self options:nil];
self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vContent];
[self.cvFilter registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionViewHeader"];
[self.cvFilter registerNib:[UINib nibWithNibName:NSStringFromClass([KWMFilterViewCell class]) bundle:nil] forCellWithReuseIdentifier:NSStringFromClass([KWMFilterViewCell class])];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 10;
layout.headerReferenceSize =CGSizeMake(UI_SCREEN_WIDTH - 80,40);//头视图大小
self.cvFilter.collectionViewLayout = layout;
[self initFilterData];
[self initSortData];
self.filterMode = ModeFilter;
self.selectedTags = [NSMutableArray array];
}
-(void)initFilterData{
NSData *data = [filterDataString dataUsingEncoding:NSUTF8StringEncoding];
NSArray *filterDataArray = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
for(NSDictionary *itemJson in filterDataArray){
NSError *error;
id result = [[KWMFilter alloc] initWithDictionary:itemJson error:&error];
if(error){
NSLog(@"buildListData error: %@", [error localizedDescription]);
}else{
[mutableArray addObject:result];
}
}
filterData = [mutableArray copy];
}
-(void)initSortData{
sortStringData = @[@"新-旧款",@"旧-新款",@"高-低价",@"低-高价"];
}
-(BUYCollectionSort)selectedSort{
switch (self.selectedSortPosition) {
case 0:
return BUYCollectionSortCreatedDescending;
case 1:
return BUYCollectionSortCreatedAscending;
case 2:
return BUYCollectionSortPriceDescending;
case 3:
return BUYCollectionSortPriceAscending;
default:
return BUYCollectionSortCreatedDescending;
}
}
-(void)setSelectedTags:(NSMutableArray<KWMFilter *> *)selectedTags{
_selectedTags = selectedTags ? selectedTags:[NSMutableArray array];
[self.cvFilter reloadData];
}
-(void)setFilterMode:(KWMFilterMode)filterMode{
_filterMode = filterMode;
[self.cvFilter reloadData];
}
-(void)onClickFilter:(id)sender{
if(self.delegate){
[self.delegate kwm_onFilterFinish:self];
}
}
//是否选中tag
-(BOOL)isSelectedTag:(KWMFilter *)filter tag:(NSString *)tag{
for(KWMFilter *addedfilter in self.selectedTags){
if([addedfilter.group isEqualToString:filter.group]){
if([addedfilter.tags containsObject:tag]){
return YES;
}
}
}
return NO;
}
//根据点击的tag,来判断应添加tag到选中数据中,还是应将其从选中数据中移除
-(void)refreshSelectedTags:(KWMFilter *)filter tag:(NSString *)tag{
for(KWMFilter *addedfilter in self.selectedTags){
if([addedfilter.group isEqualToString:filter.group]){
if([addedfilter.tags containsObject:tag]){
[addedfilter.tags removeObject:tag];
}else{
[addedfilter.tags addObject:tag];
}
return;
}
}
KWMFilter *mFilter = [filter copy];
[mFilter.tags removeAllObjects];
[mFilter.tags addObject:tag];
[self.selectedTags addObject:mFilter];
}
#pragma mark - UICollectionViewDataSource
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
NSInteger count = self.filterMode == ModeFilter?filterData.count:1;
return count;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
NSUInteger count = self.filterMode == ModeFilter?filterData[section].tags.count:4;
return count;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
KWMFilterViewCell *filterCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMFilterViewCell class]) forIndexPath:indexPath];
//更新cell
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
NSString *tag = filter.tags[indexPath.row];
filterCell.text = tag;
filterCell.isSelectedFilter = [self isSelectedTag:filter tag:tag];
}else if(self.filterMode == ModeSort){
filterCell.text = sortStringData[indexPath.row];
filterCell.isSelectedFilter = self.selectedSortPosition == indexPath.row;
}
return filterCell;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
//默认宽高
CGFloat defaultWidth = (UI_SCREEN_WIDTH - 40 * 2 - 13 * 2)/3;
CGFloat defaultHeight = 36;
//获得cell要显示的文字
NSString *text = @"";
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
text = filter.tags[indexPath.row];
}
//获得字体,计算文字显示所需高度
UIFont *font = [UIFont systemFontOfSize:12];
if(SYSTEM_VERSION_LESS_THAN(@"9.0")){
[UIFont fontWithName:@"PingFang SC" size:12];
}
CGFloat height = [KWMStringUtil getLabelHeight:text labelFont:font textWidth:defaultWidth - 10].height ;
//返回控件实际大小
//Trousers & Shorts 该项与其他项无法对齐,目前暂不清楚是什么原因...只能通过略微加大宽度来减少视觉上的负面影响。
if([text isEqualToString:@"Trousers & Shorts"]){
return CGSizeMake(defaultWidth+5, fmaxf(height + 10,defaultHeight));
}
return CGSizeMake(defaultWidth, fmaxf(height + 10,defaultHeight));
}
//创建头视图
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView
viewForSupplementaryElementOfKind:(NSString *)kind
atIndexPath:(NSIndexPath *)indexPath {
UICollectionReusableView *headView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionViewHeader" forIndexPath:indexPath];
UILabel *headerLabel = [headView viewWithTag:101];
//如果是新创建的headView,向其中添加label
if(!headerLabel){
headerLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 15, UI_SCREEN_WIDTH-80,20)];
headerLabel.textColor = [UIColor sam_colorWithHex:@"393939"];
headerLabel.font = [UIFont systemFontOfSize:12];
headerLabel.tag = 101;
[headView addSubview:headerLabel];
}
//更新label
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
headerLabel.text = filter.group;
}else{
headerLabel.text = @"排序";
}
return headView;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if(self.filterMode == ModeFilter){
KWMFilter *filter = filterData[indexPath.section];
NSString *tag = filter.tags[indexPath.row];
[self refreshSelectedTags:filter tag:tag];
}else if(self.filterMode == ModeSort){
self.selectedSortPosition = indexPath.row;
}
[self.cvFilter reloadData];
}
@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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMFilterView">
<connections>
<outlet property="cvFilter" destination="xOq-Lu-NIJ" id="U2m-de-kD1"/>
<outlet property="vContent" destination="iN0-l3-epB" id="xRL-Ao-DqI"/>
</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="431"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jbD-Fx-Doz">
<rect key="frame" x="0.0" y="0.0" width="375" height="431"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mv7-mA-PiS">
<rect key="frame" x="20" y="361" width="335" height="50"/>
<color key="backgroundColor" red="0.14901960784313725" green="0.14901960784313725" blue="0.14901960784313725" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="ewu-ud-emW"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<state key="normal" title="完成">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="onClickFilter:" destination="-1" eventType="touchUpInside" id="hvL-GN-Vs9"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SS1-pG-lvf">
<rect key="frame" x="0.0" y="350" width="375" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="eO9-gv-xHP"/>
</constraints>
</view>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="xOq-Lu-NIJ">
<rect key="frame" x="40" y="0.0" width="295" height="350"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="N25-Te-Dke">
<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>
<connections>
<outlet property="dataSource" destination="-1" id="81u-Yl-hQT"/>
<outlet property="delegate" destination="-1" id="0mY-mW-rnL"/>
</connections>
</collectionView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="SS1-pG-lvf" firstAttribute="leading" secondItem="jbD-Fx-Doz" secondAttribute="leading" id="A0q-lS-woK"/>
<constraint firstItem="mv7-mA-PiS" firstAttribute="leading" secondItem="jbD-Fx-Doz" secondAttribute="leading" constant="20" id="CaG-Z1-dTJ"/>
<constraint firstItem="xOq-Lu-NIJ" firstAttribute="top" secondItem="jbD-Fx-Doz" secondAttribute="top" id="GYK-SV-0Ev"/>
<constraint firstItem="SS1-pG-lvf" firstAttribute="top" secondItem="xOq-Lu-NIJ" secondAttribute="bottom" id="JHJ-KK-0i2"/>
<constraint firstAttribute="trailing" secondItem="xOq-Lu-NIJ" secondAttribute="trailing" constant="40" id="Jeg-y1-yfx"/>
<constraint firstAttribute="trailing" secondItem="mv7-mA-PiS" secondAttribute="trailing" constant="20" id="OaW-Ep-cX1"/>
<constraint firstAttribute="trailing" secondItem="SS1-pG-lvf" secondAttribute="trailing" id="YNA-rc-FJJ"/>
<constraint firstItem="mv7-mA-PiS" firstAttribute="top" secondItem="SS1-pG-lvf" secondAttribute="bottom" constant="10" id="ZW9-sx-06t"/>
<constraint firstAttribute="bottom" secondItem="mv7-mA-PiS" secondAttribute="bottom" constant="20" id="vN3-kk-0IM"/>
<constraint firstItem="xOq-Lu-NIJ" firstAttribute="leading" secondItem="jbD-Fx-Doz" secondAttribute="leading" constant="40" id="w6Z-wB-o3f"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="trailing" secondItem="jbD-Fx-Doz" secondAttribute="trailing" id="Fk5-nZ-ZTP"/>
<constraint firstItem="jbD-Fx-Doz" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Onf-1J-q5f"/>
<constraint firstItem="jbD-Fx-Doz" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Trp-bn-hke"/>
<constraint firstAttribute="bottom" secondItem="jbD-Fx-Doz" secondAttribute="bottom" id="eiy-V8-WZa"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="33.5" y="114.5"/>
</view>
</objects>
</document>
//
// KWMFilterViewCell.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KWMFilterViewCell : UICollectionViewCell
@property (nonatomic) BOOL isSelectedFilter;
@property (nonatomic) NSString *text;
@end
//
// KWMFilterViewCell.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMFilterViewCell.h"
#import "UIColor+SAMAdditions.h"
#import "UIView+Prettify.h"
@interface KWMFilterViewCell()
@property (weak,nonatomic) IBOutlet UIView *vContent;
@property (weak,nonatomic) IBOutlet UILabel *lbDetail;
@end
@implementation KWMFilterViewCell{
}
- (void)awakeFromNib {
[super awakeFromNib];
[self.vContent setBorder:1 cornerRadius:0 borderColor:[UIColor sam_colorWithHex:@"393939"]];
}
-(void)setIsSelectedFilter:(BOOL)isSelectedFilter{
_isSelectedFilter = isSelectedFilter;
if(isSelectedFilter){
self.lbDetail.textColor = [UIColor whiteColor];
self.vContent.backgroundColor = [UIColor sam_colorWithHex:@"393939"];
}else{
self.lbDetail.textColor = [UIColor sam_colorWithHex:@"393939"];
self.vContent.backgroundColor = [UIColor whiteColor];
}
}
-(void)setText:(NSString *)text{
self.lbDetail.text = text?text:@"";
}
@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="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="KWMFilterViewCell">
<rect key="frame" x="0.0" y="0.0" width="91" height="36"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="91" height="36"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ozs-fo-IBI">
<rect key="frame" x="0.0" y="0.0" width="91" height="36"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="秋冬2015" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Pf-Wf-jVh">
<rect key="frame" x="5" y="0.0" width="81" height="36"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<color key="textColor" red="0.22352941176470587" green="0.22352941176470587" blue="0.22352941176470587" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="0Pf-Wf-jVh" firstAttribute="leading" secondItem="ozs-fo-IBI" secondAttribute="leading" constant="5" id="CJr-Lw-1sS"/>
<constraint firstAttribute="bottom" secondItem="0Pf-Wf-jVh" secondAttribute="bottom" id="Euw-RL-X6j"/>
<constraint firstItem="0Pf-Wf-jVh" firstAttribute="top" secondItem="ozs-fo-IBI" secondAttribute="top" id="HGc-uo-Pih"/>
<constraint firstAttribute="trailing" secondItem="0Pf-Wf-jVh" secondAttribute="trailing" constant="5" id="l7I-jk-UTD"/>
</constraints>
</view>
</subviews>
</view>
<constraints>
<constraint firstAttribute="bottom" secondItem="ozs-fo-IBI" secondAttribute="bottom" id="1Hx-R9-h15"/>
<constraint firstAttribute="trailing" secondItem="ozs-fo-IBI" secondAttribute="trailing" id="N7x-CL-fQG"/>
<constraint firstItem="ozs-fo-IBI" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="VG6-xI-suF"/>
<constraint firstItem="ozs-fo-IBI" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="Zwb-zC-ovC"/>
</constraints>
<connections>
<outlet property="lbDetail" destination="0Pf-Wf-jVh" id="nrM-KX-3Q3"/>
<outlet property="vContent" destination="ozs-fo-IBI" id="sQw-Sd-zy3"/>
</connections>
</collectionViewCell>
</objects>
</document>
//
// KWMNormalFilterTab.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "KWMFilterTabItem.h"
@protocol KWMNormalFilterTabDelegate <NSObject>
- (void)kwm_onClickTab:(KWMFilterMode)filterMode isExpandView:(BOOL) isExpand;
@end
@interface KWMNormalFilterTab : UIView<FilterTabItemDelegate>
@property(nonatomic,weak) id<KWMNormalFilterTabDelegate> delegate;
-(void)close;
@end
//
// KWMNormalFilterTab.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMNormalFilterTab.h"
#import "KWMFilterTabItem.h"
@interface KWMNormalFilterTab()
@property(nonatomic,weak) IBOutlet UIView *containerView;
@property(nonatomic,weak) IBOutlet KWMFilterTabItem *vLeft;
@property(nonatomic,weak) IBOutlet KWMFilterTabItem *vRight;
@end
@implementation KWMNormalFilterTab
-(void)awakeFromNib{
[super awakeFromNib];
[self initView];
}
-(void)initView{
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class])
owner:self
options:nil];
self.containerView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
self.backgroundColor = [UIColor redColor];
[self addSubview:self.containerView];
self.vLeft.filterMode = ModeFilter;
self.vRight.filterMode = ModeSort;
self.vLeft.delegate = self;
self.vRight.delegate = self;
}
-(void)kwm_onClickTabItem:(KWMFilterTabItem *)item isExpandView:(BOOL)isExpand{
self.vLeft.isExpand = item.filterMode == ModeFilter? isExpand: NO;
self.vRight.isExpand = item.filterMode == ModeSort? isExpand: NO;
if(self.delegate){
[self.delegate kwm_onClickTab:item.filterMode isExpandView:isExpand];
}
}
-(void)close{
self.vLeft.isExpand = NO;
self.vRight.isExpand = NO;
}
@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="12120"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMNormalFilterTab">
<connections>
<outlet property="containerView" destination="iN0-l3-epB" id="btB-pv-WTY"/>
<outlet property="vLeft" destination="SlH-TR-5Jd" id="UMx-8j-Rmg"/>
<outlet property="vRight" destination="Zym-UK-hE9" id="5HR-sc-5ah"/>
</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="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LuV-Yr-gBK">
<rect key="frame" x="0.0" y="0.0" width="375" height="30"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="niD-9D-3MP">
<rect key="frame" x="0.0" y="0.0" width="375" height="30"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SlH-TR-5Jd" userLabel="vLeft" customClass="KWMFilterTabItem">
<rect key="frame" x="0.0" y="0.0" width="186.5" height="30"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zym-UK-hE9" userLabel="vRight" customClass="KWMFilterTabItem">
<rect key="frame" x="187.5" y="0.0" width="187.5" height="30"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cNw-Hg-ifw" userLabel="vMidLine">
<rect key="frame" x="186.5" y="5" width="1" height="20"/>
<color key="backgroundColor" red="0.94509803921568625" green="0.5725490196078431" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="LFK-yW-WER"/>
<constraint firstAttribute="height" constant="20" id="iCR-rK-nTf"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UTV-01-O0q">
<rect key="frame" x="0.0" y="29" width="375" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="hcy-0b-OH8"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="cNw-Hg-ifw" firstAttribute="centerY" secondItem="niD-9D-3MP" secondAttribute="centerY" id="1Q4-53-h8q"/>
<constraint firstItem="UTV-01-O0q" firstAttribute="leading" secondItem="niD-9D-3MP" secondAttribute="leading" id="4fs-NC-Pmf"/>
<constraint firstItem="cNw-Hg-ifw" firstAttribute="leading" secondItem="SlH-TR-5Jd" secondAttribute="trailing" id="4vk-Tx-4Ha"/>
<constraint firstItem="SlH-TR-5Jd" firstAttribute="leading" secondItem="niD-9D-3MP" secondAttribute="leading" id="CDn-j9-ObI"/>
<constraint firstAttribute="bottom" secondItem="SlH-TR-5Jd" secondAttribute="bottom" id="CMS-82-bOw"/>
<constraint firstAttribute="trailing" secondItem="Zym-UK-hE9" secondAttribute="trailing" id="HZI-ss-IJR"/>
<constraint firstItem="Zym-UK-hE9" firstAttribute="top" secondItem="niD-9D-3MP" secondAttribute="top" id="LDd-7G-HYl"/>
<constraint firstAttribute="bottom" secondItem="UTV-01-O0q" secondAttribute="bottom" id="WaW-39-fOB"/>
<constraint firstAttribute="trailing" secondItem="UTV-01-O0q" secondAttribute="trailing" id="dai-nt-KBh"/>
<constraint firstItem="Zym-UK-hE9" firstAttribute="leading" secondItem="cNw-Hg-ifw" secondAttribute="trailing" id="fsa-71-cRm"/>
<constraint firstItem="cNw-Hg-ifw" firstAttribute="centerX" secondItem="niD-9D-3MP" secondAttribute="centerX" id="myE-jB-XyF"/>
<constraint firstItem="SlH-TR-5Jd" firstAttribute="top" secondItem="niD-9D-3MP" secondAttribute="top" id="qfr-Fe-drH"/>
<constraint firstAttribute="bottom" secondItem="Zym-UK-hE9" secondAttribute="bottom" id="ubg-Bm-VCZ"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.95686274509803915" green="0.96078431372549022" blue="0.96862745098039216" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="niD-9D-3MP" firstAttribute="top" secondItem="LuV-Yr-gBK" secondAttribute="top" id="B35-Gh-HUH"/>
<constraint firstItem="niD-9D-3MP" firstAttribute="leading" secondItem="LuV-Yr-gBK" secondAttribute="leading" id="bXh-Fv-MwB"/>
<constraint firstAttribute="bottom" secondItem="niD-9D-3MP" secondAttribute="bottom" id="kBS-Ha-BHH"/>
<constraint firstAttribute="trailing" secondItem="niD-9D-3MP" secondAttribute="trailing" id="oBo-P7-HJ0"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="LuV-Yr-gBK" secondAttribute="trailing" id="B8a-Nc-07q"/>
<constraint firstItem="LuV-Yr-gBK" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="GOW-rL-l2N"/>
<constraint firstItem="LuV-Yr-gBK" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="O8L-Vm-Qjt"/>
<constraint firstAttribute="bottom" secondItem="LuV-Yr-gBK" secondAttribute="bottom" id="UfQ-OM-vVm"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="89.5" y="108.5"/>
</view>
</objects>
</document>
//
// KWMNormalFilterView.h
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "KWMFilterView.h"
@interface KWMNormalFilterView : UIView
@property(nonatomic) KWMFilterMode filterMode;
@property(nonatomic,weak) id<KWMFilterDelegate> delegate;
@property(nonatomic) NSMutableArray<KWMFilter *> *selectedTags;
@property(nonatomic) BUYCollectionSort selectedSort;
@end
//
// KWMTopFilterView.m
// iCemarose
//
// Created by HouWeiBin on 2017/6/8.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMNormalFilterView.h"
@interface KWMNormalFilterView()
@property(weak,nonatomic) IBOutlet UIView *vContent;
@property(weak,nonatomic) IBOutlet KWMFilterView *filterView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightFilter;
-(IBAction)onClickBlank:(id)sender;
@end
@implementation KWMNormalFilterView
-(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([self class]) owner:self options:nil];
self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vContent];
}
-(void)setFilterMode:(KWMFilterMode)filterMode{
_filterMode = filterMode;
self.filterView.filterMode = filterMode;
self.heightFilter.constant = filterMode == ModeFilter?self.frame.size.height * 0.7:210;
}
-(void)setDelegate:(id<KWMFilterDelegate>)delegate{
_delegate = delegate;
self.filterView.delegate = delegate;
}
-(BUYCollectionSort)selectedSort{
return self.filterView.selectedSort;
}
-(NSMutableArray<KWMFilter *> *)selectedTags{
return self.filterView.selectedTags;
}
-(void)onClickBlank:(id)sender{
if(self.delegate && [self.delegate respondsToSelector:@selector(kwm_onClickFilterBlank:)]){
[self.delegate kwm_onClickFilterBlank:self.filterView];
}
self.hidden = YES;
}
@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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMNormalFilterView">
<connections>
<outlet property="filterView" destination="AFM-lg-PjC" id="pNw-rv-IvA"/>
<outlet property="heightFilter" destination="6KX-Dg-66z" id="Wo3-eH-eHC"/>
<outlet property="vContent" destination="iN0-l3-epB" id="7BZ-YQ-Bpg"/>
</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="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vsx-Tb-ugb">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<view alpha="0.5" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="z7B-Ta-Qar" userLabel="Blank">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<gestureRecognizers/>
<connections>
<outletCollection property="gestureRecognizers" destination="XTx-4h-dka" appends="YES" id="BFR-eg-lnB"/>
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AFM-lg-PjC" customClass="KWMFilterView">
<rect key="frame" x="0.0" y="0.0" width="375" height="300"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="6KX-Dg-66z"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="z7B-Ta-Qar" secondAttribute="bottom" id="ARt-a6-IfB"/>
<constraint firstAttribute="trailing" secondItem="z7B-Ta-Qar" secondAttribute="trailing" id="AgG-Je-tFg"/>
<constraint firstItem="z7B-Ta-Qar" firstAttribute="top" secondItem="vsx-Tb-ugb" secondAttribute="top" id="OgI-6M-n7R"/>
<constraint firstItem="z7B-Ta-Qar" firstAttribute="leading" secondItem="vsx-Tb-ugb" secondAttribute="leading" id="QvB-kf-QnC"/>
<constraint firstItem="AFM-lg-PjC" firstAttribute="top" secondItem="vsx-Tb-ugb" secondAttribute="top" id="SiA-l8-az5"/>
<constraint firstItem="AFM-lg-PjC" firstAttribute="leading" secondItem="vsx-Tb-ugb" secondAttribute="leading" id="fsU-Xp-mDE"/>
<constraint firstAttribute="trailing" secondItem="AFM-lg-PjC" secondAttribute="trailing" id="y3m-QH-Uah"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="vsx-Tb-ugb" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="3yR-fD-Fn8"/>
<constraint firstItem="vsx-Tb-ugb" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="AZz-DG-Djx"/>
<constraint firstAttribute="bottom" secondItem="vsx-Tb-ugb" secondAttribute="bottom" id="gps-dw-eNb"/>
<constraint firstAttribute="trailing" secondItem="vsx-Tb-ugb" secondAttribute="trailing" id="ttf-rG-sW2"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
</view>
<tapGestureRecognizer id="XTx-4h-dka" userLabel="tapBlank">
<connections>
<action selector="onClickBlank:" destination="-1" id="7wU-Df-M9v"/>
</connections>
</tapGestureRecognizer>
</objects>
</document>
//
// UIView+Prettify.h
// SchedulePlan
//
// Created by HouWeiBin on 2016/12/23.
// Copyright © 2016年 kollway. All rights reserved.
//
// 用于uiview的装饰,如添加边框,阴影。
#import <UIKit/UIKit.h>
@interface UIView (Prettify)
//设置边框
-(void)setBorder:(CGFloat)width cornerRadius:(CGFloat)cornerRadius borderColor:(UIColor *)borderColor;
//设置阴影
-(void)setShadow:(CGSize)shadowOffset shadowRadius:(CGFloat)shadowRadius shadowOpacity:(CGFloat)shadowOpacity shadowColor:(UIColor *)shadowColor;
//设置默认阴影
-(void)initDefaultShadow;
@end
//
// UIView+Prettify.m
// SchedulePlan
//
// Created by HouWeiBin on 2016/12/23.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "UIView+Prettify.h"
@implementation UIView (Prettify)
-(void)setBorder:(CGFloat)width cornerRadius:(CGFloat)cornerRadius borderColor:(UIColor *)borderColor{
self.layer.cornerRadius = cornerRadius;
self.layer.masksToBounds = YES;
self.layer.borderWidth = width;
self.layer.borderColor = borderColor.CGColor;
}
-(void)setShadow:(CGSize)shadowOffset shadowRadius:(CGFloat)shadowRadius shadowOpacity:(CGFloat)shadowOpacity shadowColor:(UIColor *)shadowColor{
self.layer.shadowColor = shadowColor.CGColor;//shadowColor阴影颜色
self.layer.shadowOffset = shadowOffset;//shadowOffset阴影偏移,x向右偏移,y向下偏移,默认(0, -3),这个跟shadowRadius配合使用
self.layer.shadowOpacity = shadowOpacity;//阴影透明度,默认0
self.layer.shadowRadius = shadowRadius;//阴影半径,默认3
}
-(void)initDefaultShadow{
[self setShadow:CGSizeMake(0,1) shadowRadius:4 shadowOpacity:0.1 shadowColor:[UIColor blackColor]];
}
@end
......@@ -24,6 +24,7 @@
#define UI_SCREEN_HEITHT ([[UIScreen mainScreen] bounds].size.height)
#define KWMAPI_URL(path) [NSURL URLWithString:[[KWMAPIManager sharedManager] toAbsoluteUrl:path]]
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define KWMTextTips 0
#define KWMNoDataTips 1
#define KWMNoLike 2
......
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