diff --git a/iCemarose.xcodeproj/project.pbxproj b/iCemarose.xcodeproj/project.pbxproj index 1fc6188..a3ec42a 100644 --- a/iCemarose.xcodeproj/project.pbxproj +++ b/iCemarose.xcodeproj/project.pbxproj @@ -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 */; }; @@ -242,8 +255,6 @@ C0F586791E24F820001248E2 /* KWMDetailCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0F5864B1E24F820001248E2 /* KWMDetailCell.xib */; }; C0F5867A1E24F820001248E2 /* KWMDoubleTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0F5864D1E24F820001248E2 /* KWMDoubleTitleView.m */; }; C0F5867B1E24F820001248E2 /* KWMDoubleTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0F5864E1E24F820001248E2 /* KWMDoubleTitleView.xib */; }; - C0F5867C1E24F820001248E2 /* KWMFilterView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0F586501E24F820001248E2 /* KWMFilterView.m */; }; - C0F5867D1E24F820001248E2 /* KWMFilterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0F586511E24F820001248E2 /* KWMFilterView.xib */; }; C0F5867E1E24F820001248E2 /* KWMNewGoodsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C0F586531E24F820001248E2 /* KWMNewGoodsCell.m */; }; C0F5867F1E24F820001248E2 /* KWMNewGoodsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0F586541E24F820001248E2 /* KWMNewGoodsCell.xib */; }; C0F586801E24F820001248E2 /* KWMNewTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0F586561E24F820001248E2 /* KWMNewTypeView.m */; }; @@ -607,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>"; }; @@ -648,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>"; }; @@ -706,9 +738,6 @@ C0F5864C1E24F820001248E2 /* KWMDoubleTitleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMDoubleTitleView.h; sourceTree = "<group>"; }; C0F5864D1E24F820001248E2 /* KWMDoubleTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMDoubleTitleView.m; sourceTree = "<group>"; }; C0F5864E1E24F820001248E2 /* KWMDoubleTitleView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMDoubleTitleView.xib; sourceTree = "<group>"; }; - C0F5864F1E24F820001248E2 /* KWMFilterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMFilterView.h; sourceTree = "<group>"; }; - C0F586501E24F820001248E2 /* KWMFilterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMFilterView.m; sourceTree = "<group>"; }; - C0F586511E24F820001248E2 /* KWMFilterView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMFilterView.xib; sourceTree = "<group>"; }; C0F586521E24F820001248E2 /* KWMNewGoodsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMNewGoodsCell.h; sourceTree = "<group>"; }; C0F586531E24F820001248E2 /* KWMNewGoodsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMNewGoodsCell.m; sourceTree = "<group>"; }; C0F586541E24F820001248E2 /* KWMNewGoodsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMNewGoodsCell.xib; sourceTree = "<group>"; }; @@ -1082,6 +1111,8 @@ C0D7CAA01EA843AD005AE3A3 /* KWMOrder.m */, 9BE61CFC1ECD66BC0031D21E /* KWMShoppingCart.h */, 9BE61CFD1ECD66BC0031D21E /* KWMShoppingCart.m */, + C0CCB3BB1EEA589200BC2FB8 /* KWMFilter.h */, + C0CCB3BC1EEA589200BC2FB8 /* KWMFilter.m */, ); path = Model; sourceTree = "<group>"; @@ -1113,6 +1144,8 @@ C034E6C41D6AECF9006EE129 /* Util */ = { isa = PBXGroup; children = ( + C077966D1EEAA2BE00CD6859 /* KWMFilterUtil.h */, + C077966E1EEAA2BE00CD6859 /* KWMFilterUtil.m */, C02C7D991E642DED008DC29C /* KWMWeChatUtil.h */, C02C7D9A1E642DED008DC29C /* KWMWeChatUtil.m */, C034E6D01D6AEF1B006EE129 /* KWMImageUtil.h */, @@ -1134,6 +1167,7 @@ C034E6C51D6AECF9006EE129 /* View */ = { isa = PBXGroup; children = ( + C0CCB3B51EEA520C00BC2FB8 /* FilterView */, C0DD53251EE55190002D1E0C /* Cell */, C0DD53261EE55190002D1E0C /* Loading */, C034E7C31D6B10A0006EE129 /* CorePhotoBroswer */, @@ -1161,6 +1195,8 @@ 801230F41DD32B39008C7904 /* KWMInformationView.h */, 801230F51DD32B39008C7904 /* KWMInformationView.m */, 801230F71DD32B49008C7904 /* KWMInformationView.xib */, + C0CCB3C31EEA5A1100BC2FB8 /* UIView+Prettify.h */, + C0CCB3C41EEA5A1100BC2FB8 /* UIView+Prettify.m */, ); path = View; sourceTree = "<group>"; @@ -1646,6 +1682,28 @@ path = Cell; sourceTree = "<group>"; }; + 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>"; + }; C0DD53251EE55190002D1E0C /* Cell */ = { isa = PBXGroup; children = ( @@ -1719,9 +1777,6 @@ C0F5864C1E24F820001248E2 /* KWMDoubleTitleView.h */, C0F5864D1E24F820001248E2 /* KWMDoubleTitleView.m */, C0F5864E1E24F820001248E2 /* KWMDoubleTitleView.xib */, - C0F5864F1E24F820001248E2 /* KWMFilterView.h */, - C0F586501E24F820001248E2 /* KWMFilterView.m */, - C0F586511E24F820001248E2 /* KWMFilterView.xib */, C0F586521E24F820001248E2 /* KWMNewGoodsCell.h */, C0F586531E24F820001248E2 /* KWMNewGoodsCell.m */, C0F586541E24F820001248E2 /* KWMNewGoodsCell.xib */, @@ -1865,7 +1920,7 @@ TargetAttributes = { C034E6891D6AEB12006EE129 = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 72Z44QQ9ZD; + DevelopmentTeam = 6HFG5LS2Y2; ProvisioningStyle = Manual; }; C034E6A21D6AEB13006EE129 = { @@ -1911,7 +1966,6 @@ 801230F31DD30704008C7904 /* KWMSearchBrandsCell.xib in Resources */, C084F4591D6D976F00A0625D /* KWMSearchBar.xib in Resources */, C0DD53381EE55190002D1E0C /* KWMLoadingView.xib in Resources */, - C0F5867D1E24F820001248E2 /* KWMFilterView.xib in Resources */, C0F586811E24F820001248E2 /* KWMNewTypeView.xib in Resources */, C0AF039F1DD5C8EE0060623F /* KWMNeedAddressView.xib in Resources */, C084F4541D6D8CA700A0625D /* KWMBlogCell.xib in Resources */, @@ -1919,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 */, @@ -1936,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 */, @@ -1956,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 */, @@ -2052,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 */, @@ -2076,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 */, @@ -2115,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 */, @@ -2128,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 */, @@ -2161,7 +2225,6 @@ 80ED0A491D93B82F00B28DF2 /* KWMShopCartItem+CoreDataProperties.m in Sources */, 80537ADB1D86A7E100AB5122 /* KWMUserModel.m in Sources */, C034E84E1D6B10A0006EE129 /* UIImage+Water.m in Sources */, - C0F5867C1E24F820001248E2 /* KWMFilterView.m in Sources */, C034E86B1D6B10A0006EE129 /* EGORefreshTableHeaderView.m in Sources */, C0DD53191EE54C5F002D1E0C /* KWMSearchFeedBackView.m in Sources */, C03A05061E35DC5800BAA889 /* KWMNewGiftCardVC.m in Sources */, @@ -2172,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 */, @@ -2182,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 */, diff --git a/iCemarose/Assets.xcassets/ic_arrow_down.imageset/Contents.json b/iCemarose/Assets.xcassets/ic_arrow_down.imageset/Contents.json new file mode 100644 index 0000000..c8bc380 --- /dev/null +++ b/iCemarose/Assets.xcassets/ic_arrow_down.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "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 diff --git a/iCemarose/Assets.xcassets/ic_arrow_down.imageset/ic_arrow_down@2x.png b/iCemarose/Assets.xcassets/ic_arrow_down.imageset/ic_arrow_down@2x.png new file mode 100644 index 0000000..c9d220e Binary files /dev/null and b/iCemarose/Assets.xcassets/ic_arrow_down.imageset/ic_arrow_down@2x.png differ diff --git a/iCemarose/Assets.xcassets/ic_arrow_down.imageset/ic_arrow_down@3x.png b/iCemarose/Assets.xcassets/ic_arrow_down.imageset/ic_arrow_down@3x.png new file mode 100644 index 0000000..002d6bd Binary files /dev/null and b/iCemarose/Assets.xcassets/ic_arrow_down.imageset/ic_arrow_down@3x.png differ diff --git a/iCemarose/Class/Model/KWMBrandsImage.h b/iCemarose/Class/Model/KWMBrandsImage.h deleted file mode 100644 index f8d5010..0000000 --- a/iCemarose/Class/Model/KWMBrandsImage.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// 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 diff --git a/iCemarose/Class/Model/KWMBrandsImage.m b/iCemarose/Class/Model/KWMBrandsImage.m deleted file mode 100644 index f7e8c09..0000000 --- a/iCemarose/Class/Model/KWMBrandsImage.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// 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 diff --git a/iCemarose/Class/Model/KWMFilter.h b/iCemarose/Class/Model/KWMFilter.h new file mode 100644 index 0000000..3f84348 --- /dev/null +++ b/iCemarose/Class/Model/KWMFilter.h @@ -0,0 +1,22 @@ +// +// 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 diff --git a/iCemarose/Class/Model/KWMFilter.m b/iCemarose/Class/Model/KWMFilter.m new file mode 100644 index 0000000..ed04ad2 --- /dev/null +++ b/iCemarose/Class/Model/KWMFilter.m @@ -0,0 +1,13 @@ +// +// KWMFilter.m +// iCemarose +// +// Created by HouWeiBin on 2017/6/7. +// Copyright © 2017年 kollway. All rights reserved. +// + +#import "KWMFilter.h" + +@implementation KWMFilter + +@end diff --git a/iCemarose/Class/Model/KWMOrder.h b/iCemarose/Class/Model/KWMOrder.h index ce5e2b9..1e20634 100644 --- a/iCemarose/Class/Model/KWMOrder.h +++ b/iCemarose/Class/Model/KWMOrder.h @@ -7,6 +7,7 @@ // #import <JSONModel/JSONModel.h> +#import "KWMBaseModel.h" @interface KWMOrder : KWMBaseModel diff --git a/iCemarose/Class/UI/Brand/Brand.storyboard b/iCemarose/Class/UI/Brand/Brand.storyboard index a94ee1f..9b7c044 100644 --- a/iCemarose/Class/UI/Brand/Brand.storyboard +++ b/iCemarose/Class/UI/Brand/Brand.storyboard @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> @@ -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,83 +112,25 @@ <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="7Li-5W-7f5" customClass="KWMFilterView"> - <rect key="frame" x="0.0" y="65" width="375" height="602"/> + <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> - <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"/> - <subviews> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bgT-J7-XAe" userLabel="left"> - <rect key="frame" x="0.0" y="0.0" width="187.5" height="0.0"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="筛选" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E2F-rc-MkG"> - <rect key="frame" x="80" y="-10" width="28" height="20"/> - <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="14"/> - <color key="textColor" red="0.31764705882352939" green="0.31764705882352939" blue="0.31764705882352939" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <nil key="highlightedColor"/> - </label> - </subviews> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - <constraints> - <constraint firstItem="E2F-rc-MkG" firstAttribute="centerY" secondItem="bgT-J7-XAe" secondAttribute="centerY" id="V2N-bD-opb"/> - <constraint firstItem="E2F-rc-MkG" firstAttribute="centerX" secondItem="bgT-J7-XAe" secondAttribute="centerX" id="c2b-WH-FLs"/> - </constraints> - <connections> - <outletCollection property="gestureRecognizers" destination="9c4-MD-7Lg" appends="YES" id="INt-ba-DAG"/> - </connections> - </view> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="shz-Mj-x88" userLabel="right"> - <rect key="frame" x="187.5" y="0.0" width="187.5" height="0.0"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="排序" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4kk-AI-Ue8"> - <rect key="frame" x="79.5" y="-10" width="28" height="20"/> - <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="14"/> - <color key="textColor" red="0.31764705882352939" green="0.31764705882352939" blue="0.31764705882352939" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <nil key="highlightedColor"/> - </label> - </subviews> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - <constraints> - <constraint firstItem="4kk-AI-Ue8" firstAttribute="centerY" secondItem="shz-Mj-x88" secondAttribute="centerY" id="MM9-kD-8GO"/> - <constraint firstItem="4kk-AI-Ue8" firstAttribute="centerX" secondItem="shz-Mj-x88" secondAttribute="centerX" id="jPh-JB-ELN"/> - </constraints> - <connections> - <outletCollection property="gestureRecognizers" destination="ig2-Qj-7Vg" appends="YES" id="YNr-kb-ck2"/> - </connections> - </view> - </subviews> - <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="bottom" secondItem="shz-Mj-x88" secondAttribute="bottom" id="BYB-Ci-Alg"/> - <constraint firstItem="shz-Mj-x88" firstAttribute="top" secondItem="hDa-nl-Tlr" secondAttribute="top" id="Boj-gZ-NbY"/> - <constraint firstItem="bgT-J7-XAe" firstAttribute="leading" secondItem="hDa-nl-Tlr" secondAttribute="leading" id="FSP-MV-SKt"/> - <constraint firstAttribute="height" id="HK4-OE-vEa"/> - <constraint firstItem="shz-Mj-x88" firstAttribute="leading" secondItem="bgT-J7-XAe" secondAttribute="trailing" id="N9h-61-PbB"/> - <constraint firstItem="shz-Mj-x88" firstAttribute="width" secondItem="bgT-J7-XAe" secondAttribute="width" id="Z7S-qy-Rbj"/> - <constraint firstItem="bgT-J7-XAe" firstAttribute="top" secondItem="hDa-nl-Tlr" secondAttribute="top" id="iAq-80-rQV"/> - <constraint firstAttribute="bottom" secondItem="bgT-J7-XAe" secondAttribute="bottom" id="lQE-Yt-tCr"/> - <constraint firstAttribute="trailing" secondItem="shz-Mj-x88" secondAttribute="trailing" id="oy5-jA-UW2"/> + <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"/> - <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> - </view> </subviews> <color key="backgroundColor" red="0.95686274509803915" green="0.96078431372549022" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <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="3n2-hH-xH7" firstAttribute="top" secondItem="7Li-5W-7f5" secondAttribute="bottom" id="Dgc-Ob-D1N"/> - <constraint firstItem="hkC-I1-C67" firstAttribute="top" secondItem="gML-uH-K3J" secondAttribute="bottom" id="EOU-LB-816"/> - <constraint firstAttribute="trailing" secondItem="7Li-5W-7f5" secondAttribute="trailing" id="Jgy-TO-X0t"/> <constraint firstItem="hDa-nl-Tlr" firstAttribute="leading" secondItem="zpX-41-Ngk" secondAttribute="leading" id="NhL-d5-aXA"/> - <constraint firstItem="7Li-5W-7f5" firstAttribute="top" secondItem="zpX-41-Ngk" secondAttribute="top" constant="65" id="NqW-sc-tSL"/> <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"/> <constraint firstItem="IcS-3H-XUB" firstAttribute="top" secondItem="hDa-nl-Tlr" secondAttribute="bottom" constant="10" id="VMa-R5-OFW"/> @@ -203,37 +141,24 @@ <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="7Li-5W-7f5" firstAttribute="leading" secondItem="zpX-41-Ngk" secondAttribute="leading" id="tSH-fZ-Hx1"/> - <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="filterView" destination="7Li-5W-7f5" id="vlZ-hW-czm"/> + <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="vFilter" destination="Cy8-TS-7aW" id="mHF-Cf-CEw"/> <outlet property="vNoneGoods" destination="evT-5t-rty" id="cte-zL-TVM"/> </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="ppo-c8-mZD" userLabel="First Responder" sceneMemberID="firstResponder"/> - <tapGestureRecognizer id="9c4-MD-7Lg" userLabel="tap筛选"> - <connections> - <action selector="onClickFilter:" destination="eiC-Xl-2es" id="MaL-V8-aet"/> - </connections> - </tapGestureRecognizer> - <tapGestureRecognizer id="ig2-Qj-7Vg" userLabel="tap排序"> - <connections> - <action selector="onClickSort:" destination="eiC-Xl-2es" id="PXm-1n-9wt"/> - </connections> - </tapGestureRecognizer> </objects> <point key="canvasLocation" x="520.79999999999995" y="-353.07346326836586"/> </scene> diff --git a/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.h b/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.h index d4b8224..077c006 100644 --- a/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.h +++ b/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.h @@ -10,10 +10,10 @@ #import "KWMBarandSelectView.h" #import "Buy/Buy.h" #import "KWMNewGoodsModel.h" -#import "KWMFilterView.h" -#import "KWMFilterVC.h" +#import "KWMNormalFilterTab.h" +#import "KWMNormalFilterView.h" -@interface KWMBrandCaramelVC : KWMBasePageVC<KWMBarandSelectViewDelegate,KWMFilterDelegate,KWMFilterVCDelegate> +@interface KWMBrandCaramelVC : KWMBasePageVC<KWMBarandSelectViewDelegate,KWMNormalFilterTabDelegate,KWMFilterDelegate> @property (weak, nonatomic) IBOutlet UITableView *tbvBrandCaramel; @property (weak, nonatomic) IBOutlet UITextView *tvDescription; @@ -22,20 +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 UIView *vFilter;//筛选空间容器 - @property (weak, nonatomic) IBOutlet NSLayoutConstraint *vBackgroudTop; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *tvDescriptionTop; -@property (weak, nonatomic) IBOutlet KWMFilterView *filterView; +@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;//搜索品牌字段 @@ -48,8 +44,5 @@ - (IBAction)onClickBotomBtn:(id)sender; -- (IBAction)onClickFilter:(id)sender; - -- (IBAction)onClickSort:(id)sender; @end diff --git a/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m b/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m index 800e88e..c61ac5e 100644 --- a/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m +++ b/iCemarose/Class/UI/Brand/KWMBrandCaramelVC.m @@ -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" #import <RXCollections/RXCollection.h> @@ -57,38 +58,12 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - self.collectionSort = BUYCollectionSortCreatedDescending; - self.filterView.delegate = self; - 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){ [self initCacheData]; } - [self initFilterVC]; -} - --(void)initFilterVC{ - if(!filterVC){ - UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"New" bundle:nil]; - filterVC = [storyboard instantiateViewControllerWithIdentifier:[KWMFilterVC kwmTag]]; - [self addChildViewController:filterVC]; - [self.vFilter addSubview:filterVC.view]; - filterVC.delegate = self; - } } -(void)initCacheData{ @@ -121,7 +96,6 @@ } -(void)loadData{ -// [self showLoading]; if(self.collection!=nil && self.collection.identifier!=nil){ [self getProcduct:self.collection.identifier]; } @@ -129,7 +103,6 @@ -(void)reLoadData{ self.currentPage = 0; -// [self showLoading]; if(self.collection!=nil && self.collection.identifier!=nil){ [self getProcduct:self.collection.identifier]; }} @@ -140,20 +113,6 @@ _barandSelectView.count = [[KWMShoppingCart sharedInstance] count].integerValue; _barandSelectView.lbBrand.text = [_brand uppercaseString]; - - rightButton =[UIButton buttonWithType:UIButtonTypeRoundedRect]; - rightButton.frame = CGRectMake(UI_SCREEN_WIDTH-100, 33, 40, 20); - [rightButton addTarget:self action:@selector(clickRightButton) forControlEvents:UIControlEventTouchUpInside]; - [rightButton setTitle:@"排序 +" forState:UIControlStateNormal]; - [rightButton setTitleColor:[UIColor sam_colorWithHex:@"4E4E4E"] forState:UIControlStateNormal]; - rightButton.titleLabel.font=[UIFont systemFontOfSize:11]; - [rightButton.layer setMasksToBounds:YES]; - rightButton.layer.cornerRadius = 1; //圆角(圆形) - rightButton.layer.borderColor = [UIColor sam_colorWithHex:@"4E4E4E"].CGColor; //要设置的颜色 - rightButton.layer.borderWidth = 1; //要设置的描边宽 - [self.barandSelectView addSubview:rightButton]; - - [self.view addSubview:_barandSelectView]; _barandSelectView.delegate = self; } @@ -164,7 +123,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]; @@ -173,6 +135,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; } @@ -195,26 +166,6 @@ static NSString *idStr = @"KWMBrandCaramelCell"; isUp = !isUp; } --(void)onClickSort:(id)sender{ - self.vFilter.hidden = NO; - [self initFilterVC]; - if(filterVC){ - [filterVC setBgImage:[KWMImageBlurUtil getBlurImage:self.tbvBrandCaramel]]; - BOOL isSort = YES; - [filterVC setType:isSort]; - } -} - --(void)onClickFilter:(id)sender{ - self.vFilter.hidden = NO; - [self initFilterVC]; - if(filterVC){ - [filterVC setBgImage:[KWMImageBlurUtil getBlurImage:self.tbvBrandCaramel]]; - BOOL isSort = YES; - [filterVC setType:!isSort]; - } -} - //动画 筛选显示:0:不显示 1:显示 2:没有 - (void)changeFrameBy:(NSInteger)value WithImageName:(NSString *)imageStr AndShowView:(NSInteger)showNum{ @@ -233,40 +184,7 @@ static NSString *idStr = @"KWMBrandCaramelCell"; }]; } --(void)clickRightButton{ - if(self.isLoading){ - return; - } - self.filterView.hidden = !self.filterView.hidden; - self.filterView.collectionSort = self.collectionSort; - if(self.filterView.hidden){ - rightButton.titleLabel.text = @"排序 +"; - [rightButton setTitle:@"排序 +" forState:UIControlStateNormal]; - }else{ - rightButton.titleLabel.text = @"排序 -"; - [rightButton setTitle:@"排序 -" forState:UIControlStateNormal]; - } -} --(void)kwm_onCancelFilter{ - self.vFilter.hidden = YES; -} - --(void)kwm_onClickSort:(BUYCollectionSort)sort{ - self.hasNextPage = YES; - self.collectionSort = sort; - [self reLoadData]; -} - --(void)kwm_onHide{ - if(self.filterView.hidden){ - rightButton.titleLabel.text = @"排序 +"; - [rightButton setTitle:@"排序 +" forState:UIControlStateNormal]; - }else{ - [rightButton setTitle:@"排序 -" forState:UIControlStateNormal]; - rightButton.titleLabel.text = @"排序 -"; - } -} #pragma mark -- KWMBarandSelectViewDelegate //点击返回按钮回调 @@ -281,6 +199,28 @@ 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.filterMode = filterMode; + if(isExpand){ + [self.filterView show]; + } + self.filterView.hidden = !isExpand; +} + #pragma mark -- KWMBrandCaramelCellDelegate //点击左边商品回调 @@ -397,40 +337,38 @@ 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){ products = [products rx_filterWithBlock:^BOOL(BUYProduct *each) { return each.availableValue; }]; - 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]; diff --git a/iCemarose/Class/UI/KWMBaseVC.m b/iCemarose/Class/UI/KWMBaseVC.m index 01893b2..b860e10 100644 --- a/iCemarose/Class/UI/KWMBaseVC.m +++ b/iCemarose/Class/UI/KWMBaseVC.m @@ -291,40 +291,71 @@ - (void)showError:(NSError *)error{ if ([error.domain isEqualToString:NSURLErrorDomain]) { [self showToast:@"网络已断开,请重新连接"]; -// [self showToast:@"请求数据失败"]; return; } -// NSDictionary *userInfo = [error userInfo]; -// if (userInfo != nil) { -// NSNumber *errorCodeKey = [userInfo objectForKey:@"_kCFStreamErrorCodeKey"]; -// if (errorCodeKey.intValue == 8) { -// [self showToast:@"网络已断开,请重新连接"]; -// return; -// } -// } - NSArray<BUYError *> *errors = [BUYError errorsFromCheckoutJSON:error.userInfo]; - if([self checkBuyErrors:errors]){ + if (!error.userInfo){ return; } - errors = [BUYError errorsFromSignUpJSON:error.userInfo]; - if([self checkBuyErrors:errors]){ + if ([self isCheckOutError:error]){ return; } - NSString *toast = [self getErrorMessage:error]; - if(![KWMStringUtil isEmpty:toast]){ - [self showToast:toast]; + if ([self isSignUpError:error]){ + return; + } + if ([self isNormalError:error]){ return; } - toast = [self getErrorMessage2:error]; + //如果并不是shopify error,则正常吐司。 + [self showToast:[error localizedDescription]]; +} + +-(BOOL)isCheckOutError:(NSError *)error{ + //虽然errorsFromCheckoutJSON里面有判断了,但为了保险起见,还是加上判断 + NSDictionary *errorsDictionary = error.userInfo[@"errors"]; + if(!errorsDictionary || ![errorsDictionary isKindOfClass:[NSDictionary class]]){ + return NO; + } + NSDictionary *customerDictionary = errorsDictionary[@"checkout"]; + if(!customerDictionary || ![customerDictionary isKindOfClass:[NSDictionary class]]){ + return NO; + } + NSArray<BUYError *> *errors = [BUYError errorsFromCheckoutJSON:error.userInfo]; +// 现在下单时不会报quantity错误了。所以这段代码注释 +// if(errors && errors.count > 0){ +// NSString *quantityRemainingMessage = [errors.firstObject quantityRemainingMessage]; +// } + if([self checkBuyErrors:errors]){ + return YES; + } + return NO; +} + +-(BOOL)isSignUpError:(NSError *)error{ + NSDictionary *errorsDictionary = error.userInfo[@"errors"]; + if(!errorsDictionary || ![errorsDictionary isKindOfClass:[NSDictionary class]]){ + return NO; + } + NSDictionary *customerDictionary = errorsDictionary[@"customer"]; + if(!customerDictionary || ![customerDictionary isKindOfClass:[NSDictionary class]]){ + return NO; + } + NSArray<BUYError *> *errors = [BUYError errorsFromSignUpJSON:error.userInfo]; + if([self checkBuyErrors:errors]){ + return YES; + } + return NO; +} + +- (BOOL)isNormalError:(NSError *)error{ + NSString *toast = [self getErrorMessage:error]; if(![KWMStringUtil isEmpty:toast]){ - if(toast!=nil && [toast isEqualToString:@"Unidentified customer"]){ + if([toast isEqualToString:@"Unidentified customer"]){ toast = @"登录已失效,请重新登录"; } [self showToast:toast]; - return; + return YES; } - - [self showToast:[error localizedDescription]]; + return NO; } //判断buyerror是否有效,有效则吐司错误 @@ -350,18 +381,26 @@ return NO; } -//获取key为message的错误信息 +//获取key为message/error的错误信息 - (NSString *)getErrorMessage:(NSError *)error{ - return [self getErrorMessageForKey:@"message = \"" error:error]; -} - -//获取key为error的错误信息 -- (NSString *)getErrorMessage2:(NSError *)error{ - return [self getErrorMessageForKey:@"error = \"" error:error]; + NSString *errorString; + errorString = [self getErrorMessageForKey:@"message = \"" error:error]; + if(![KWMStringUtil isEmpty:errorString]){ + return errorString; + } + errorString = [self getErrorMessageForKey:@"error = \"" error:error]; + if(![KWMStringUtil isEmpty:errorString]){ + return errorString; + } + errorString = [self getErrorMessageForKey:@"errors = \"" error:error]; + if(![KWMStringUtil isEmpty:errorString]){ + return errorString; + } + return @""; } -(NSString *)getErrorMessageForKey:(NSString *)key error:(NSError *)error{ - NSString *errorString = [self dictionaryToJson:error.userInfo]; + NSString *errorString = [self dictionaryToString:error.userInfo]; NSRange startRange = [errorString rangeOfString:key]; if (startRange.location != NSNotFound) { NSString *errorString2 = [errorString substringFromIndex:startRange.location + startRange.length]; @@ -378,13 +417,13 @@ } //字典转换为字符串 -- (NSString*)dictionaryToJson:(NSDictionary *)dic{ +- (NSString*)dictionaryToString:(NSDictionary *)dic{ NSString *a = [NSString stringWithFormat:@"%@",dic]; return a; } + - (BOOL)hasError:(id)result{ - NSInteger code = -1; NSString *message; if ([result isKindOfClass:[KWMRequestResult class]]) { diff --git a/iCemarose/Class/UI/Product/Cell/KWMFilterView.h b/iCemarose/Class/UI/Product/Cell/KWMFilterView.h deleted file mode 100644 index 7eb63c5..0000000 --- a/iCemarose/Class/UI/Product/Cell/KWMFilterView.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// KWMFilterView.h -// iCemarose -// -// Created by HouWeiBin on 2016/12/9. -// Copyright © 2016年 kollway. All rights reserved. -// - -#import <UIKit/UIKit.h> -#import "Buy/Buy.h" - - -@protocol KWMFilterDelegate <NSObject> - -- (void)kwm_onClickSort:(BUYCollectionSort)sort; - -- (void)kwm_onHide; - -@end -@interface KWMFilterView : UIView - -@property (weak, nonatomic) IBOutlet UIView *vContent; - -@property (weak, nonatomic) IBOutlet UIButton *btnNewToOld; - -@property (weak, nonatomic) IBOutlet UIButton *btnDearToCheap; - -@property (weak, nonatomic) IBOutlet UIButton *btnCheapToDear; - -@property (weak, nonatomic) id<KWMFilterDelegate>delegate; - -- (IBAction)onClikcNewToOld:(id)sender; - -- (IBAction)onClickDearToCheap:(id)sender; - --(IBAction)onClickCheapToDear:(id)sender; - --(IBAction)onClickBg:(id)sender; - --(IBAction)onClickComplete:(id)sender; - -@property (nonatomic) BUYCollectionSort collectionSort; - -@end diff --git a/iCemarose/Class/UI/Product/Cell/KWMFilterView.m b/iCemarose/Class/UI/Product/Cell/KWMFilterView.m deleted file mode 100644 index 27ef516..0000000 --- a/iCemarose/Class/UI/Product/Cell/KWMFilterView.m +++ /dev/null @@ -1,126 +0,0 @@ -// -// KWMFilterView.m -// iCemarose -// -// Created by HouWeiBin on 2016/12/9. -// Copyright © 2016年 kollway. All rights reserved. -// - -#import "KWMFilterView.h" -#import "UIColor+SAMAdditions.h" - - -@implementation KWMFilterView - - -- (id)init{ - if (self=[super init]){ - [self addView]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - [self addView]; - } - return self; -} - --(instancetype)initWithFrame:(CGRect)frame{ - if (self =[super initWithFrame:frame]) { - [self addView]; - } - return self; -} - --(void)awakeFromNib{ - [super awakeFromNib]; -} - --(void) addView{ - [[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]; - [self initView]; -} - --(void)setCollectionSort:(BUYCollectionSort)collectionSort{ - if(collectionSort == BUYCollectionSortPriceDescending){ - [self onClickDearToCheap:nil]; - }else if(collectionSort == BUYCollectionSortPriceAscending){ - [self onClickCheapToDear:nil]; - }else{ - [self onClikcNewToOld:nil]; - } -} - --(void)initView{ - [self initButton:self.btnNewToOld]; - [self initButton:self.btnCheapToDear]; - [self initButton:self.btnDearToCheap]; - [self setButtonSelect:self.btnNewToOld isSelect:YES]; -} - --(void)initButton:(UIButton *)button{ - [button.layer setMasksToBounds:YES]; - button.layer.cornerRadius = 1; //圆角(圆形) - button.layer.borderColor = [UIColor blackColor].CGColor; //要设置的颜色 - button.layer.borderWidth = 1; //要设置的描边宽 -} - --(void)setButtonSelect:(UIButton *)button isSelect:(BOOL)isSelect{ - if(isSelect){ - //设置背景颜色 - button.backgroundColor = [UIColor sam_colorWithHex:@"393939"]; - button.titleLabel.textColor = [UIColor sam_colorWithHex:@"ffffff"]; - [button setTitleColor:[UIColor sam_colorWithHex:@"ffffff"] forState:UIControlStateNormal]; - }else{ - button.backgroundColor = [UIColor sam_colorWithHex:@"ffffff"]; - [button setTitleColor:[UIColor sam_colorWithHex:@"4c5966"] forState:UIControlStateNormal]; - } -} - --(void)onClikcNewToOld:(id)sender{ - [self setButtonSelect:self.btnNewToOld isSelect:YES]; - [self setButtonSelect:self.btnDearToCheap isSelect:NO]; - [self setButtonSelect:self.btnCheapToDear isSelect:NO]; - _collectionSort = BUYCollectionSortCreatedDescending; -} - --(void)onClickDearToCheap:(id)sender{ - [self setButtonSelect:self.btnNewToOld isSelect:NO]; - [self setButtonSelect:self.btnDearToCheap isSelect:YES]; - [self setButtonSelect:self.btnCheapToDear isSelect:NO]; - _collectionSort = BUYCollectionSortPriceDescending; -} - --(void)onClickCheapToDear:(id)sender{ - [self setButtonSelect:self.btnNewToOld isSelect:NO]; - [self setButtonSelect:self.btnDearToCheap isSelect:NO]; - [self setButtonSelect:self.btnCheapToDear isSelect:YES]; - _collectionSort = BUYCollectionSortPriceAscending; -} - --(void)onClickBg:(id)sender{ - self.hidden = YES; - if(self.delegate!=nil){ - [self.delegate kwm_onHide]; - } -} - --(void)onClickComplete:(id)sender{ - self.hidden = YES; - if(self.delegate!=nil){ - [self.delegate kwm_onClickSort:_collectionSort]; - [self.delegate kwm_onHide]; - } -} - - - -@end diff --git a/iCemarose/Class/UI/Product/Cell/KWMFilterView.xib b/iCemarose/Class/UI/Product/Cell/KWMFilterView.xib deleted file mode 100644 index d8d1111..0000000 --- a/iCemarose/Class/UI/Product/Cell/KWMFilterView.xib +++ /dev/null @@ -1,126 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16A323" 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="11524"/> - <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMFilterView"> - <connections> - <outlet property="btnCheapToDear" destination="eOi-uc-TfU" id="jQl-hk-HyC"/> - <outlet property="btnDearToCheap" destination="yYc-hx-ogT" id="MwR-JV-czr"/> - <outlet property="btnNewToOld" destination="3uq-sv-8x0" id="3oF-ne-5qM"/> - <outlet property="vContent" destination="iN0-l3-epB" id="C7r-lm-tvu"/> - </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> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dC1-cs-Gvq" userLabel="bg"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> - <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="calibratedRGB"/> - <connections> - <action selector="onClickBg:" destination="-1" eventType="touchUpInside" id="bcL-09-Pgy"/> - </connections> - </button> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Mcn-wz-yiS" userLabel="content"> - <rect key="frame" x="0.0" y="0.0" width="375" height="167"/> - <subviews> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hfL-49-KeK" userLabel="line"> - <rect key="frame" x="0.0" y="0.0" width="375" height="1"/> - <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> - <constraints> - <constraint firstAttribute="height" constant="1" id="qs9-cz-lay"/> - </constraints> - </view> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3uq-sv-8x0"> - <rect key="frame" x="35" y="25" width="93" height="37"/> - <constraints> - <constraint firstAttribute="width" secondItem="3uq-sv-8x0" secondAttribute="height" multiplier="90:36" id="DQF-P3-FPq"/> - </constraints> - <state key="normal" title="新-旧款"> - <color key="titleColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="calibratedRGB"/> - </state> - <connections> - <action selector="onClikcNewToOld:" destination="-1" eventType="touchUpInside" id="Gwa-ds-gT6"/> - </connections> - </button> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yYc-hx-ogT"> - <rect key="frame" x="141" y="25" width="93" height="37"/> - <constraints> - <constraint firstAttribute="width" secondItem="yYc-hx-ogT" secondAttribute="height" multiplier="91:36" id="CC0-Bf-ZAI"/> - </constraints> - <state key="normal" title="高-低价"> - <color key="titleColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="calibratedRGB"/> - </state> - <connections> - <action selector="onClickDearToCheap:" destination="-1" eventType="touchUpInside" id="wq2-ti-3Ft"/> - </connections> - </button> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eOi-uc-TfU"> - <rect key="frame" x="247" y="25" width="93" height="37"/> - <constraints> - <constraint firstAttribute="width" secondItem="eOi-uc-TfU" secondAttribute="height" multiplier="91:36" id="RcS-2a-KZA"/> - </constraints> - <state key="normal" title="低-高价"> - <color key="titleColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="calibratedRGB"/> - </state> - <connections> - <action selector="onClickCheapToDear:" destination="-1" eventType="touchUpInside" id="nKH-wI-Clg"/> - </connections> - </button> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wp2-h3-MDu"> - <rect key="frame" x="40" y="82" width="295" height="50"/> - <color key="backgroundColor" red="0.14117647059999999" green="0.14117647059999999" blue="0.14117647059999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - <constraints> - <constraint firstAttribute="height" constant="50" id="i4C-Bz-g8w"/> - </constraints> - <state key="normal" title="完成"> - <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - </state> - <connections> - <action selector="onClickComplete:" destination="-1" eventType="touchUpInside" id="Gzv-UN-y3x"/> - </connections> - </button> - </subviews> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - <constraints> - <constraint firstAttribute="trailing" secondItem="wp2-h3-MDu" secondAttribute="trailing" constant="40" id="Adb-ir-4QC"/> - <constraint firstItem="hfL-49-KeK" firstAttribute="top" secondItem="Mcn-wz-yiS" secondAttribute="top" id="FvN-ZR-ZWt"/> - <constraint firstItem="yYc-hx-ogT" firstAttribute="width" secondItem="3uq-sv-8x0" secondAttribute="width" id="OGR-nu-DkG"/> - <constraint firstAttribute="trailing" secondItem="hfL-49-KeK" secondAttribute="trailing" id="RJL-GC-hgv"/> - <constraint firstItem="3uq-sv-8x0" firstAttribute="top" secondItem="Mcn-wz-yiS" secondAttribute="top" constant="25" id="Rdb-hW-dwA"/> - <constraint firstItem="eOi-uc-TfU" firstAttribute="leading" secondItem="yYc-hx-ogT" secondAttribute="trailing" constant="13" id="UGn-Z9-Qrq"/> - <constraint firstItem="eOi-uc-TfU" firstAttribute="width" secondItem="3uq-sv-8x0" secondAttribute="width" id="V6d-ff-DvU"/> - <constraint firstItem="yYc-hx-ogT" firstAttribute="leading" secondItem="3uq-sv-8x0" secondAttribute="trailing" constant="13" id="XMQ-Bi-lGl"/> - <constraint firstItem="eOi-uc-TfU" firstAttribute="top" secondItem="Mcn-wz-yiS" secondAttribute="top" constant="25" id="YwO-Pb-jze"/> - <constraint firstItem="hfL-49-KeK" firstAttribute="leading" secondItem="Mcn-wz-yiS" secondAttribute="leading" id="aTF-jw-AGm"/> - <constraint firstItem="wp2-h3-MDu" firstAttribute="top" secondItem="eOi-uc-TfU" secondAttribute="bottom" constant="20" id="cmM-Wl-DeA"/> - <constraint firstItem="yYc-hx-ogT" firstAttribute="top" secondItem="Mcn-wz-yiS" secondAttribute="top" constant="25" id="dtZ-MZ-Fzb"/> - <constraint firstItem="wp2-h3-MDu" firstAttribute="leading" secondItem="Mcn-wz-yiS" secondAttribute="leading" constant="40" id="gfv-Ca-fVR"/> - <constraint firstAttribute="trailing" secondItem="eOi-uc-TfU" secondAttribute="trailing" constant="35" id="hLG-oK-pHp"/> - <constraint firstAttribute="bottom" secondItem="wp2-h3-MDu" secondAttribute="bottom" constant="35" id="okt-09-b6d"/> - <constraint firstItem="3uq-sv-8x0" firstAttribute="leading" secondItem="Mcn-wz-yiS" secondAttribute="leading" constant="35" id="usz-dJ-ttm"/> - </constraints> - </view> - </subviews> - <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> - <constraints> - <constraint firstItem="dC1-cs-Gvq" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="7DX-dD-mgz"/> - <constraint firstAttribute="trailing" secondItem="Mcn-wz-yiS" secondAttribute="trailing" id="BgH-OI-0Zh"/> - <constraint firstItem="dC1-cs-Gvq" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="EBW-Wf-bPg"/> - <constraint firstItem="Mcn-wz-yiS" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Nvz-6G-hdo"/> - <constraint firstItem="Mcn-wz-yiS" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Prs-A7-vRL"/> - <constraint firstAttribute="trailing" secondItem="dC1-cs-Gvq" secondAttribute="trailing" id="lKs-RH-iU5"/> - <constraint firstAttribute="bottom" secondItem="dC1-cs-Gvq" secondAttribute="bottom" id="pRe-E0-Lbd"/> - </constraints> - </view> - </objects> -</document> diff --git a/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.h b/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.h index ea4358c..482c60e 100644 --- a/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.h +++ b/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.h @@ -9,12 +9,13 @@ #import "KWMBasePageVC.h" #import "KWMProductType.h" #import "KWMDoubleTitleView.h" -#import "KWMFilterView.h" #import "KWMBrandCaramelCell.h" #import "UIColor+SAMAdditions.h" +#import "KWMNormalFilterTab.h" +#import "KWMNormalFilterView.h" //选中的商品列表 -@interface KWMSelectedGoodsVC : KWMBasePageVC<KWMBrandCaramelCellDelegate,KWMFilterDelegate> +@interface KWMSelectedGoodsVC : KWMBasePageVC<KWMBrandCaramelCellDelegate,KWMNormalFilterTabDelegate,KWMFilterDelegate> @property (weak, nonatomic) IBOutlet UITableView *tbvSelectedGoods; @@ -24,14 +25,10 @@ @property (weak, nonatomic) IBOutlet UIView *vHeard; -@property (weak, nonatomic) IBOutlet KWMDoubleTitleView *vDoubleTitle; +@property (weak, nonatomic) IBOutlet UIView *vNoData; -@property (weak, nonatomic) IBOutlet KWMFilterView *filterView; - -@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; diff --git a/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.m b/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.m index 0ad0151..93b4d47 100644 --- a/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.m +++ b/iCemarose/Class/UI/Product/KWMSelectedGoodsVC.m @@ -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,8 +49,9 @@ static NSString *idStr = @"KWMBrandCaramelCell"; } - (void)initView{ + + self.hasNextPage = NO; self.collectionSort = BUYCollectionSortCreatedDescending; - self.filterView.delegate = self; if(self.productType != nil){ //初始化双行标题栏 NSString *mTitle; @@ -69,22 +72,14 @@ static NSString *idStr = @"KWMBrandCaramelCell"; openPosition = -1; self.automaticallyAdjustsScrollViewInsets = NO; - rightButton =[UIButton buttonWithType:UIButtonTypeRoundedRect]; - rightButton.frame = CGRectMake(0, 5, 40, 20); - [rightButton addTarget:self action:@selector(clickRightButton) forControlEvents:UIControlEventTouchUpInside]; - [rightButton setTitle:@"排序 +" forState:UIControlStateNormal]; - UIBarButtonItem *button =[[UIBarButtonItem alloc] initWithCustomView:rightButton]; - self.navigationItem.rightBarButtonItem = button; - rightButton.titleLabel.font=[UIFont systemFontOfSize:11]; - [rightButton.layer setMasksToBounds:YES]; - rightButton.layer.cornerRadius = 1; //圆角(圆形) - rightButton.layer.borderColor = [UIColor sam_colorWithHex:@"4E4E4E"].CGColor; //要设置的颜色 - rightButton.layer.borderWidth = 1; //要设置的描边宽 - isSelect = NO; 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]; } @@ -119,59 +114,17 @@ static NSString *idStr = @"KWMBrandCaramelCell"; } } --(void)clickRightButton{ - -// UIToolbar *toolBar = [[UIToolbar alloc]initWithFrame:self.testImageView.frame]; -// toolBar.barStyle = UIBarStyleDefault; -// [self.view addSubview:toolBar]; - -// UIBlurEffect *beffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; -// UIVisualEffectView *view = [[UIVisualEffectView alloc]initWithEffect:beffect]; -// view.frame = self.testImageView.frame; -// [self.view addSubview:view]; - - if(self.isLoading){ - return; - } - self.filterView.hidden = !self.filterView.hidden; - self.filterView.collectionSort = self.collectionSort; - if(self.filterView.hidden){ - rightButton.titleLabel.text = @"排序 +"; - [rightButton setTitle:@"排序 +" forState:UIControlStateNormal]; - }else{ - - [rightButton setTitle:@"排序 -" forState:UIControlStateNormal]; - rightButton.titleLabel.text = @"排序 -"; - } -} - --(void)kwm_onClickSort:(BUYCollectionSort)sort{ - self.hasNextPage = YES; - self.collectionSort = sort; - [self reLoadData]; -} - --(void)kwm_onHide{ - if(self.filterView.hidden){ - rightButton.titleLabel.text = @"排序 +"; - [rightButton setTitle:@"排序 +" forState:UIControlStateNormal]; - }else{ - rightButton.titleLabel.text = @"排序 -"; - [rightButton setTitle:@"排序 -" forState:UIControlStateNormal]; - } -} - -(UITableView *)targetTableView{ return self.tbvSelectedGoods; } -(void)loadData{ - [self requesProductList:self.collectionSort]; + [self requestProductList]; } -(void)reLoadData{ self.currentPage = 0; - [self requesProductList:self.collectionSort]; + [self requestProductList]; } @@ -188,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 //点击左边商品回调 @@ -265,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]; @@ -281,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; @@ -313,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]; } diff --git a/iCemarose/Class/UI/Product/New.storyboard b/iCemarose/Class/UI/Product/New.storyboard index 378a8df..f85711a 100644 --- a/iCemarose/Class/UI/Product/New.storyboard +++ b/iCemarose/Class/UI/Product/New.storyboard @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.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="12086"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -137,57 +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" customClass="KWMFilterView"> - <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="filterView" destination="PWv-M7-7vS" id="piZ-Y6-d6q"/> + <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"> diff --git a/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m b/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m index a193699..66cd613 100644 --- a/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m +++ b/iCemarose/Class/UI/ShopCart/KWMEditAddressVC.m @@ -45,6 +45,17 @@ -(void)initTextField{ + //http://www.cocoachina.com/bbs/read.php?tid-250044-page-8.html #78 + //tf为无边框模式时,输入中文会导致文字下沉的问题。 + self.tfName.borderStyle = UITextBorderStyleNone; + self.tfPhone.borderStyle = UITextBorderStyleNone; + self.tfCountry.borderStyle = UITextBorderStyleNone; + self.tfProvince.borderStyle = UITextBorderStyleNone; + self.tfCity.borderStyle = UITextBorderStyleNone; + self.tfAddress.borderStyle = UITextBorderStyleNone; + self.tfAddressDetail.borderStyle = UITextBorderStyleNone; + self.tfZip.borderStyle = UITextBorderStyleNone; + self.tfName.delegate = self; self.tfPhone.delegate = self; self.tfCountry.delegate = self; diff --git a/iCemarose/Class/UI/ShopCart/ShopCart.storyboard b/iCemarose/Class/UI/ShopCart/ShopCart.storyboard index 7747de8..018820d 100644 --- a/iCemarose/Class/UI/ShopCart/ShopCart.storyboard +++ b/iCemarose/Class/UI/ShopCart/ShopCart.storyboard @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -1007,7 +1007,7 @@ <color key="textColor" red="0.3294117647" green="0.3294117647" blue="0.3294117647" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HDf-hH-avB" customClass="KWMTextFieldUtil"> + <textField opaque="NO" clipsSubviews="YES" contentMode="center" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" textAlignment="justified" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HDf-hH-avB" customClass="KWMTextFieldUtil"> <rect key="frame" x="83" y="0.0" width="282" height="45"/> <constraints> <constraint firstAttribute="height" constant="45" id="fdK-jr-TuV"/> @@ -1048,7 +1048,7 @@ <color key="textColor" red="0.32941176470588235" green="0.32941176470588235" blue="0.32941176470588235" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="bRG-pI-5pS" customClass="KWMTextFieldUtil"> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="bRG-pI-5pS" customClass="KWMTextFieldUtil"> <rect key="frame" x="83" y="3" width="282" height="41"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <textInputTraits key="textInputTraits"/> @@ -1084,7 +1084,7 @@ <color key="textColor" red="0.3294117647" green="0.3294117647" blue="0.3294117647" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="kd4-0K-k7c" customClass="KWMTextFieldUtil"> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="kd4-0K-k7c" customClass="KWMTextFieldUtil"> <rect key="frame" x="83" y="3" width="282" height="41"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <textInputTraits key="textInputTraits"/> @@ -1133,7 +1133,7 @@ <constraint firstAttribute="height" constant="1" id="Xhg-8c-TTH"/> </constraints> </view> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="E4Y-O9-BjA" customClass="KWMTextFieldUtil"> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="E4Y-O9-BjA" customClass="KWMTextFieldUtil"> <rect key="frame" x="83" y="3" width="282" height="41"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <textInputTraits key="textInputTraits"/> @@ -1170,7 +1170,7 @@ <constraint firstAttribute="height" constant="1" id="w26-gp-mS1"/> </constraints> </view> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="补充详细地址,如几号楼几单元" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ad4-zz-DYh" customClass="KWMTextFieldUtil"> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" placeholder="补充详细地址,如几号楼几单元" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ad4-zz-DYh" customClass="KWMTextFieldUtil"> <rect key="frame" x="83" y="3" width="282" height="41"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <textInputTraits key="textInputTraits"/> @@ -1207,7 +1207,7 @@ <constraint firstAttribute="height" constant="1" id="Km1-3W-vyS"/> </constraints> </view> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Wg1-Ef-7g2" customClass="KWMTextFieldUtil"> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Wg1-Ef-7g2" customClass="KWMTextFieldUtil"> <rect key="frame" x="83" y="3" width="282" height="41"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <textInputTraits key="textInputTraits"/> @@ -1237,7 +1237,7 @@ <color key="textColor" red="0.3294117647" green="0.3294117647" blue="0.3294117647" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DDB-bK-v5E" customClass="KWMTextFieldUtil"> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DDB-bK-v5E" customClass="KWMTextFieldUtil"> <rect key="frame" x="83" y="3" width="282" height="41"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <textInputTraits key="textInputTraits"/> @@ -1279,7 +1279,7 @@ <color key="textColor" red="0.3294117647" green="0.3294117647" blue="0.3294117647" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="zxl-Z1-xai"> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="zxl-Z1-xai"> <rect key="frame" x="83" y="3" width="282" height="41"/> <fontDescription key="fontDescription" type="system" pointSize="12"/> <textInputTraits key="textInputTraits" keyboardType="phonePad"/> diff --git a/iCemarose/Class/Util/KWMFilterUtil.h b/iCemarose/Class/Util/KWMFilterUtil.h new file mode 100644 index 0000000..10d5433 --- /dev/null +++ b/iCemarose/Class/Util/KWMFilterUtil.h @@ -0,0 +1,18 @@ +// +// 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 diff --git a/iCemarose/Class/Util/KWMFilterUtil.m b/iCemarose/Class/Util/KWMFilterUtil.m new file mode 100644 index 0000000..82d7c83 --- /dev/null +++ b/iCemarose/Class/Util/KWMFilterUtil.m @@ -0,0 +1,77 @@ +// +// 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 + diff --git a/iCemarose/Class/Util/KWMStringUtil.h b/iCemarose/Class/Util/KWMStringUtil.h index dfba54b..cef0317 100644 --- a/iCemarose/Class/Util/KWMStringUtil.h +++ b/iCemarose/Class/Util/KWMStringUtil.h @@ -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; diff --git a/iCemarose/Class/Util/KWMStringUtil.m b/iCemarose/Class/Util/KWMStringUtil.m index 72a32ff..47d55e2 100644 --- a/iCemarose/Class/Util/KWMStringUtil.m +++ b/iCemarose/Class/Util/KWMStringUtil.m @@ -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{ diff --git a/iCemarose/Class/View/FilterView/KWMFilterTabItem.h b/iCemarose/Class/View/FilterView/KWMFilterTabItem.h new file mode 100644 index 0000000..89fc1ee --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterTabItem.h @@ -0,0 +1,26 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMFilterTabItem.m b/iCemarose/Class/View/FilterView/KWMFilterTabItem.m new file mode 100644 index 0000000..436238b --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterTabItem.m @@ -0,0 +1,72 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMFilterTabItem.xib b/iCemarose/Class/View/FilterView/KWMFilterTabItem.xib new file mode 100644 index 0000000..72e557a --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterTabItem.xib @@ -0,0 +1,74 @@ +<?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> diff --git a/iCemarose/Class/View/FilterView/KWMFilterView.h b/iCemarose/Class/View/FilterView/KWMFilterView.h new file mode 100644 index 0000000..3b274c4 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterView.h @@ -0,0 +1,41 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMFilterView.m b/iCemarose/Class/View/FilterView/KWMFilterView.m new file mode 100644 index 0000000..69a2998 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterView.m @@ -0,0 +1,251 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMFilterView.xib b/iCemarose/Class/View/FilterView/KWMFilterView.xib new file mode 100644 index 0000000..3699e96 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterView.xib @@ -0,0 +1,90 @@ +<?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> diff --git a/iCemarose/Class/View/FilterView/KWMFilterViewCell.h b/iCemarose/Class/View/FilterView/KWMFilterViewCell.h new file mode 100644 index 0000000..5f218b0 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterViewCell.h @@ -0,0 +1,17 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMFilterViewCell.m b/iCemarose/Class/View/FilterView/KWMFilterViewCell.m new file mode 100644 index 0000000..8460693 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterViewCell.m @@ -0,0 +1,46 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMFilterViewCell.xib b/iCemarose/Class/View/FilterView/KWMFilterViewCell.xib new file mode 100644 index 0000000..083ec8b --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMFilterViewCell.xib @@ -0,0 +1,53 @@ +<?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> diff --git a/iCemarose/Class/View/FilterView/KWMNormalFilterTab.h b/iCemarose/Class/View/FilterView/KWMNormalFilterTab.h new file mode 100644 index 0000000..491a90d --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMNormalFilterTab.h @@ -0,0 +1,22 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMNormalFilterTab.m b/iCemarose/Class/View/FilterView/KWMNormalFilterTab.m new file mode 100644 index 0000000..e0ed2c0 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMNormalFilterTab.m @@ -0,0 +1,56 @@ +// +// 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 diff --git a/iCemarose/Class/View/FilterView/KWMNormalFilterTab.xib b/iCemarose/Class/View/FilterView/KWMNormalFilterTab.xib new file mode 100644 index 0000000..44da7d8 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMNormalFilterTab.xib @@ -0,0 +1,93 @@ +<?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> diff --git a/iCemarose/Class/View/FilterView/KWMNormalFilterView.h b/iCemarose/Class/View/FilterView/KWMNormalFilterView.h new file mode 100644 index 0000000..f9eaf26 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMNormalFilterView.h @@ -0,0 +1,24 @@ +// +// 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; + +-(void)show; + +@end diff --git a/iCemarose/Class/View/FilterView/KWMNormalFilterView.m b/iCemarose/Class/View/FilterView/KWMNormalFilterView.m new file mode 100644 index 0000000..7d31d06 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMNormalFilterView.m @@ -0,0 +1,88 @@ +// +// 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; + +@property(weak,nonatomic) IBOutlet NSLayoutConstraint *marginTopFilter; + +-(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; +} + +-(void)show{ + if(self.hidden){ + self.marginTopFilter.constant = -self.heightFilter.constant; + self.hidden = NO; + [self layoutIfNeeded]; + [UIView animateWithDuration:self.filterMode == ModeFilter?0.5:0.25 animations:^{ + self.marginTopFilter.constant = 0; + [self layoutIfNeeded]; + }]; + } +} + + +@end diff --git a/iCemarose/Class/View/FilterView/KWMNormalFilterView.xib b/iCemarose/Class/View/FilterView/KWMNormalFilterView.xib new file mode 100644 index 0000000..52db8b3 --- /dev/null +++ b/iCemarose/Class/View/FilterView/KWMNormalFilterView.xib @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <objects> + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="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="marginTopFilter" destination="SiA-l8-az5" id="Azb-Jh-GQP"/> + <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 clipsSubviews="YES" 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> diff --git a/iCemarose/Class/View/UIView+Prettify.h b/iCemarose/Class/View/UIView+Prettify.h new file mode 100644 index 0000000..1f7c72b --- /dev/null +++ b/iCemarose/Class/View/UIView+Prettify.h @@ -0,0 +1,23 @@ +// +// 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 diff --git a/iCemarose/Class/View/UIView+Prettify.m b/iCemarose/Class/View/UIView+Prettify.m new file mode 100644 index 0000000..c0dbadc --- /dev/null +++ b/iCemarose/Class/View/UIView+Prettify.m @@ -0,0 +1,31 @@ +// +// 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 diff --git a/iCemarose/Header-Prefix.h b/iCemarose/Header-Prefix.h index 8564c9c..58fab24 100644 --- a/iCemarose/Header-Prefix.h +++ b/iCemarose/Header-Prefix.h @@ -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 @@ -61,7 +62,7 @@ #define Cemarose_KEY @"4a119ac523d53c98bbd2983b798a0d53" -// +//// ////测试 //#define TestModel @"YES" //