Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ios1x
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
ios1x
Commits
52b1c54f
Commit
52b1c54f
authored
Jul 11, 2017
by
houweibin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1,fix error
2,加入新首页test数据
parent
71db7491
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
335 additions
and
31 deletions
+335
-31
KWMCategoryVC.m
iCemarose/Class/UI/Category/KWMCategoryVC.m
+2
-4
KWMProductFilterVC.m
iCemarose/Class/UI/Category/KWMProductFilterVC.m
+5
-5
KWMAdHeader.h
iCemarose/Class/UI/NewHome/Cell/KWMAdHeader.h
+12
-0
KWMAdHeader.m
iCemarose/Class/UI/NewHome/Cell/KWMAdHeader.m
+18
-2
KWMClothingSetsCell.h
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsCell.h
+3
-0
KWMClothingSetsCell.m
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsCell.m
+28
-0
KWMClothingSetsCell.xib
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsCell.xib
+5
-0
KWMClothingSetsHeader.h
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsHeader.h
+13
-0
KWMClothingSetsHeader.m
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsHeader.m
+20
-1
KWMClothingSetsHeader.xib
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsHeader.xib
+2
-1
KWMHotSalesHeader.h
iCemarose/Class/UI/NewHome/Cell/KWMHotSalesHeader.h
+15
-0
KWMHotSalesHeader.m
iCemarose/Class/UI/NewHome/Cell/KWMHotSalesHeader.m
+1
-0
KWMMenuHeader.h
iCemarose/Class/UI/NewHome/Cell/KWMMenuHeader.h
+14
-0
KWMNewHomeCell.h
iCemarose/Class/UI/NewHome/Cell/KWMNewHomeCell.h
+5
-0
KWMNewHomeCell.m
iCemarose/Class/UI/NewHome/Cell/KWMNewHomeCell.m
+39
-4
KWMNewHomeCell.xib
iCemarose/Class/UI/NewHome/Cell/KWMNewHomeCell.xib
+5
-5
KWMProductBannerItemView.h
iCemarose/Class/UI/NewHome/Cell/KWMProductBannerItemView.h
+0
-1
KWMRecommendHeader.h
iCemarose/Class/UI/NewHome/Cell/KWMRecommendHeader.h
+10
-0
KWMRecommendHeader.m
iCemarose/Class/UI/NewHome/Cell/KWMRecommendHeader.m
+18
-1
KWMNewHomeVC.h
iCemarose/Class/UI/NewHome/KWMNewHomeVC.h
+6
-1
KWMNewHomeVC.m
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
+107
-6
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+4
-0
Header-Prefix.h
iCemarose/Header-Prefix.h
+3
-0
No files found.
iCemarose/Class/UI/Category/KWMCategoryVC.m
View file @
52b1c54f
...
...
@@ -71,7 +71,7 @@
[
self
initTbvLeft
];
[
self
initCvRight
];
self
.
sort
=
BUYCollectionSortCreated
A
scending
;
self
.
sort
=
BUYCollectionSortCreated
De
scending
;
self
.
selectBrands
=
@""
;
}
...
...
@@ -215,20 +215,18 @@
[
tags
addObject
:
self
.
selectBrands
];
}
[
self
.
client
getProductsPage
:
page
inCollection
:
@
(
171596038
)
withTags
:
tags
sortOrder
:
self
.
sort
completion
:^
(
NSArray
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
){
[
self
.
client
getProductsPage
:
page
inCollection
:
@
(
Collection_All_ID
)
withTags
:
tags
sortOrder
:
self
.
sort
completion
:^
(
NSArray
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
){
[
weakSelf
.
refreshUtil
hideLoading
];
weakSelf
.
filterTab
.
userInteractionEnabled
=
true
;
if
(
error
){
[
weakSelf
showError
:
error
];
}
else
{
weakSelf
.
refreshUtil
.
page
=
page
;
weakSelf
.
refreshUtil
.
hasNextPage
=
!
reachedEnd
;
[
weakSelf
.
refreshUtil
appendDataList
:
products
];
}
}];
}
...
...
iCemarose/Class/UI/Category/KWMProductFilterVC.m
View file @
52b1c54f
...
...
@@ -35,13 +35,13 @@
-
(
NSInteger
)
getSelectSortPosition
:
(
BUYCollectionSort
)
sort
{
switch
(
sort
)
{
case
BUYCollectionSortCreatedAscending
:
return
0
;
case
BUYCollectionSortCreatedDescending
:
return
0
;
case
BUYCollectionSortCreatedAscending
:
return
1
;
case
BUYCollectionSortPriceAscending
:
return
2
;
case
BUYCollectionSortPriceDescending
:
return
2
;
case
BUYCollectionSortPriceAscending
:
return
3
;
default
:
return
0
;
...
...
@@ -68,7 +68,7 @@
return
self
.
filterView
.
selectedTags
;
}
-
(
void
)
kwm_on
ClickFilter
:
(
KWMFilterView
*
)
filterView
{
-
(
void
)
kwm_on
FilterFinish
:
(
KWMFilterView
*
)
filterView
{
if
(
self
.
delegate
){
[
self
.
delegate
kwm_onCompleProductFilter
:
filterView
];
}
...
...
iCemarose/Class/UI/NewHome/Cell/KWMAdHeader.h
View file @
52b1c54f
...
...
@@ -8,6 +8,14 @@
#import "KWMBaseModel.h"
#import "KWMBannerView.h"
#import "KWMAdvertisement.h"
@protocol
KWMAdDelegate
<
NSObject
>
-
(
void
)
kwm_gotoWebView
:
(
NSString
*
)
url
;
@end
@interface
KWMAdHeader
:
UIView
<
KWMBannerViewDelegate
>
...
...
@@ -17,4 +25,8 @@
-
(
void
)
endBannerTimer
;
@property
(
nonatomic
)
NSArray
<
KWMAdvertisement
*>
*
adArray
;
@property
(
nonatomic
,
weak
)
id
<
KWMAdDelegate
>
delegate
;
@end
iCemarose/Class/UI/NewHome/Cell/KWMAdHeader.m
View file @
52b1c54f
...
...
@@ -7,6 +7,8 @@
//
#import "KWMAdHeader.h"
#import "UIImageView+WebCache.h"
@interface
KWMAdHeader
()
...
...
@@ -56,6 +58,11 @@
[
self
.
bannerView
removeTimer
];
}
-
(
void
)
setAdArray
:
(
NSArray
<
KWMAdvertisement
*>
*
)
adArray
{
_adArray
=
adArray
;
[
self
.
bannerView
reloadData
];
}
#pragma mark - KWMBannerViewDelegate
-
(
UIView
*
)
bannerView
:
(
KWMBannerView
*
)
bannerView
reusingView
:
(
UIView
*
)
reusingView
pageAtIndex
:
(
NSInteger
)
index
{
UIView
*
itemView
=
reusingView
?
reusingView
:
nil
;
...
...
@@ -65,7 +72,12 @@
}
else
{
topBannerItem
=
(
UIImageView
*
)
itemView
;
}
topBannerItem
.
image
=
[
UIImage
imageNamed
:
@"test_banner_1"
];
KWMAdvertisement
*
ad
=
[
self
.
adArray
objectAtIndex
:
index
];
NSURL
*
imageURL
=
[
NSURL
URLWithString
:
ad
.
image
];
[
topBannerItem
sd_setImageWithURL
:
imageURL
placeholderImage
:[
UIImage
imageNamed
:
@"ic_loading"
]];
//topBannerItem.image = [UIImage imageNamed:@"test_banner_1"];
topBannerItem
.
contentMode
=
UIViewContentModeScaleAspectFill
;
itemView
=
topBannerItem
;
...
...
@@ -73,10 +85,14 @@
}
-
(
NSInteger
)
numberOfPagesForBanner
:
(
KWMBannerView
*
)
bannerView
{
return
4
;
return
self
.
adArray
?
self
.
adArray
.
count
:
0
;
}
-
(
void
)
bannerView
:
(
KWMBannerView
*
)
bannerView
onClickPage
:
(
NSInteger
)
index
{
KWMAdvertisement
*
ad
=
[
self
.
adArray
objectAtIndex
:
index
];
if
(
self
.
delegate
){
[
self
.
delegate
kwm_gotoWebView
:
ad
.
url
];
}
}
@end
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsCell.h
View file @
52b1c54f
...
...
@@ -7,7 +7,10 @@
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@interface
KWMClothingSetsCell
:
UICollectionViewCell
@property
(
nonatomic
)
BUYProduct
*
product
;
@end
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsCell.m
View file @
52b1c54f
...
...
@@ -7,6 +7,20 @@
//
#import "KWMClothingSetsCell.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
@interface
KWMClothingSetsCell
()
@property
(
nonatomic
,
weak
)
IBOutlet
UILabel
*
lbName
;
@property
(
nonatomic
,
weak
)
IBOutlet
UILabel
*
lbPrice
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
ivProduct
;
@end
@implementation
KWMClothingSetsCell
...
...
@@ -14,4 +28,18 @@
[
super
awakeFromNib
];
}
-
(
void
)
setProduct
:
(
BUYProduct
*
)
product
{
_product
=
product
;
if
(
product
){
NSString
*
imageUrl
=
[
KWMImageUtil
getProductImageUrl
:
product
ImageSize
:
SmallImage
];
NSURL
*
imageURL
=
[
NSURL
URLWithString
:
imageUrl
];
[
self
.
ivProduct
sd_setImageWithURL
:
imageURL
placeholderImage
:[
UIImage
imageNamed
:
@"ic_loading"
]];
self
.
lbName
.
text
=
product
.
title
;
if
(
product
.
variantsArray
.
count
>
0
){
BUYProductVariant
*
variant
=
product
.
variantsArray
.
firstObject
;
self
.
lbPrice
.
text
=
[
KWMStringUtil
price
:
variant
.
price
];
}
}
}
@end
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsCell.xib
View file @
52b1c54f
...
...
@@ -70,6 +70,11 @@
<constraint
firstItem=
"HJW-BD-Yxt"
firstAttribute=
"top"
secondItem=
"gTV-IL-0wX"
secondAttribute=
"top"
id=
"yXo-lP-ZkK"
/>
</constraints>
<size
key=
"customSize"
width=
"84"
height=
"78"
/>
<connections>
<outlet
property=
"ivProduct"
destination=
"9za-nW-9Xw"
id=
"o4P-wq-5gE"
/>
<outlet
property=
"lbName"
destination=
"yLu-gy-qUp"
id=
"EyX-Dv-lZp"
/>
<outlet
property=
"lbPrice"
destination=
"ETG-Ir-uXq"
id=
"gGI-mJ-6Ms"
/>
</connections>
<point
key=
"canvasLocation"
x=
"75"
y=
"122"
/>
</collectionViewCell>
</objects>
...
...
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsHeader.h
View file @
52b1c54f
...
...
@@ -7,9 +7,22 @@
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@protocol
KWMClothingSetsDelegate
<
NSObject
>
-
(
void
)
kwm_onClickProduct
:
(
BUYProduct
*
)
product
;
@end
@interface
KWMClothingSetsHeader
:
UIView
<
UICollectionViewDataSource
,
UICollectionViewDelegate
>
+
(
NSString
*
)
kwmTag
;
@property
(
nonatomic
,
weak
)
id
<
KWMClothingSetsDelegate
>
delegate
;
@property
(
nonatomic
)
NSArray
*
productArray
;
@property
(
nonatomic
)
NSString
*
headerImage
;
@end
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsHeader.m
View file @
52b1c54f
...
...
@@ -8,6 +8,7 @@
#import "KWMClothingSetsHeader.h"
#import "KWMClothingSetsCell.h"
#import "UIImageView+WebCache.h"
@interface
KWMClothingSetsHeader
()
...
...
@@ -15,6 +16,8 @@
@property
(
nonatomic
,
weak
)
IBOutlet
UICollectionView
*
cvSets
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
ivHeader
;
@end
@implementation
KWMClothingSetsHeader
...
...
@@ -70,9 +73,25 @@
}
-
(
void
)
setProductArray
:
(
NSArray
*
)
productArray
{
_productArray
=
productArray
;
[
self
.
cvSets
reloadData
];
}
-
(
void
)
setHeaderImage
:
(
NSString
*
)
headerImage
{
_headerImage
=
headerImage
;
NSURL
*
imageURL
=
[
NSURL
URLWithString
:
headerImage
];
[
self
.
ivHeader
sd_setImageWithURL
:
imageURL
placeholderImage
:[
UIImage
imageNamed
:
@"ic_loading"
]];
}
#pragma mark - UICollectionViewDataSource
-
(
UICollectionViewCell
*
)
collectionView
:
(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
KWMClothingSetsCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
NSStringFromClass
([
KWMClothingSetsCell
class
])
forIndexPath
:
indexPath
];
BUYProduct
*
product
=
[
self
.
productArray
objectAtIndex
:
indexPath
.
row
];
cell
.
product
=
product
;
return
cell
;
}
...
...
@@ -86,7 +105,7 @@
}
-
(
NSInteger
)
collectionView
:
(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:
(
NSInteger
)
section
{
return
2
0
;
return
self
.
productArray
?
self
.
productArray
.
count
:
0
;
}
...
...
iCemarose/Class/UI/NewHome/Cell/KWMClothingSetsHeader.xib
View file @
52b1c54f
...
...
@@ -12,6 +12,7 @@
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"KWMClothingSetsHeader"
>
<connections>
<outlet
property=
"cvSets"
destination=
"Vrm-Ee-B8d"
id=
"Gd3-Qy-Yyl"
/>
<outlet
property=
"ivHeader"
destination=
"Xzr-zM-E25"
id=
"Baj-uk-PJK"
/>
<outlet
property=
"vView"
destination=
"iN0-l3-epB"
id=
"lK1-FX-gaB"
/>
</connections>
</placeholder>
...
...
@@ -85,6 +86,6 @@
</objects>
<resources>
<image
name=
"ic_triangle"
width=
"16"
height=
"16"
/>
<image
name=
"test_suit"
width=
"
16"
height=
"16
"
/>
<image
name=
"test_suit"
width=
"
375"
height=
"212
"
/>
</resources>
</document>
iCemarose/Class/UI/NewHome/Cell/KWMHotSalesHeader.h
View file @
52b1c54f
...
...
@@ -8,6 +8,15 @@
#import <UIKit/UIKit.h>
#import "KWMBannerView.h"
#import <Buy/Buy.h>
@protocol
KWMHotSalesDelegate
<
NSObject
>
-
(
void
)
kwm_onClickProduct
:
(
BUYProduct
*
)
product
;
@end
@interface
KWMHotSalesHeader
:
UIView
<
KWMBannerViewDelegate
>
...
...
@@ -17,4 +26,10 @@
-
(
void
)
endBannerTimer
;
@property
(
nonatomic
,
weak
)
id
<
KWMHotSalesDelegate
>
delegate
;
@property
(
nonatomic
)
NSArray
*
singleShowArray
;
@property
(
nonatomic
)
NSArray
*
bannerArray
;
@end
iCemarose/Class/UI/NewHome/Cell/KWMHotSalesHeader.m
View file @
52b1c54f
...
...
@@ -8,6 +8,7 @@
#import "KWMHotSalesHeader.h"
#import "KWMProductBannerItemView.h"
#import "UIImageView+WebCache.h"
@interface
KWMHotSalesHeader
()
...
...
iCemarose/Class/UI/NewHome/Cell/KWMMenuHeader.h
View file @
52b1c54f
...
...
@@ -8,8 +8,22 @@
#import "KWMBaseModel.h"
@protocol
KWMMenuDelegate
<
NSObject
>
-
(
void
)
kwm_onClickNewMenu
;
-
(
void
)
kwm_onClickHotMenu
;
-
(
void
)
kwm_onClickWishMenu
;
-
(
void
)
kwm_onClickDeliveryMenu
;
@end
@interface
KWMMenuHeader
:
UIView
+
(
NSString
*
)
kwmTag
;
@property
(
nonatomic
,
weak
)
id
<
KWMMenuDelegate
>
delegate
;
@end
iCemarose/Class/UI/NewHome/Cell/KWMNewHomeCell.h
View file @
52b1c54f
...
...
@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@interface
KWMNewHomeCell
:
UICollectionViewCell
...
...
@@ -16,4 +17,8 @@
//文本是否居中
@property
(
nonatomic
)
BOOL
textAlignCenter
;
@property
(
nonatomic
)
BUYProduct
*
product
;
+
(
NSInteger
)
acturlHeight
:(
BUYProduct
*
)
product
width
:(
NSInteger
)
width
;
@end
iCemarose/Class/UI/NewHome/Cell/KWMNewHomeCell.m
View file @
52b1c54f
...
...
@@ -8,6 +8,9 @@
#import "KWMNewHomeCell.h"
#import "UIView+Prettify.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
@interface
KWMNewHomeCell
()
...
...
@@ -17,6 +20,8 @@
@property
(
nonatomic
,
weak
)
IBOutlet
UILabel
*
lbPrice
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
ivProduct
;
@end
@implementation
KWMNewHomeCell
...
...
@@ -27,10 +32,40 @@
}
-
(
void
)
setTextAlignCenter
:
(
BOOL
)
textAlignCenter
{
NSTextAlignment
textAlignment
=
textAlignCenter
?
NSTextAlignmentCenter
:
NSTextAlignmentLeft
;
self
.
lbBrand
.
textAlignment
=
textAlignment
;
self
.
lbName
.
textAlignment
=
textAlignment
;
self
.
lbPrice
.
textAlignment
=
textAlignment
;
if
(
textAlignCenter
){
NSTextAlignment
textAlignment
=
textAlignCenter
?
NSTextAlignmentCenter
:
NSTextAlignmentLeft
;
self
.
lbBrand
.
textAlignment
=
textAlignment
;
self
.
lbName
.
textAlignment
=
textAlignment
;
self
.
lbPrice
.
textAlignment
=
textAlignment
;
self
.
lbName
.
numberOfLines
=
1
;
self
.
lbBrand
.
numberOfLines
=
1
;
}
}
-
(
void
)
setProduct
:
(
BUYProduct
*
)
product
{
_product
=
product
;
if
(
product
){
NSString
*
imageUrl
=
[
KWMImageUtil
getProductImageUrl
:
product
ImageSize
:
SmallImage
];
NSURL
*
imageURL
=
[
NSURL
URLWithString
:
imageUrl
];
[
self
.
ivProduct
sd_setImageWithURL
:
imageURL
placeholderImage
:[
UIImage
imageNamed
:
@"ic_loading"
]];
self
.
lbBrand
.
text
=
product
.
vendor
;
self
.
lbName
.
text
=
product
.
title
;
if
(
product
.
variantsArray
.
count
>
0
){
BUYProductVariant
*
variant
=
product
.
variantsArray
.
firstObject
;
self
.
lbPrice
.
text
=
[
KWMStringUtil
price
:
variant
.
price
];
}
}
}
+
(
NSInteger
)
acturlHeight
:
(
BUYProduct
*
)
product
width
:
(
NSInteger
)
width
{
NSInteger
lbNameWidth
=
width
-
60
;
UIFont
*
font
=
[
UIFont
systemFontOfSize
:
12
];
if
(
SYSTEM_VERSION_LESS_THAN
(
@"9.0"
)){
[
UIFont
fontWithName
:
@"PingFang SC"
size
:
12
];
}
NSInteger
lbNameHeight
=
[
KWMStringUtil
getLabelHeight
:
product
.
title
labelFont
:
font
textWidth
:
lbNameWidth
].
height
;
return
250
-
13
+
lbNameHeight
;
}
@end
iCemarose/Class/UI/NewHome/Cell/KWMNewHomeCell.xib
View file @
52b1c54f
...
...
@@ -13,17 +13,17 @@
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
<collectionViewCell
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
tag=
"1111"
contentMode=
"center"
id=
"gTV-IL-0wX"
customClass=
"KWMNewHomeCell"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"184"
height=
"
30
0"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"184"
height=
"
25
0"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<view
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"184"
height=
"
30
0"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"184"
height=
"
25
0"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<subviews>
<view
tag=
"999"
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"eUm-tt-XRm"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"184"
height=
"
30
0"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"184"
height=
"
25
0"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"PUL-8B-4lT"
>
<rect
key=
"frame"
x=
"10"
y=
"10"
width=
"164"
height=
"2
8
0"
/>
<rect
key=
"frame"
x=
"10"
y=
"10"
width=
"164"
height=
"2
3
0"
/>
<subviews>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"test_home_cloth_2"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Yw1-oo-Px9"
>
<rect
key=
"frame"
x=
"10"
y=
"10"
width=
"144"
height=
"144"
/>
...
...
@@ -37,7 +37,7 @@
<color
key=
"textColor"
red=
"0.3411764705882353"
green=
"0.3411764705882353"
blue=
"0.3411764705882353"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
</label>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Baby Girls Pink Cotton Dress"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"VtC-9N-HwV"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Baby Girls Pink Cotton Dress"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
numberOfLines=
"0"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"VtC-9N-HwV"
>
<rect
key=
"frame"
x=
"20"
y=
"191"
width=
"124"
height=
"13"
/>
<fontDescription
key=
"fontDescription"
name=
"PingFangSC-Regular"
family=
"PingFang SC"
pointSize=
"9"
/>
<color
key=
"textColor"
red=
"0.3411764705882353"
green=
"0.3411764705882353"
blue=
"0.3411764705882353"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
...
...
iCemarose/Class/UI/NewHome/Cell/KWMProductBannerItemView.h
View file @
52b1c54f
...
...
@@ -11,5 +11,4 @@
@interface
KWMProductBannerItemView
:
UIView
@end
iCemarose/Class/UI/NewHome/Cell/KWMRecommendHeader.h
View file @
52b1c54f
...
...
@@ -7,9 +7,19 @@
//
#import <UIKit/UIKit.h>
#import <Buy/Buy.h>
@protocol
KWMRecommendDelegate
<
NSObject
>
-
(
void
)
kwm_onClickProduct
:
(
BUYProduct
*
)
product
;
@end
@interface
KWMRecommendHeader
:
UIView
<
UICollectionViewDataSource
,
UICollectionViewDelegate
>
+
(
NSString
*
)
kwmTag
;
@property
(
nonatomic
,
weak
)
id
<
KWMRecommendDelegate
>
delegate
;
@property
(
nonatomic
)
NSArray
*
productArray
;
@end
iCemarose/Class/UI/NewHome/Cell/KWMRecommendHeader.m
View file @
52b1c54f
...
...
@@ -68,9 +68,18 @@
self
.
cvRecommend
.
collectionViewLayout
=
layout
;
}
-
(
void
)
setProductArray
:
(
NSArray
*
)
productArray
{
_productArray
=
productArray
;
[
self
.
cvRecommend
reloadData
];
}
#pragma mark - UICollectionViewDataSource
-
(
UICollectionViewCell
*
)
collectionView
:
(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
KWMCollectionCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
NSStringFromClass
([
KWMCollectionCell
class
])
forIndexPath
:
indexPath
];
BUYProduct
*
product
=
[
self
.
productArray
objectAtIndex
:
indexPath
.
row
];
[
cell
setData
:
product
];
return
cell
;
}
...
...
@@ -84,7 +93,15 @@
}
-
(
NSInteger
)
collectionView
:
(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:
(
NSInteger
)
section
{
return
20
;
return
self
.
productArray
?
self
.
productArray
.
count
:
0
;
}
-
(
void
)
collectionView
:
(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
[
collectionView
deselectItemAtIndexPath
:
indexPath
animated
:
YES
];
BUYProduct
*
product
=
[
self
.
productArray
objectAtIndex
:
indexPath
.
row
];
if
(
self
.
delegate
){
[
self
.
delegate
kwm_onClickProduct
:
product
];
}
}
@end
iCemarose/Class/UI/NewHome/KWMNewHomeVC.h
View file @
52b1c54f
...
...
@@ -9,7 +9,12 @@
#import "KWMBaseVC.h"
#import "KWMSearchBar.h"
#import <CHTCollectionViewWaterfallLayout.h>
#import "KWMAdHeader.h"
#import "KWMMenuHeader.h"
#import "KWMRecommendHeader.h"
#import "KWMClothingSetsHeader.h"
#import "KWMHotSalesHeader.h"
@interface
KWMNewHomeVC
:
KWMBaseVC
<
CHTCollectionViewDelegateWaterfallLayout
,
UICollectionViewDataSource
,
KWMSearchBarDelegate
>
@interface
KWMNewHomeVC
:
KWMBaseVC
<
CHTCollectionViewDelegateWaterfallLayout
,
UICollectionViewDataSource
,
KWMSearchBarDelegate
,
KWMAdDelegate
,
KWMMenuDelegate
,
KWMRecommendDelegate
,
KWMClothingSetsDelegate
,
KWMHotSalesDelegate
>
@end
iCemarose/Class/UI/NewHome/KWMNewHomeVC.m
View file @
52b1c54f
...
...
@@ -8,13 +8,9 @@
#import "KWMNewHomeVC.h"
#import "KWMShopCartVC.h"
#import "KWMAdHeader.h"
#import "KWMMenuHeader.h"
#import "KWMRecommendHeader.h"
#import "KWMClothingSetsHeader.h"
#import "KWMHotSalesHeader.h"
#import "KWMNewHomeCell.h"
#import "KWMSearchBar.h"
#import "KWMHomeData.h"
#import "KWMShoppingCart.h"
typedef
enum
{
...
...
@@ -48,6 +44,9 @@ typedef enum{
@property
(
nonatomic
,
strong
)
KWMSearchBar
*
titleView
;
@property
(
nonatomic
)
KWMHomeData
*
homeData
;
@property
(
nonatomic
)
NSArray
<
BUYProduct
*>*
productArray
;
@end
...
...
@@ -56,6 +55,7 @@ typedef enum{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
initView
];
[
self
requestProduct
:
@""
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
...
...
@@ -84,6 +84,49 @@ typedef enum{
}
}
-
(
void
)
initTestData
{
KWMHomeData
*
homeData
=
[
KWMHomeData
new
];
KWMHotSales
*
hotSales
=
[
KWMHotSales
new
];
hotSales
.
singleShowCount
=
@
(
3
);
KWMAdvertisement
*
clothingSets
=
[
KWMAdvertisement
new
];
clothingSets
.
image
=
@"http://o42yton8r.qnssl.com/s/files/1/1089/5284/collections/b_8d773a6f-6a70-4d15-a280-e4dd13a7a744_large.jpg?v=1464083899"
;
clothingSets
.
url
=
@"http://www.baidu.com"
;
clothingSets
.
title
=
@"boy"
;
NSMutableArray
*
adBanner
=
[
NSMutableArray
array
];
[
adBanner
addObject
:[
clothingSets
copy
]];
[
adBanner
addObject
:[
clothingSets
copy
]];
[
adBanner
addObject
:[
clothingSets
copy
]];
homeData
.
hotSales
=
hotSales
;
homeData
.
clothingSets
=
clothingSets
;
homeData
.
adBanner
=
adBanner
;
self
.
homeData
=
homeData
;
[
self
initData
];
}
-
(
void
)
initData
{
if
(
self
.
homeData
){
self
.
adHeader
.
adArray
=
self
.
homeData
.
adBanner
;
self
.
recommendHeader
.
productArray
=
self
.
productArray
;
self
.
clothingSetsHeader
.
productArray
=
self
.
productArray
;
self
.
clothingSetsHeader
.
headerImage
=
self
.
homeData
.
clothingSets
.
image
;
NSMutableArray
*
testArray
=
[
NSMutableArray
array
];
[
testArray
addObject
:[
self
.
productArray
objectAtIndex
:
0
]];
[
testArray
addObject
:[
self
.
productArray
objectAtIndex
:
1
]];
[
testArray
addObject
:[
self
.
productArray
objectAtIndex
:
2
]];
self
.
hotSalesHeader
.
singleShowArray
=
testArray
;
self
.
hotSalesHeader
.
bannerArray
=
testArray
;
[
self
.
cvHome
reloadData
];
}
}
-
(
void
)
initView
{
self
.
title
=
@"首页"
;
self
.
adHeader
=
[[
KWMAdHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
275
)];
...
...
@@ -91,6 +134,13 @@ typedef enum{
self
.
recommendHeader
=
[[
KWMRecommendHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
230
)];
self
.
clothingSetsHeader
=
[[
KWMClothingSetsHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
310
)];
self
.
hotSalesHeader
=
[[
KWMHotSalesHeader
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UI_SCREEN_WIDTH
,
250
)];
self
.
adHeader
.
delegate
=
self
;
self
.
menuHeader
.
delegate
=
self
;
self
.
recommendHeader
.
delegate
=
self
;
self
.
clothingSetsHeader
.
delegate
=
self
;
self
.
hotSalesHeader
.
delegate
=
self
;
[
self
initTitleView
];
[
self
initCollectionView
];
}
...
...
@@ -120,6 +170,33 @@ typedef enum{
[
self
.
cvHome
registerClass
:[
UICollectionReusableView
class
]
forSupplementaryViewOfKind
:
CHTCollectionElementKindSectionHeader
withReuseIdentifier
:
[
KWMMenuHeader
kwmTag
]];
}
#pragma mark - KWMAdDelegate
-
(
void
)
kwm_gotoWebView
:
(
NSString
*
)
url
{
}
#pragma mark - KWMMenuDelegate
-
(
void
)
kwm_onClickHotMenu
{
}
-
(
void
)
kwm_onClickNewMenu
{
}
-
(
void
)
kwm_onClickWishMenu
{
}
-
(
void
)
kwm_onClickDeliveryMenu
{
}
#pragma makr - KWMRecommendDelegate KWMClothingSetsDelegate KWMHotSalesDelegate
-
(
void
)
kwm_onClickProduct
:
(
BUYProduct
*
)
product
{
}
#pragma mark - UICollectionViewDataSource
-
(
NSInteger
)
numberOfSectionsInCollectionView
:
(
UICollectionView
*
)
collectionView
{
...
...
@@ -128,7 +205,7 @@ typedef enum{
-
(
NSInteger
)
collectionView
:
(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:
(
NSInteger
)
section
{
if
(
section
==
HeaderHotSales
){
return
1
0
;
return
self
.
productArray
?
self
.
productArray
.
count
:
0
;
}
return
0
;
}
...
...
@@ -221,5 +298,29 @@ typedef enum{
[
self
.
navigationController
pushViewController
:
contactVC
animated
:
YES
];
}
#pragma makr - api
-
(
void
)
requestProduct
:
(
NSString
*
)
tag
{
NSMutableArray
*
tags
=
nil
;
if
(
tag
){
tags
=
[
NSMutableArray
array
];
[
tags
addObject
:
tag
];
}
__weak
KWMNewHomeVC
*
weakSelf
=
self
;
[
self
showLoading
];
[
self
.
client
getProductsPage
:
1
inCollection
:
@
(
Collection_All_ID
)
withTags
:
tags
sortOrder
:
BUYCollectionSortBestSelling
completion
:^
(
NSArray
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
){
[
weakSelf
hideLoading
];
if
(
error
){
[
weakSelf
showError
:
error
];
}
else
if
(
products
&&
products
.
count
>
0
){
weakSelf
.
productArray
=
products
;
[
weakSelf
.
cvHome
reloadData
];
[
weakSelf
initTestData
];
}
}];
}
@end
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
52b1c54f
...
...
@@ -353,4 +353,8 @@
}
@end
iCemarose/Header-Prefix.h
View file @
52b1c54f
...
...
@@ -104,6 +104,9 @@
#define BigImage 3
//collection all的id
#define Collection_All_ID 191372166
//默认欧元汇率,如果安装后第一次请求最新汇率数据失败,会使用该汇率显示价格
//#define ExchangeRate 7.6625
//#define ExchangeRateString @"7.6625"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment