Commit 187d6b44 by lee

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

parents 2041dd27 af78e5ba
......@@ -239,6 +239,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 */; };
C07267821F15D62400C5A869 /* NSLayoutConstraint+Multiplier.m in Sources */ = {isa = PBXBuildFile; fileRef = C07267811F15D62400C5A869 /* NSLayoutConstraint+Multiplier.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 */; };
......@@ -781,6 +782,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>"; };
C07267801F15D62400C5A869 /* NSLayoutConstraint+Multiplier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSLayoutConstraint+Multiplier.h"; sourceTree = "<group>"; };
C07267811F15D62400C5A869 /* NSLayoutConstraint+Multiplier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSLayoutConstraint+Multiplier.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>"; };
......@@ -1476,6 +1479,8 @@
801230F71DD32B49008C7904 /* KWMInformationView.xib */,
C0CCB3C31EEA5A1100BC2FB8 /* UIView+Prettify.h */,
C0CCB3C41EEA5A1100BC2FB8 /* UIView+Prettify.m */,
C07267801F15D62400C5A869 /* NSLayoutConstraint+Multiplier.h */,
C07267811F15D62400C5A869 /* NSLayoutConstraint+Multiplier.m */,
);
path = View;
sourceTree = "<group>";
......@@ -2712,6 +2717,7 @@
80C8014F1D78134800002306 /* KWMTBVSectionHeardView.m in Sources */,
C034E7C21D6B0B62006EE129 /* KWMMineVC.m in Sources */,
C08FDA271D9A5F3400EBDB0D /* KWMAddGiftCardVC.m in Sources */,
C07267821F15D62400C5A869 /* NSLayoutConstraint+Multiplier.m in Sources */,
C02C7D9E1E643323008DC29C /* KWMShareVC.m in Sources */,
C034E68F1D6AEB12006EE129 /* main.m in Sources */,
C0AF039E1DD5C8EE0060623F /* KWMNeedAddressView.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_triangle@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_triangle@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -40,7 +40,7 @@
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="jDD-sy-yjq" kind="relationship" relationship="rootViewController" id="bR2-jH-asw"/>
<segue destination="XF4-SN-2u5" kind="relationship" relationship="rootViewController" id="xlL-ZK-vZF"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vdi-Dj-NbC" userLabel="First Responder" sceneMemberID="firstResponder"/>
......@@ -79,7 +79,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kXl-Fh-EkW" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1802" y="618"/>
<point key="canvasLocation" x="1801" y="629"/>
</scene>
<!--我的-->
<scene sceneID="lpP-Lf-0K0">
......@@ -724,7 +724,7 @@
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="NBO-61-l1q" kind="relationship" relationship="rootViewController" id="vPW-jg-RE6"/>
<segue destination="kxV-Ho-iPP" kind="relationship" relationship="rootViewController" id="Fdp-3E-VOb"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7Z2-Md-Vzb" userLabel="First Responder" sceneMemberID="firstResponder"/>
......@@ -744,7 +744,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="lb3-DY-TZq">
<rect key="frame" x="0.0" y="65" width="375" height="553"/>
<rect key="frame" x="0.0" y="65" width="375" height="602"/>
<color key="backgroundColor" red="0.95686274509803915" green="0.96078431372549022" blue="0.96862745098039216" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="NBO-61-l1q" id="hvf-Sf-ffH"/>
......@@ -1081,13 +1081,13 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cXh-fM-IFd" userLabel="content">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<rect key="frame" x="0.0" y="64" width="375" height="554"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aPr-fM-NN3" userLabel="left">
<rect key="frame" x="0.0" y="0.0" width="90" height="603"/>
<rect key="frame" x="0.0" y="0.0" width="90" height="554"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="60" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="WcE-6c-JQz">
<rect key="frame" x="0.0" y="0.0" width="90" height="603"/>
<rect key="frame" x="0.0" y="0.0" width="90" height="554"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<connections>
......@@ -1106,7 +1106,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y72-jv-wgp" userLabel="right">
<rect key="frame" x="90" y="0.0" width="285" height="603"/>
<rect key="frame" x="90" y="0.0" width="285" height="554"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SZ2-n1-t6Q" customClass="KWMCategoryFilterTab">
<rect key="frame" x="0.0" y="0.0" width="285" height="40"/>
......@@ -1116,17 +1116,17 @@
</constraints>
</view>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="J3W-GJ-IkI">
<rect key="frame" x="0.0" y="40" width="285" height="563"/>
<rect key="frame" x="0.0" y="40" width="285" height="514"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="aHw-sn-1CW">
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="aHw-sn-1CW">
<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="18" minY="10" maxX="18" maxY="0.0"/>
<inset key="sectionInset" minX="8" minY="5" maxX="8" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="kQQ-r2-O5j">
<rect key="frame" x="18" y="10" width="50" height="50"/>
<rect key="frame" x="8" y="5" width="50" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
......@@ -1174,7 +1174,7 @@
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.95686274510000002" green="0.96078431369999995" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.95294117647058818" green="0.95686274509803915" blue="0.96470588235294119" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="cXh-fM-IFd" firstAttribute="leading" secondItem="bxl-E4-ZzW" secondAttribute="leading" id="nBW-PB-Lca"/>
<constraint firstItem="cXh-fM-IFd" firstAttribute="top" secondItem="bxl-E4-ZzW" secondAttribute="top" constant="64" id="rG9-rW-a8a"/>
......@@ -1206,7 +1206,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="T1z-z9-rlz">
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<rect key="frame" x="0.0" y="88" width="375" height="530"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="BcI-5v-hSE">
<size key="itemSize" width="50" height="50"/>
......@@ -1245,7 +1245,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="FmK-HG-RdK" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1169" y="1380"/>
<point key="canvasLocation" x="-346" y="2034"/>
</scene>
</scenes>
<resources>
......
......@@ -24,6 +24,8 @@
@property(nonatomic,weak) IBOutlet UILabel *lbCompareAtPrice;
@property(nonatomic,weak) IBOutlet UIView *vContent;
@end
@implementation KWMRightProductCell
......@@ -31,7 +33,7 @@
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
[self initDefaultShadow];
[self.vContent initDefaultShadow];
}
-(void)setProduct:(BUYProduct *)product{
......
......@@ -115,7 +115,7 @@
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
NSInteger width = ( (UI_SCREEN_WIDTH - 90) - (18*3) )/2;
NSInteger width = ( (UI_SCREEN_WIDTH - 90) - 8*2)/2;
NSInteger height = width * 160 / 114 ;
CGSize size = CGSizeMake(width, height);
return size;
......
......@@ -28,8 +28,10 @@
@property(nonatomic,weak) id<KWMHotSalesDelegate> delegate;
@property(nonatomic) NSArray *singleShowArray;
@property(nonatomic) NSArray<BUYProduct *> *singleShowArray;
@property(nonatomic) NSArray *bannerArray;
@property(nonatomic) NSArray<BUYProduct *> *bannerArray;
@property(nonatomic,readonly) NSInteger actrualHeight;
@end
......@@ -9,6 +9,7 @@
#import "KWMHotSalesHeader.h"
#import "KWMProductBannerItemView.h"
#import "UIImageView+WebCache.h"
#import "KWMNewHomeCell.h"
@interface KWMHotSalesHeader()
......@@ -16,6 +17,12 @@
@property (nonatomic,weak) IBOutlet KWMBannerView *bannerView;
@property (nonatomic,weak) IBOutlet UIView *singleShowView;
@property (nonatomic,weak) IBOutlet NSLayoutConstraint *heightBannerView;
@property (nonatomic,weak) IBOutlet NSLayoutConstraint *heightSingleShowView;
@end
@implementation KWMHotSalesHeader
......@@ -56,8 +63,15 @@
[self initView];
}
-(NSInteger)actrualHeight{
NSInteger height = 60 + self.heightSingleShowView.constant + self.heightBannerView.constant;
return height;
}
-(void)initView{
self.bannerView.delegate = self;
self.heightBannerView.constant = 0;
self.heightSingleShowView.constant = 0;
}
-(void)startBannerTimer{
......@@ -68,6 +82,35 @@
[self.bannerView removeTimer];
}
-(void)setBannerArray:(NSArray *)bannerArray{
_bannerArray = bannerArray;
if(bannerArray && bannerArray.count > 0){
self.heightBannerView.constant = 190;
[self.bannerView reloadData];
}else{
self.heightBannerView.constant = 0;
}
}
-(void)setSingleShowArray:(NSArray *)singleShowArray{
_singleShowArray = singleShowArray ? singleShowArray : [NSArray array];
NSInteger itemWidth = UI_SCREEN_WIDTH - 16;
NSInteger itemHeight = UI_SCREEN_WIDTH + 58;
for(int i=0;i<singleShowArray.count;i++){
BUYProduct *product = [singleShowArray objectAtIndex:i];
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"KWMNewHomeCell" owner:self options:nil];
KWMNewHomeCell *homeCell = [nib objectAtIndex:0];
homeCell.frame = CGRectMake(8, itemHeight*i, itemWidth, itemHeight);
homeCell.singleShow = YES;
homeCell.tag = i;
homeCell.product = product;
[self.singleShowView addSubview:homeCell];
}
self.heightSingleShowView.constant = itemHeight*singleShowArray.count;
}
#pragma mark - KWMBannerViewDelegate
-(UIView *)bannerView:(KWMBannerView *)bannerView reusingView:(UIView *)reusingView pageAtIndex:(NSInteger)index{
UIView *itemView = reusingView?reusingView:nil;
......@@ -82,11 +125,17 @@
}
-(NSInteger)numberOfPagesForBanner:(KWMBannerView *)bannerView{
return 4;
return self.bannerArray?self.bannerArray.count:0;
}
-(void)bannerView:(KWMBannerView *)bannerView onClickPage:(NSInteger)index{
BUYProduct *product = [self.bannerArray objectAtIndex:index];
if(self.delegate){
[self.delegate kwm_onClickProduct:product];
}
}
@end
......@@ -12,6 +12,9 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMHotSalesHeader">
<connections>
<outlet property="bannerView" destination="Ruv-UI-DGw" id="USH-xg-KHp"/>
<outlet property="heightBannerView" destination="NbW-Kh-s5O" id="zdT-r2-QNE"/>
<outlet property="heightSingleShowView" destination="7LG-U7-451" id="9MA-ha-ZlO"/>
<outlet property="singleShowView" destination="Dwm-lO-Zce" id="DKc-lA-7U0"/>
<outlet property="vView" destination="iN0-l3-epB" id="bI2-U9-soo"/>
</connections>
</placeholder>
......@@ -65,15 +68,17 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dwm-lO-Zce" userLabel="singleShowView">
<rect key="frame" x="0.0" y="250" width="375" height="50"/>
<rect key="frame" x="0.0" y="250" width="375" height="0.0"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" id="7LG-U7-451"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Ruv-UI-DGw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="9fw-Ph-Q4P"/>
<constraint firstItem="Ruv-UI-DGw" firstAttribute="top" secondItem="d0n-L5-xP1" secondAttribute="bottom" id="BTm-DX-XK4"/>
<constraint firstAttribute="bottom" secondItem="Dwm-lO-Zce" secondAttribute="bottom" id="Kxi-PL-odG"/>
<constraint firstAttribute="trailing" secondItem="Ruv-UI-DGw" secondAttribute="trailing" id="RLP-eB-Asb"/>
<constraint firstItem="d0n-L5-xP1" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="aWf-1E-iKC"/>
<constraint firstItem="d0n-L5-xP1" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="g82-sr-LTG"/>
......
......@@ -15,7 +15,7 @@
@property(nonatomic,weak) IBOutlet UIView *vContent;
//文本是否居中
@property(nonatomic) BOOL textAlignCenter;
@property(nonatomic) BOOL singleShow;
@property(nonatomic) BUYProduct *product;
......
......@@ -11,6 +11,9 @@
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
#import "NSLayoutConstraint+Multiplier.h"
#import "UIColor+SAMAdditions.h"
@interface KWMNewHomeCell()
......@@ -22,6 +25,12 @@
@property(nonatomic,weak) IBOutlet UIImageView *ivProduct;
@property(nonatomic,weak) IBOutlet UIView *vImageContentView;
@property(nonatomic,weak) IBOutlet NSLayoutConstraint *heightDetail;
@property(nonatomic,weak) IBOutlet NSLayoutConstraint *precentOfProductImageView;
@end
@implementation KWMNewHomeCell
......@@ -31,17 +40,20 @@
[self.vContent initDefaultShadow];
}
-(void)setTextAlignCenter:(BOOL)textAlignCenter{
if(textAlignCenter){
NSTextAlignment textAlignment = textAlignCenter?NSTextAlignmentCenter:NSTextAlignmentLeft;
-(void)setSingleShow:(BOOL)singleShow{
if(singleShow){
NSTextAlignment textAlignment = NSTextAlignmentCenter;
self.lbBrand.textAlignment = textAlignment;
self.lbName.textAlignment = textAlignment;
self.lbPrice.textAlignment = textAlignment;
self.lbName.numberOfLines = 1;
self.lbBrand.numberOfLines = 1;
self.precentOfProductImageView = [self.precentOfProductImageView updateMultiplier:0.7];
self.vImageContentView.backgroundColor = [UIColor sam_colorWithHex:@"E7D1BC"];
}
}
-(void)setProduct:(BUYProduct *)product{
_product = product;
if(product){
......@@ -60,12 +72,12 @@
+(NSInteger)acturlHeight:(BUYProduct *)product width:(NSInteger)width{
NSInteger lbNameWidth = width - 60;
UIFont *font = [UIFont systemFontOfSize:12];
UIFont *font = [UIFont systemFontOfSize:9];
if(SYSTEM_VERSION_LESS_THAN(@"9.0")){
[UIFont fontWithName:@"PingFang SC" size:12];
[UIFont fontWithName:@"PingFang SC" size:9];
}
NSInteger lbNameHeight = [KWMStringUtil getLabelHeight:product.title labelFont:font textWidth:lbNameWidth].height;
return 250 - 13 + lbNameHeight;
return width + 50 +lbNameHeight;
}
@end
......@@ -119,6 +119,7 @@ typedef enum{
[testArray addObject:[self.productArray objectAtIndex:0]];
[testArray addObject:[self.productArray objectAtIndex:1]];
[testArray addObject:[self.productArray objectAtIndex:2]];
[testArray addObject:[self.productArray objectAtIndex:4]];
self.hotSalesHeader.singleShowArray = testArray;
self.hotSalesHeader.bannerArray = testArray;
......@@ -212,6 +213,8 @@ typedef enum{
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
KWMNewHomeCell *homeCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([KWMNewHomeCell class]) forIndexPath:indexPath];
BUYProduct *product = [self.productArray objectAtIndex:indexPath.row];
homeCell.product = product;
return homeCell;
}
......@@ -272,7 +275,7 @@ typedef enum{
height = 310;
break;
case HeaderHotSales:
height = 250;
height = self.hotSalesHeader.actrualHeight;
break;
default:
break;
......@@ -286,8 +289,10 @@ typedef enum{
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGSize size = CGSizeMake((UI_SCREEN_WIDTH-30)/2, 230+(indexPath.row * 20));
// CGSize size = CGSizeMake((UI_SCREEN_WIDTH-30), 230+(indexPath.row * 20));
BUYProduct *product = [self.productArray objectAtIndex:indexPath.row];
NSInteger width = (UI_SCREEN_WIDTH-30)/2;
NSInteger height = [KWMNewHomeCell acturlHeight:product width:width];
CGSize size = CGSizeMake(width, height);
return size;
}
......
//
// NSLayoutConstraint+Multiplier.h
// iCemarose
//
// Created by HouWeiBin on 2017/7/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NSLayoutConstraint (Multiplier)
-(instancetype)updateMultiplier:(CGFloat)multiplier;
@end
//
// NSLayoutConstraint+Multiplier.m
// iCemarose
//
// Created by HouWeiBin on 2017/7/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "NSLayoutConstraint+Multiplier.h"
@implementation NSLayoutConstraint (Multiplier)
-(instancetype)updateMultiplier:(CGFloat)multiplier {
NSLayoutConstraint *newConstraint = [NSLayoutConstraint constraintWithItem:self.firstItem attribute:self.firstAttribute relatedBy:self.relation toItem:self.secondItem attribute:self.secondAttribute multiplier:multiplier constant:self.constant];
[newConstraint setPriority:self.priority];
newConstraint.shouldBeArchived = self.shouldBeArchived;
newConstraint.identifier = self.identifier;
newConstraint.active = true;
[NSLayoutConstraint deactivateConstraints:[NSArray arrayWithObjects:self, nil]];
[NSLayoutConstraint activateConstraints:[NSArray arrayWithObjects:newConstraint, nil]];
//NSLayoutConstraint.activateConstraints([newConstraint])
return newConstraint;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment