Commit 5ce74fef by lee

remove YYImage,Update ProductDetail

parent 602d2c14
...@@ -29,7 +29,7 @@ pod 'MZFormSheetPresentationController' ...@@ -29,7 +29,7 @@ pod 'MZFormSheetPresentationController'
pod 'MJRefresh', '~> 3.1' pod 'MJRefresh', '~> 3.1'
#pod 'AFNetworkActivityLogger' #pod 'AFNetworkActivityLogger'
pod 'SFFocusViewLayout', '~> 2.0' pod 'SFFocusViewLayout', '~> 2.0'
pod 'YYWebImage' #pod 'YYWebImage'
pod 'MagicalRecord','~> 2.2' pod 'MagicalRecord','~> 2.2'
pod 'Mobile-Buy-SDK',:git => 'https://github.com/houweibin/mobile-buy-sdk-ios' pod 'Mobile-Buy-SDK',:git => 'https://github.com/houweibin/mobile-buy-sdk-ios'
#pod 'Mobile-Buy-SDK',:path => '../Pods/mobile-buy-sdk-ios' #pod 'Mobile-Buy-SDK',:path => '../Pods/mobile-buy-sdk-ios'
......
...@@ -2963,8 +2963,6 @@ ...@@ -2963,8 +2963,6 @@
"-l\"SDWebImage\"", "-l\"SDWebImage\"",
"-l\"SFFocusViewLayout\"", "-l\"SFFocusViewLayout\"",
"-l\"YYCache\"", "-l\"YYCache\"",
"-l\"YYImage\"",
"-l\"YYWebImage\"",
"-l\"c++\"", "-l\"c++\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"z\"", "-l\"z\"",
...@@ -3037,8 +3035,6 @@ ...@@ -3037,8 +3035,6 @@
"-l\"SDWebImage\"", "-l\"SDWebImage\"",
"-l\"SFFocusViewLayout\"", "-l\"SFFocusViewLayout\"",
"-l\"YYCache\"", "-l\"YYCache\"",
"-l\"YYImage\"",
"-l\"YYWebImage\"",
"-l\"c++\"", "-l\"c++\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"z\"", "-l\"z\"",
......
...@@ -10,13 +10,14 @@ ...@@ -10,13 +10,14 @@
#import "KWMImageUtil.h" #import "KWMImageUtil.h"
#import "KWMStringUtil.h" #import "KWMStringUtil.h"
#import "KWMPageControl.h" #import "KWMPageControl.h"
#import "YYWebImage/YYWebImage.h" //#import "YYWebImage/YYWebImage.h"
#import <SDCycleScrollView/SDCycleScrollView.h>
@interface KWMFirstDetailView ()<UIScrollViewDelegate> @interface KWMFirstDetailView ()<SDCycleScrollViewDelegate>
@property(nonatomic,weak) IBOutlet UIView *vView; @property(nonatomic,weak) IBOutlet UIView *vView;
@property(nonatomic,weak) IBOutlet UIScrollView *imageScrollView; @property(nonatomic,weak) IBOutlet SDCycleScrollView *imageScrollView;
@property(nonatomic,weak) IBOutlet UIButton *btnBrand; @property(nonatomic,weak) IBOutlet UIButton *btnBrand;
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
//单位label //单位label
@property(nonatomic,weak) IBOutlet UILabel *lbUnit; @property(nonatomic,weak) IBOutlet UILabel *lbUnit;
@property(nonatomic,weak) IBOutlet KWMPageControl *pageControl; //@property(nonatomic,weak) IBOutlet KWMPageControl *pageControl;
@property (weak, nonatomic) IBOutlet UIView *sizeGuideView; @property (weak, nonatomic) IBOutlet UIView *sizeGuideView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *sizeGuideViewHeightConstraint; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *sizeGuideViewHeightConstraint;
...@@ -40,9 +41,9 @@ ...@@ -40,9 +41,9 @@
@property (nonatomic) NSMutableArray *imageArr; @property (nonatomic) NSMutableArray *imageArr;
@property (nonatomic) NSTimer *timer; //@property (nonatomic) NSTimer *timer;
@property (nonatomic) BOOL isFirstScroll; //@property (nonatomic) BOOL isFirstScroll;
@property (nonatomic) BOOL isShowCNY; @property (nonatomic) BOOL isShowCNY;
...@@ -91,50 +92,54 @@ ...@@ -91,50 +92,54 @@
NSLog(@"KWMProductDetailView%f%f",self.frame.size.width,self.frame.size.height); NSLog(@"KWMProductDetailView%f%f",self.frame.size.width,self.frame.size.height);
self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); self.vView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
[self addSubview:self.vView]; [self addSubview:self.vView];
self.imageScrollView.pageDotImage = [UIImage imageNamed:@"ic_page_1"];
self.imageScrollView.currentPageDotImage = [UIImage imageNamed:@"ic_page_2"];
self.imageScrollView.delegate = self;
self.imageScrollView.backgroundColor = [UIColor whiteColor];
} }
-(void) addTimer{ //-(void) addTimer{
if ([self.timer isValid]) { // if ([self.timer isValid]) {
return; // return;
} // }
self.timer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(doTimer) userInfo:nil repeats:YES]; // self.timer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(doTimer) userInfo:nil repeats:YES];
[self.timer setFireDate:[NSDate new]];//开启 // [self.timer setFireDate:[NSDate new]];//开启
} //}
-(void) removeTimer{ //-(void) removeTimer{
//结束 // //结束
if ([self.timer isValid]) { // if ([self.timer isValid]) {
[self.timer invalidate]; // [self.timer invalidate];
self.timer = nil; // self.timer = nil;
} // }
} //}
//
//开始计时 ////开始计时
-(void) doTimer{ //-(void) doTimer{
if (self.isFirstScroll) { // if (self.isFirstScroll) {
self.isFirstScroll = NO; // self.isFirstScroll = NO;
return; // return;
} // }
NSInteger currentIndex = self.pageControl.currentPage; // NSInteger currentIndex = self.pageControl.currentPage;
currentIndex ++; // currentIndex ++;
currentIndex = currentIndex % self.pageControl.numberOfPages; // currentIndex = currentIndex % self.pageControl.numberOfPages;
[self.imageScrollView setContentOffset:CGPointMake(UI_SCREEN_WIDTH * currentIndex, 0) animated:YES]; //// [self.imageScrollView setContentOffset:CGPointMake(UI_SCREEN_WIDTH * currentIndex, 0) animated:YES];
self.pageControl.currentPage = currentIndex; // self.pageControl.currentPage = currentIndex;
} //}
-(void)setData:(BUYProduct *)product{ -(void)setData:(BUYProduct *)product{
if(product == nil){ if(product == nil){
return; return;
} }
self.isShowCNY = YES; self.isShowCNY = YES;
self.isFirstScroll = YES; // self.isFirstScroll = YES;
[self removeTimer]; // [self removeTimer];
self.product = product; self.product = product;
self.imageScrollView.delegate = self; // [self.imageScrollView setContentOffset:CGPointMake(0, 0) animated:NO];
[self.imageScrollView setContentOffset:CGPointMake(0, 0) animated:NO]; // for (UIView *subview in self.imageScrollView.subviews) {
for (UIView *subview in self.imageScrollView.subviews) { // [subview removeFromSuperview];
[subview removeFromSuperview]; // }
}
[self initImage:product]; [self initImage:product];
[self initView:product]; [self initView:product];
//[self addTimer]; //[self addTimer];
...@@ -144,40 +149,43 @@ ...@@ -144,40 +149,43 @@
if(product == nil){ if(product == nil){
return; return;
} }
[self.imageScrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; // [self.imageScrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
NSInteger imageCount = product.imagesArray == nil? 0:product.imagesArray.count; // NSInteger imageCount = product.imagesArray == nil? 0:product.imagesArray.count;
self.imageArr = [NSMutableArray array]; // self.imageArr = [NSMutableArray array];
CGFloat w = UI_SCREEN_WIDTH; self.imageArr = [NSMutableArray arrayWithArray:[KWMImageUtil getProductImageUrls:self.product ImageSize:BigImage]];
CGFloat h = UI_SCREEN_WIDTH; self.imageScrollView.imageURLStringsGroup = self.imageArr;
for( int i =0;i < imageCount;i++){
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(i*w, 0, w, h)]; // CGFloat w = UI_SCREEN_WIDTH;
imageView.tag = i; // CGFloat h = UI_SCREEN_WIDTH;
imageView.contentMode = UIViewContentModeScaleAspectFit; // for( int i =0;i < imageCount;i++){
imageView.clipsToBounds = YES; // UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(i*w, 0, w, h)];
NSString *imageUrl = [KWMImageUtil getProductImageUrlByPosition:self.product ImageSize:BigImage Position:i]; // imageView.tag = i;
[self.imageArr addObject:imageUrl]; // imageView.contentMode = UIViewContentModeScaleAspectFit;
NSURL *imageURL = [NSURL URLWithString:imageUrl]; // imageView.clipsToBounds = YES;
UITapGestureRecognizer *imageTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickImage:)]; // NSString *imageUrl = [KWMImageUtil getProductImageUrlByPosition:self.product ImageSize:BigImage Position:i];
imageView.userInteractionEnabled = YES; // [self.imageArr addObject:imageUrl];
[imageView addGestureRecognizer:imageTap]; // NSURL *imageURL = [NSURL URLWithString:imageUrl];
if(i + 1 == imageCount){ // UITapGestureRecognizer *imageTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickImage:)];
[imageView yy_setImageWithURL:imageURL placeholder:nil options:YYWebImageOptionProgressive completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) { // imageView.userInteractionEnabled = YES;
if(image && !error){ // [imageView addGestureRecognizer:imageTap];
[self performSelector:@selector(addTimer) withObject:nil afterDelay:0.5f]; // if(i + 1 == imageCount){
} // [imageView yy_setImageWithURL:imageURL placeholder:nil options:YYWebImageOptionProgressive completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
}]; // if(image && !error){
}else{ // [self performSelector:@selector(addTimer) withObject:nil afterDelay:0.5f];
[imageView yy_setImageWithURL:imageURL options:YYWebImageOptionProgressive]; // }
} // }];
// }else{
[self.imageScrollView addSubview:imageView]; // [imageView yy_setImageWithURL:imageURL options:YYWebImageOptionProgressive];
} // }
self.pageControl.numberOfPages = imageCount; //
self.pageControl.currentPage = 0; // [self.imageScrollView addSubview:imageView];
self.pageControl.defaultImage = [UIImage imageNamed:@"ic_page_1"]; // }
self.pageControl.currentImage = [UIImage imageNamed:@"ic_page_2"]; // self.pageControl.numberOfPages = imageCount;
self.imageScrollView.contentSize = CGSizeMake(w*imageCount,0); // self.pageControl.currentPage = 0;
self.imageScrollView.pagingEnabled = YES; // self.pageControl.defaultImage = [UIImage imageNamed:@"ic_page_1"];
// self.pageControl.currentImage = [UIImage imageNamed:@"ic_page_2"];
// self.imageScrollView.contentSize = CGSizeMake(w*imageCount,0);
// self.imageScrollView.pagingEnabled = YES;
} }
...@@ -211,18 +219,22 @@ ...@@ -211,18 +219,22 @@
self.lbOldPrice.userInteractionEnabled = YES; self.lbOldPrice.userInteractionEnabled = YES;
} }
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ //-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
NSInteger index = fabs(scrollView.contentOffset.x)/scrollView.frame.size.width; // NSInteger index = fabs(scrollView.contentOffset.x)/scrollView.frame.size.width;
[self.pageControl setCurrentPage:index]; // [self.pageControl setCurrentPage:index];
} //}
-(void)onClickImage:(UITapGestureRecognizer *)tapGesture{ - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
if(self.delegate!=nil){ [self.delegate kwm_onClickImage:self.imageArr currentIndex:index];
UIView *view = [tapGesture view];
[self.delegate kwm_onClickImage:self.imageArr currentIndex:view.tag];
}
} }
//-(void)onClickImage:(UITapGestureRecognizer *)tapGesture{
// if(self.delegate!=nil){
// UIView *view = [tapGesture view];
// [self.delegate kwm_onClickImage:self.imageArr currentIndex:view.tag];
// }
//}
-(void)onClickPrice:(UITapGestureRecognizer *)tapGesture{ -(void)onClickPrice:(UITapGestureRecognizer *)tapGesture{
if(self.product == nil){ if(self.product == nil){
return; return;
......
...@@ -6,19 +6,17 @@ ...@@ -6,19 +6,17 @@
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMFirstDetailView"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="KWMFirstDetailView">
<connections> <connections>
<outlet property="btnBrand" destination="s6N-a3-C4Z" id="ips-Jp-qG3"/> <outlet property="btnBrand" destination="s6N-a3-C4Z" id="ips-Jp-qG3"/>
<outlet property="imageScrollView" destination="h8J-3U-wMB" id="MbO-M3-YVy"/> <outlet property="imageScrollView" destination="lKe-L4-ROK" id="V42-4B-a2B"/>
<outlet property="lbName" destination="SQm-rY-OyA" id="Fux-pg-fca"/> <outlet property="lbName" destination="SQm-rY-OyA" id="Fux-pg-fca"/>
<outlet property="lbOldPrice" destination="Mql-V1-hiE" id="Sh1-Fz-sfU"/> <outlet property="lbOldPrice" destination="Mql-V1-hiE" id="Sh1-Fz-sfU"/>
<outlet property="lbPrice" destination="gpT-Sg-ghu" id="FGd-AA-Yiv"/> <outlet property="lbPrice" destination="gpT-Sg-ghu" id="FGd-AA-Yiv"/>
<outlet property="lbVariant" destination="o3P-oH-Xcb" id="i3M-ae-jhH"/> <outlet property="lbVariant" destination="o3P-oH-Xcb" id="i3M-ae-jhH"/>
<outlet property="pageControl" destination="M6v-TN-2WE" id="QPe-TI-LdG"/>
<outlet property="sizeGuideView" destination="sRa-JA-uEq" id="D94-al-5dF"/> <outlet property="sizeGuideView" destination="sRa-JA-uEq" id="D94-al-5dF"/>
<outlet property="sizeGuideViewHeightConstraint" destination="CLu-Pt-dGG" id="yih-xF-sL8"/> <outlet property="sizeGuideViewHeightConstraint" destination="CLu-Pt-dGG" id="yih-xF-sL8"/>
<outlet property="vView" destination="iN0-l3-epB" id="TQD-W9-jEg"/> <outlet property="vView" destination="iN0-l3-epB" id="TQD-W9-jEg"/>
...@@ -32,30 +30,11 @@ ...@@ -32,30 +30,11 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1H6-J2-jj4" userLabel="vContent"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1H6-J2-jj4" userLabel="vContent">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lKe-L4-ROK" userLabel="vTop"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lKe-L4-ROK" userLabel="vTop" customClass="SDCycleScrollView">
<rect key="frame" x="0.0" y="0.0" width="375" height="467"/> <rect key="frame" x="0.0" y="0.0" width="375" height="467"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h8J-3U-wMB">
<rect key="frame" x="0.0" y="46.5" width="375" height="375"/>
<constraints>
<constraint firstAttribute="width" secondItem="h8J-3U-wMB" secondAttribute="height" multiplier="1:1" id="xTw-hD-9tf"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<gestureRecognizers/> <gestureRecognizers/>
<constraints>
<constraint firstItem="h8J-3U-wMB" firstAttribute="centerY" secondItem="lKe-L4-ROK" secondAttribute="centerY" id="ZGl-tQ-ba8"/>
<constraint firstAttribute="trailing" secondItem="h8J-3U-wMB" secondAttribute="trailing" id="meb-bD-9hK"/>
<constraint firstItem="h8J-3U-wMB" firstAttribute="leading" secondItem="lKe-L4-ROK" secondAttribute="leading" id="snn-ZQ-b7q"/>
</constraints>
</view> </view>
<pageControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="3" translatesAutoresizingMaskIntoConstraints="NO" id="M6v-TN-2WE" customClass="KWMPageControl">
<rect key="frame" x="168" y="467" width="39" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="n7t-N5-xKa"/>
</constraints>
</pageControl>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ymw-Cg-156" userLabel="vBottom"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ymw-Cg-156" userLabel="vBottom">
<rect key="frame" x="0.0" y="477" width="375" height="190"/> <rect key="frame" x="0.0" y="477" width="375" height="190"/>
<subviews> <subviews>
...@@ -306,15 +285,13 @@ ...@@ -306,15 +285,13 @@
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="Ymw-Cg-156" firstAttribute="top" secondItem="M6v-TN-2WE" secondAttribute="bottom" id="5Y0-G8-3We"/>
<constraint firstAttribute="trailing" secondItem="Ymw-Cg-156" secondAttribute="trailing" id="6Mc-RC-ip7"/> <constraint firstAttribute="trailing" secondItem="Ymw-Cg-156" secondAttribute="trailing" id="6Mc-RC-ip7"/>
<constraint firstItem="M6v-TN-2WE" firstAttribute="top" secondItem="lKe-L4-ROK" secondAttribute="bottom" id="6oL-sd-1s7"/> <constraint firstItem="Ymw-Cg-156" firstAttribute="top" secondItem="lKe-L4-ROK" secondAttribute="bottom" constant="10" id="Ge6-kP-hTq"/>
<constraint firstItem="lKe-L4-ROK" firstAttribute="top" secondItem="1H6-J2-jj4" secondAttribute="top" id="MVZ-Po-h2C"/> <constraint firstItem="lKe-L4-ROK" firstAttribute="top" secondItem="1H6-J2-jj4" secondAttribute="top" id="MVZ-Po-h2C"/>
<constraint firstAttribute="bottom" secondItem="Ymw-Cg-156" secondAttribute="bottom" id="Mef-7q-yrb"/> <constraint firstAttribute="bottom" secondItem="Ymw-Cg-156" secondAttribute="bottom" id="Mef-7q-yrb"/>
<constraint firstItem="lKe-L4-ROK" firstAttribute="leading" secondItem="1H6-J2-jj4" secondAttribute="leading" id="bsW-GL-chq"/> <constraint firstItem="lKe-L4-ROK" firstAttribute="leading" secondItem="1H6-J2-jj4" secondAttribute="leading" id="bsW-GL-chq"/>
<constraint firstAttribute="trailing" secondItem="lKe-L4-ROK" secondAttribute="trailing" id="h7C-hB-wS6"/> <constraint firstAttribute="trailing" secondItem="lKe-L4-ROK" secondAttribute="trailing" id="h7C-hB-wS6"/>
<constraint firstItem="Ymw-Cg-156" firstAttribute="leading" secondItem="1H6-J2-jj4" secondAttribute="leading" id="kHl-jZ-gRA"/> <constraint firstItem="Ymw-Cg-156" firstAttribute="leading" secondItem="1H6-J2-jj4" secondAttribute="leading" id="kHl-jZ-gRA"/>
<constraint firstItem="M6v-TN-2WE" firstAttribute="centerX" secondItem="1H6-J2-jj4" secondAttribute="centerX" id="mmR-Qc-1vL"/>
</constraints> </constraints>
</view> </view>
</subviews> </subviews>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2017083111</string> <string>2017090411</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSApplicationQueriesSchemes</key> <key>LSApplicationQueriesSchemes</key>
......
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