Commit c8043a7c by lee

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

parents a1b63a16 036617e2
......@@ -9,7 +9,6 @@
#import <UIKit/UIKit.h>
#import "KWMNewGoodsCell.h"
#import "KWMPointView.h"
@class KWMBottomView;
@protocol KWMBottomViewDelegate <NSObject>
......@@ -40,7 +39,6 @@
@property (nonatomic) NSInteger count;
@property (nonatomic) KWMPointView *vPoint;
//isSameBrand 是否同一品牌商品
-(void)setData:(NSArray *)products isSameBrand:(BOOL)isSameBrand;
......
//
// KWMRecommendView.h
// iCemarose
//
// Created by HouWeiBin on 2017/1/12.
// Copyright © 2017年 kollway. All rights reserved.
//
@interface KWMRecommendView : UIView
@end
//
// KWMRecommendView.m
// iCemarose
//
// Created by HouWeiBin on 2017/1/12.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMRecommendView.h"
@interface KWMRecommendView ()
@property(nonatomic,weak) IBOutlet UIView *vView;
@end
@implementation KWMRecommendView
- (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.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView];
}
@end
//
// KWMTopView.h
// iCemarose
//
// Created by 陈荣科 on 16/9/6.
// Copyright © 2016年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "KWMPointView.h"
#import "KWMWatchView.h"
#import "Buy/Buy.h"
@class KWMTopView;
@protocol KWMTopViewDelegate <NSObject>
- (void)kwm_wacthLargeImage:(NSMutableArray *)imageArr;
- (void)kwm_onClickInformationBtn;
- (void)kwm_onClickSizeBtn;
- (void)kwm_goToBrandVC:(NSString *)brand;
@end
@interface KWMTopView : UIView<UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate,KWMWatchViewDelegate>
@property (weak, nonatomic) IBOutlet UIView *vContent;
@property (weak, nonatomic) IBOutlet UIScrollView *sclDetail;
@property (weak, nonatomic) IBOutlet UIButton *btnBrand;
@property (weak, nonatomic) IBOutlet UILabel *lbGoodName;
@property (weak, nonatomic) IBOutlet UILabel *lbPrice;
@property (weak, nonatomic) IBOutlet UILabel *lbDiscount;
@property (weak, nonatomic) IBOutlet UIButton *btnInformation;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *discountLeft;//左边间距
@property (nonatomic) NSMutableArray *imageArr;
@property (weak, nonatomic) id<KWMTopViewDelegate>delegate;
@property (nonatomic) KWMPointView *vPoint;
@property (nonatomic) BUYProduct *product;
- (void)setImage:(NSString *)imageurl;
-(void)setData:(BUYProduct *)product;
- (IBAction)onClickSizeBtn:(id)sender;
- (IBAction)onClickInformationBtn:(id)sender;
- (IBAction)onClickBlandBtn:(id)sender;
@end
//
// KWMWatchView.h
// iCemarose
//
// Created by 陈荣科 on 16/9/2.
// Copyright © 2016年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Buy/Buy.h"
#import "KWMImage.h"
@protocol KWMWatchViewDelegate <NSObject>
- (void)kwm_showLargeImage;
@end
@interface KWMWatchView : UIView
@property (weak, nonatomic) IBOutlet UIView *vContent;
@property (weak, nonatomic) IBOutlet UIImageView *ivShow;
@property (nonatomic) NSInteger tagId;
@property (nonatomic) KWMImage *imageLink;
@property (nonatomic) NSString *imageURL;
@property (weak, nonatomic) id<KWMWatchViewDelegate>delegate;
@property (nonatomic) UIView *vBackground;
- (void)setImage:(NSString *)imageurl;
- (void)setData:(KWMImage *)image;
@end
//
// KWMWatchView.m
// iCemarose
//
// Created by 陈荣科 on 16/9/2.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWMWatchView.h"
#import "YYWebImage/YYWebImage.h"
#import "KWMStringUtil.h"
@implementation KWMWatchView
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
[self initView];
}
return self;
}
- (void)awakeFromNib{
[super awakeFromNib];
[self initView];
}
- (void)initView{
[[NSBundle mainBundle] loadNibNamed:@"KWMWatchView" owner:self options:nil];
[self addSubview:self.vContent];
self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:_vContent];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickImage:)];
[self.ivShow addGestureRecognizer:tapGesture];
self.ivShow.userInteractionEnabled = YES;
NSLog(@"image Height :%lf",self.frame.size.height);
// self.ivShow.layer.borderWidth = 1;
// self.ivShow.layer.borderColor = [UIColor redColor].CGColor;
}
- (void)onClickImage:(UITapGestureRecognizer *)tapGesture{
if ([KWMStringUtil isEmpty:_imageURL]) {
return;
}
NSURL *url = [NSURL URLWithString:_imageURL];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
// [self addShowImage:image];
if ([self.delegate respondsToSelector:@selector(kwm_showLargeImage)]) {
[self.delegate kwm_showLargeImage];
}
}
//- (void)addShowImage:(UIImage *)image{
// UIView *vBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_SCREEN_HEITHT)];
// vBackground.backgroundColor = [UIColor blackColor];
// _vBackground = vBackground;
// UITapGestureRecognizer *largeTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(leaveLargeImage)];
// [vBackground addGestureRecognizer:largeTap];
//
// vBackground.layer.borderWidth = 1;
// vBackground.layer.borderColor = [UIColor redColor].CGColor;
//
// [self.vContent addSubview:vBackground];
// UIImageView *vImage = [[UIImageView alloc] init];
// vImage.image = image;
// vImage.frame = _ivShow.frame;
// [vBackground addSubview:vImage];
//
// vImage.layer.borderWidth = 1;
// vImage.layer.borderColor = [UIColor greenColor].CGColor;
//
// [self shakeToShow:vBackground];
//}
//放大过程中出现的缓慢动画
//- (void)shakeToShow:(UIView*)aView{
// CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
// animation.duration = 0.5;
// NSMutableArray *values = [NSMutableArray array];
// [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]];
// [values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]];
// animation.values = values;
// [aView.layer addAnimation:animation forKey:nil];
//}
//- (void)leaveLargeImage{
// [_vBackground removeFromSuperview];
//}
//
- (void)setImage:(NSString *)imageurl{
if([KWMStringUtil isEmpty:imageurl]){
return;
}
_imageURL = imageurl;
NSURL *imageURL = [NSURL URLWithString:imageurl];
[self.ivShow yy_setImageWithURL:imageURL options:YYWebImageOptionProgressive];
}
- (void)setData:(KWMImage *)image{
self.imageLink = image;
if(image!=nil && image.value!=nil){
NSURL *imageURL = [NSURL URLWithString:image.getBigImage]; //string>url
// 渐进式:边下载边显示
[self.ivShow yy_setImageWithURL:imageURL options:YYWebImageOptionProgressive];
// // 渐进式加载,增加模糊效果和渐变动画
// [self.ivShow yy_setImageWithURL:imageURL options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation];
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" 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="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMWatchView">
<connections>
<outlet property="ivShow" destination="GzB-SI-xEv" id="stu-Lp-rKs"/>
<outlet property="vContent" destination="TOA-vR-7co" id="Rfs-nL-xRh"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="TOA-vR-7co">
<rect key="frame" x="0.0" y="0.0" width="375" height="487"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="GzB-SI-xEv">
<rect key="frame" x="0.0" y="0.0" width="375" height="487"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="GzB-SI-xEv" firstAttribute="top" secondItem="TOA-vR-7co" secondAttribute="top" id="2n8-oh-7f0"/>
<constraint firstAttribute="bottom" secondItem="GzB-SI-xEv" secondAttribute="bottom" id="Gie-wx-LM2"/>
<constraint firstItem="GzB-SI-xEv" firstAttribute="leading" secondItem="TOA-vR-7co" secondAttribute="leading" id="HZT-Mu-7hb"/>
<constraint firstAttribute="trailing" secondItem="GzB-SI-xEv" secondAttribute="trailing" id="JcO-hR-fV2"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="161.5" y="-235.5"/>
</view>
</objects>
</document>
......@@ -13,7 +13,6 @@
#import "PhotoBroswerVC.h"
#import "KWMStringUtil.h"
#import "KWMShopCartData.h"
#import "KWMRecommendView.h"
#import "KWMInformationVC.h"
#import "KWMBrandCaramelVC.h"
#import "KWMSelectSizeVC.h"
......
......@@ -158,7 +158,7 @@
return productImages;
}
for(BUYImageLink *imageLink in imageLinks){
NSString *productImage = [imageLink.sourceURL.absoluteString stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:@"o42yton8r.qnssl.com"];
NSString *productImage = imageLink.sourceURL.absoluteString;
[productImages addObject:productImage];
}
return productImages;
......@@ -177,8 +177,7 @@
for(NSDictionary *imageLink in imageLinks){
if(imageLink[@"src"]){
NSString *originalImage = imageLink[@"src"];
NSString *productImage = [originalImage stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:Image_Domain];
[productImages addObject:productImage];
[productImages addObject:originalImage];
}
}
return productImages;
......@@ -217,18 +216,22 @@
[newImageUrl insertString:size atIndex:startRange.location+1];
}
}
return [NSString stringWithFormat:@"%@",newImageUrl];;
return [newImageUrl stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:Image_Domain];
}
+(NSArray *)getImageWH:(NSInteger)ImageSize{
if(ImageSize == BigImage){
switch (ImageSize) {
case BigImage:
return @[@"1000", @"1000"];
}else if(ImageSize == SmallImage){
case SmallImage:
return @[@"300", @"300"];
}else if(ImageSize == LowImage){
case LowImage:
return @[@"150", @"150"];
}else{
case NormalImage:
return @[@"500", @"500"];
default:
return @[@"300", @"300"];
}
}
......@@ -236,6 +239,7 @@
NSArray *imageUrls = nil;
if(product){
imageUrls = [self getImageArrayBySize:product ImageSize:ImageSize];
return imageUrls;
}
return nil;
}
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMGoodsDetailsView">
<connections>
<outlet property="btnBack" destination="dj8-zh-f7B" id="TOX-Ko-Ose"/>
<outlet property="btnShopCart" destination="7lT-gs-3xj" id="tCa-lJ-BV9"/>
<outlet property="lbCount" destination="DW7-A8-SBA" id="55B-os-bN2"/>
<outlet property="lbTitle" destination="Idl-tT-18D" id="aaW-ez-pBQ"/>
<outlet property="vContent" destination="OmW-DA-41S" id="gFi-0w-2FS"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="OmW-DA-41S" userLabel="vContent">
<rect key="frame" x="0.0" y="0.0" width="375" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rwj-1i-py3">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="YWo-tg-Ybv"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mtf-um-gT2">
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dj8-zh-f7B">
<constraints>
<constraint firstAttribute="width" constant="44" id="M0o-U9-UNu"/>
<constraint firstAttribute="height" constant="44" id="Uvf-7x-hZC"/>
</constraints>
<state key="normal" image="button_close"/>
<connections>
<action selector="onClickBackBtn:" destination="-1" eventType="touchUpInside" id="CIS-9e-JFY"/>
</connections>
</button>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="其他" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Idl-tT-18D">
<constraints>
<constraint firstAttribute="height" constant="29" id="8cK-96-uIX"/>
<constraint firstAttribute="width" constant="42" id="JSo-dk-kd4"/>
</constraints>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="20"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7lT-gs-3xj">
<constraints>
<constraint firstAttribute="height" constant="44" id="eON-Mk-h0L"/>
<constraint firstAttribute="width" constant="44" id="sNA-Ns-iQS"/>
</constraints>
<state key="normal" image="btn_ nav_shop cart"/>
<connections>
<action selector="onClickShopCartBtn:" destination="-1" eventType="touchUpInside" id="jvw-jF-irC"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DW7-A8-SBA">
<constraints>
<constraint firstAttribute="height" constant="14" id="eIZ-Sg-ujI"/>
<constraint firstAttribute="width" constant="14" id="iGS-Ol-pWf"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="DW7-A8-SBA" firstAttribute="trailing" secondItem="7lT-gs-3xj" secondAttribute="trailing" constant="-11" id="4Wp-Vg-ejT"/>
<constraint firstAttribute="trailing" secondItem="7lT-gs-3xj" secondAttribute="trailing" constant="10" id="EwZ-fr-IAm"/>
<constraint firstItem="Idl-tT-18D" firstAttribute="centerY" secondItem="mtf-um-gT2" secondAttribute="centerY" id="Ob1-Pm-e06"/>
<constraint firstItem="dj8-zh-f7B" firstAttribute="leading" secondItem="mtf-um-gT2" secondAttribute="leading" constant="10" id="bJE-YA-WIt"/>
<constraint firstItem="Idl-tT-18D" firstAttribute="centerX" secondItem="mtf-um-gT2" secondAttribute="centerX" id="hbL-lo-MeV"/>
<constraint firstItem="dj8-zh-f7B" firstAttribute="centerY" secondItem="mtf-um-gT2" secondAttribute="centerY" id="kDJ-84-WWy"/>
<constraint firstItem="DW7-A8-SBA" firstAttribute="bottom" secondItem="7lT-gs-3xj" secondAttribute="bottom" constant="-13" id="rqg-Ms-sev"/>
<constraint firstItem="7lT-gs-3xj" firstAttribute="centerY" secondItem="mtf-um-gT2" secondAttribute="centerY" id="zaw-pt-63o"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="mtf-um-gT2" secondAttribute="trailing" id="3ab-hZ-rMX"/>
<constraint firstItem="rwj-1i-py3" firstAttribute="leading" secondItem="OmW-DA-41S" secondAttribute="leading" id="8Uo-tO-Fm0"/>
<constraint firstItem="mtf-um-gT2" firstAttribute="top" secondItem="OmW-DA-41S" secondAttribute="top" id="Pc2-Bw-Pen"/>
<constraint firstItem="mtf-um-gT2" firstAttribute="leading" secondItem="OmW-DA-41S" secondAttribute="leading" id="RJu-Uc-2Ex"/>
<constraint firstItem="mtf-um-gT2" firstAttribute="top" secondItem="rwj-1i-py3" secondAttribute="bottom" id="UN1-rZ-Z5D"/>
<constraint firstAttribute="bottom" secondItem="mtf-um-gT2" secondAttribute="bottom" id="UiS-xg-D1I"/>
<constraint firstAttribute="trailing" secondItem="rwj-1i-py3" secondAttribute="trailing" id="lCD-0J-5qS"/>
<constraint firstItem="rwj-1i-py3" firstAttribute="top" secondItem="OmW-DA-41S" secondAttribute="top" id="xBy-tN-GeN"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<variation key="default">
<mask key="constraints">
<exclude reference="Pc2-Bw-Pen"/>
</mask>
</variation>
<point key="canvasLocation" x="236.5" y="149"/>
</view>
</objects>
<resources>
<image name="btn_ nav_shop cart" width="21" height="22"/>
<image name="button_close" width="16" height="15"/>
</resources>
</document>
//
// KWMEmptyViewList.h
// iMicroBusiness
//
// Created by Cody on 3/11/16.
// Copyright © 2016 kwm. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KWMEmptyViewList : UIView
@property (nonatomic, weak) IBOutlet UIView *vContent;
@property (nonatomic, weak) IBOutlet UILabel *lbText;
@property (nonatomic) NSString *text;
@end
//
// KWMEmptyViewList.m
// iMicroBusiness
//
// Created by Cody on 3/11/16.
// Copyright © 2016 kwm. All rights reserved.
//
#import "KWMEmptyViewList.h"
#import "KWMStringUtil.h"
@implementation KWMEmptyViewList
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[[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.userInteractionEnabled = NO;
self.vContent.backgroundColor = [UIColor clearColor];
}
return self;
}
- (void)setText:(NSString *)text {
_text = text;
self.lbText.text = [KWMStringUtil nonNullString:text];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMEmptyViewList">
<connections>
<outlet property="lbText" destination="6NB-Z2-xVz" id="5Db-P4-FDy"/>
<outlet property="vContent" destination="iN0-l3-epB" id="gUp-Y2-VQA"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view userInteractionEnabled="NO" contentMode="scaleToFill" id="iN0-l3-epB" userLabel="content view">
<rect key="frame" x="0.0" y="0.0" width="600" height="150"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" image="ic_login_logo" translatesAutoresizingMaskIntoConstraints="NO" id="qB2-0O-UpQ">
<constraints>
<constraint firstAttribute="width" constant="80" id="T8g-0v-ekG"/>
<constraint firstAttribute="height" constant="80" id="xCE-da-Pxm"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂时没有数据噢" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6NB-Z2-xVz">
<constraints>
<constraint firstAttribute="height" constant="21" id="8wV-0F-9CH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="6NB-Z2-xVz" firstAttribute="top" secondItem="qB2-0O-UpQ" secondAttribute="bottom" constant="25" id="7nW-GK-3fM"/>
<constraint firstItem="6NB-Z2-xVz" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="9f4-ic-Asv"/>
<constraint firstItem="qB2-0O-UpQ" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="12" id="I2v-bw-ZFR"/>
<constraint firstAttribute="trailing" secondItem="6NB-Z2-xVz" secondAttribute="trailing" constant="10" id="qho-9w-7HB"/>
<constraint firstItem="qB2-0O-UpQ" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="w5U-2b-oEg"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
<image name="ic_login_logo" width="73" height="77"/>
</resources>
</document>
//
// KWMGoodsDetailsView.h
// iCemarose
//
// Created by 陈荣科 on 16/9/2.
// Copyright © 2016年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@class KWMGoodsDetailsView;
@protocol KWMGoodsDetailsViewDelegate <NSObject>
- (void)kwm_addToShopcart;
- (void)kwm_beBackLastVC;
@end
@interface KWMGoodsDetailsView : UIView
@property (weak, nonatomic) IBOutlet UIButton *btnBack;
@property (weak, nonatomic) IBOutlet UIButton *btnShopCart;
@property (weak, nonatomic) IBOutlet UILabel *lbTitle;
@property (weak, nonatomic) IBOutlet UIView *vContent;
@property (weak, nonatomic) IBOutlet UILabel *lbCount;
@property (nonatomic) NSInteger count;
@property (weak, nonatomic) id<KWMGoodsDetailsViewDelegate>delegate;
- (void)showTitleAndHidenShopCart:(BOOL)isShow;
- (IBAction)onClickShopCartBtn:(id)sender;
- (IBAction)onClickBackBtn:(id)sender;
@end
//
// KWMGoodsDetailsView.m
// iCemarose
//
// Created by 陈荣科 on 16/9/2.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWMGoodsDetailsView.h"
#import "KWMShopCartData.h"
@implementation KWMGoodsDetailsView
- (instancetype)init{
if (self = [super init]) {
[self initContentView];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder:aDecoder]) {
[self initContentView];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
[self initContentView];
}
return self;
}
- (void)awakeFromNib{
[super awakeFromNib];
[self initContentView];
}
- (void)initContentView{
[[NSBundle mainBundle] loadNibNamed:@" KWMGoodsDetailsView" owner:self options:nil];
[self addSubview:_vContent];
self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
self.lbTitle.text = @"其他";
_lbCount.text = @"0";
}
- (void)setCount:(NSInteger)count{
_count = count;
if (count > 0) {
_lbCount.text = [NSString stringWithFormat:@"%ld",count];
if (count > 9) {
_lbCount.font = [UIFont systemFontOfSize:8];
}
}else{
_lbCount.text = @"0";
}
}
- (void)showTitleAndHidenShopCart:(BOOL)isShow{
self.lbTitle.hidden = isShow;
self.btnShopCart.hidden = !isShow;
}
- (IBAction)onClickShopCartBtn:(id)sender{
if ([self.delegate respondsToSelector:@selector(kwm_addToShopcart)]) {
[self.delegate kwm_addToShopcart];
}
}
- (IBAction)onClickBackBtn:(id)sender{
if ([self.delegate respondsToSelector:@selector(kwm_beBackLastVC)]) {
[self.delegate kwm_beBackLastVC];
}
}
@end
//
// KWMPointView.h
// iCemarose
//
// Created by 陈荣科 on 16/9/2.
// Copyright © 2016年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KWMPointView : UIView
@property (nonatomic) NSInteger imageNum;
@property (nonatomic) NSMutableArray *imageArr;
@property (nonatomic) NSInteger mark;
@property (nonatomic) UIView *vLast;
@property (weak, nonatomic) IBOutlet UIView *vContent;
- (void)scrollToLastView;
- (void)scrollToFirstView;
@end
//
// KWMPointView.m
// iCemarose
//
// Created by 陈荣科 on 16/9/2.
// Copyright © 2016年 kollway. All rights reserved.
//
#import "KWMPointView.h"
@implementation KWMPointView
- (id)init{
if (self = [super init]) {
[self initViewContentiew];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame{
if(self = [super initWithFrame:frame]){
[self initViewContentiew];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder:aDecoder]) {
[self initViewContentiew];
}
return self;
}
- (void)awakeFromNib{
[super awakeFromNib];
[self initViewContentiew];
}
- (void)initViewContentiew{
[[NSBundle mainBundle] loadNibNamed:@"KWMPointView" owner:self options:nil];
[self addSubview:self.vContent];
self.vContent.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
self.vContent.backgroundColor = [UIColor clearColor];
_imageArr = [NSMutableArray array];
}
static CGFloat width = 8.0f;//小图标宽
static CGFloat height = 8.0f;//小图标高
static CGFloat margin = 4.0f;//小图标间距
- (void)setImageNum:(NSInteger)imageNum{
for (int i = 0; i < imageNum; ++i) {
[self addImage:i];
}
[self addLastView];
}
- (void)setMark:(NSInteger)mark{
for (int i = 0; i < _imageArr.count; ++i) {
UIImageView *image;
if (mark == i) {
image = [_imageArr objectAtIndex:i];
image.image = [UIImage imageNamed:@"ic_guide01"];
}else{
image = [_imageArr objectAtIndex:i];
image.image = [UIImage imageNamed:@"ic_guide02"];
}
}
}
- (void)addImage:(NSInteger)num{
CGFloat top = (self.vContent.frame.size.height - _imageNum*height - (_imageNum -1)*margin)*0.5;
CGFloat topMargin = top + num*height + num*margin;
UIImageView *vImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, topMargin, width, height)];
if (num == 0) {
vImage.image = [UIImage imageNamed:@"ic_guide01"];
}else{
vImage.image = [UIImage imageNamed:@"ic_guide02"];
}
[self.vContent addSubview:vImage];
[_imageArr addObject:vImage];
}
- (void)addLastView{
UIImageView *ivImage = _imageArr.lastObject;
CGFloat topMargin = ivImage.frame.origin.y + height + margin;
_vLast = [[UIView alloc] initWithFrame:CGRectMake(0, topMargin, 8, 2)];
_vLast.backgroundColor = [UIColor clearColor];
[self addSubview:_vLast];
}
- (void)scrollToFirstView{
for (int i = 0; i < _imageArr.count; ++i) {
UIImageView *ivImage;
ivImage = [_imageArr objectAtIndex:i];
if (i == 0) {
ivImage.image = [UIImage imageNamed:@"ic_guide01"];
}else{
ivImage.image = [UIImage imageNamed:@"ic_guide02"];
}
}
}
- (void)scrollToLastView{
for (int i = 0; i < _imageArr.count; ++i) {
UIImageView *ivImage;
ivImage = [_imageArr objectAtIndex:i];
ivImage.image = [UIImage imageNamed:@"ic_guide02"];
}
_vLast.backgroundColor = [UIColor blackColor];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMPointView">
<connections>
<outlet property="vContent" destination="xhn-NW-p80" id="D4F-GZ-PQY"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="xhn-NW-p80" userLabel="vContent">
<rect key="frame" x="0.0" y="0.0" width="31" height="367"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="168.5" y="75.5"/>
</view>
</objects>
</document>
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