Commit 4031d8f7 by lee

add size guide

parent 44091982
...@@ -12,8 +12,9 @@ pod 'JRSwizzle' ...@@ -12,8 +12,9 @@ pod 'JRSwizzle'
pod 'RegexKitLite' pod 'RegexKitLite'
pod 'SAMKeychain' pod 'SAMKeychain'
pod 'RXCollections','~> 1.0' pod 'RXCollections','~> 1.0'
pod 'TOWebViewController'
pod 'AFNetworking','~> 2.6' pod 'AFNetworking','~> 3.1'
pod 'JSONModel','~> 1.2.0' pod 'JSONModel','~> 1.2.0'
pod 'SDWebImage','~> 3.7.1' pod 'SDWebImage','~> 3.7.1'
pod 'SAMCategories', '~> 0.5.1' pod 'SAMCategories', '~> 0.5.1'
...@@ -24,7 +25,7 @@ pod 'MBProgressHUD', '~> 0.8' ...@@ -24,7 +25,7 @@ pod 'MBProgressHUD', '~> 0.8'
pod 'HMSegmentedControl@hons82', '~> 1.3.1' pod 'HMSegmentedControl@hons82', '~> 1.3.1'
pod 'MZFormSheetPresentationController' 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'
......
...@@ -2384,7 +2384,6 @@ ...@@ -2384,7 +2384,6 @@
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
"-l\"AFNetworkActivityLogger\"",
"-l\"AFNetworking\"", "-l\"AFNetworking\"",
"-l\"HMSegmentedControl@hons82\"", "-l\"HMSegmentedControl@hons82\"",
"-l\"JSONModel\"", "-l\"JSONModel\"",
...@@ -2455,7 +2454,6 @@ ...@@ -2455,7 +2454,6 @@
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
"-l\"AFNetworkActivityLogger\"",
"-l\"AFNetworking\"", "-l\"AFNetworking\"",
"-l\"HMSegmentedControl@hons82\"", "-l\"HMSegmentedControl@hons82\"",
"-l\"JSONModel\"", "-l\"JSONModel\"",
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
- (void)kwm_onClickInformation; - (void)kwm_onClickInformation;
- (void)kwm_onClickSizeBtn; - (void)kwm_onClickSizeBtn;
- (void)kwm_goToBrandVC; - (void)kwm_goToBrandVC;
- (void)kwm_onClickSizeGuide;
@end @end
@interface KWMProductDetailView : UIView @interface KWMProductDetailView : UIView
......
...@@ -266,6 +266,10 @@ ...@@ -266,6 +266,10 @@
} }
} }
- (IBAction)openSizeGuide:(id)sender {
[self.delegate kwm_onClickSizeGuide];
}
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/> <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>
...@@ -127,12 +127,23 @@ ...@@ -127,12 +127,23 @@
<action selector="onClickInformationBtn:" destination="-1" eventType="touchUpInside" id="XW1-UB-w3S"/> <action selector="onClickInformationBtn:" destination="-1" eventType="touchUpInside" id="XW1-UB-w3S"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EM9-Ay-Qxk">
<rect key="frame" x="21" y="94" width="48" height="29"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/>
<state key="normal" title="尺码指南">
<color key="titleColor" red="0.1529411765" green="0.14901960780000001" blue="0.21176470589999999" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="openSizeGuide:" destination="-1" eventType="touchUpInside" id="NXp-bD-VUT"/>
</connections>
</button>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="bottom" secondItem="wfT-JC-g9d" secondAttribute="bottom" constant="3" id="0gt-hJ-gW7"/> <constraint firstItem="gpT-Sg-ghu" firstAttribute="bottom" secondItem="wfT-JC-g9d" secondAttribute="bottom" constant="3" id="0gt-hJ-gW7"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="leading" secondItem="gpT-Sg-ghu" secondAttribute="trailing" id="2kJ-k6-7uE"/> <constraint firstItem="Mql-V1-hiE" firstAttribute="leading" secondItem="gpT-Sg-ghu" secondAttribute="trailing" id="2kJ-k6-7uE"/>
<constraint firstAttribute="trailing" secondItem="DbC-Os-2e9" secondAttribute="trailing" constant="19" id="3Gy-6z-Jli"/> <constraint firstAttribute="trailing" secondItem="DbC-Os-2e9" secondAttribute="trailing" constant="19" id="3Gy-6z-Jli"/>
<constraint firstAttribute="trailing" secondItem="s6N-a3-C4Z" secondAttribute="trailing" constant="21" id="BH6-4A-Psp"/> <constraint firstAttribute="trailing" secondItem="s6N-a3-C4Z" secondAttribute="trailing" constant="21" id="BH6-4A-Psp"/>
<constraint firstItem="asI-Rf-ZXG" firstAttribute="centerY" secondItem="EM9-Ay-Qxk" secondAttribute="centerY" id="Bx2-7F-7xQ"/>
<constraint firstItem="RNK-se-cgR" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="HHm-2W-PD5"/> <constraint firstItem="RNK-se-cgR" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="HHm-2W-PD5"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="bottom" secondItem="wfT-JC-g9d" secondAttribute="bottom" id="LwR-CA-mq2"/> <constraint firstItem="Mql-V1-hiE" firstAttribute="bottom" secondItem="wfT-JC-g9d" secondAttribute="bottom" id="LwR-CA-mq2"/>
<constraint firstItem="s6N-a3-C4Z" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="Qm4-Ii-IA5"/> <constraint firstItem="s6N-a3-C4Z" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="Qm4-Ii-IA5"/>
...@@ -148,6 +159,7 @@ ...@@ -148,6 +159,7 @@
<constraint firstItem="gpT-Sg-ghu" firstAttribute="leading" secondItem="wfT-JC-g9d" secondAttribute="trailing" constant="10" id="o9j-pp-GRZ"/> <constraint firstItem="gpT-Sg-ghu" firstAttribute="leading" secondItem="wfT-JC-g9d" secondAttribute="trailing" constant="10" id="o9j-pp-GRZ"/>
<constraint firstItem="asI-Rf-ZXG" firstAttribute="centerY" secondItem="RNK-se-cgR" secondAttribute="centerY" id="pfI-QQ-uu0"/> <constraint firstItem="asI-Rf-ZXG" firstAttribute="centerY" secondItem="RNK-se-cgR" secondAttribute="centerY" id="pfI-QQ-uu0"/>
<constraint firstItem="RNK-se-cgR" firstAttribute="top" secondItem="gpT-Sg-ghu" secondAttribute="bottom" constant="8" id="pjQ-9v-2rS"/> <constraint firstItem="RNK-se-cgR" firstAttribute="top" secondItem="gpT-Sg-ghu" secondAttribute="bottom" constant="8" id="pjQ-9v-2rS"/>
<constraint firstItem="EM9-Ay-Qxk" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="rJ1-DF-mLV"/>
</constraints> </constraints>
</view> </view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="urC-7Y-7AI"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="urC-7Y-7AI">
......
...@@ -23,7 +23,10 @@ ...@@ -23,7 +23,10 @@
#import "KWMShareVC.h" #import "KWMShareVC.h"
#import "KWMImageUtil.h" #import "KWMImageUtil.h"
#import "KWMShoppingCart.h" #import "KWMShoppingCart.h"
#import <RegexKitLite/RegexKitLite.h>
#import <TOWebViewController/TOWebViewController.h>
#import <AFNetworking/AFNetworking.h>
#import <TOWebViewController/NJKWebViewProgress.h>
@interface KWMProductDetailVC ()<KWMBottomViewDelegate,KWMProductDetailViewDelegate,KWMSelectSizeVCDelegate,UIScrollViewDelegate> @interface KWMProductDetailVC ()<KWMBottomViewDelegate,KWMProductDetailViewDelegate,KWMSelectSizeVCDelegate,UIScrollViewDelegate>
...@@ -104,6 +107,52 @@ ...@@ -104,6 +107,52 @@
} }
} }
- (void)kwm_onClickSizeGuide {
NSString *brand = [self.product.vendor stringByReplacingOccurrencesOfRegex:@"\\s*\\W\\s*" withString:@"-"].lowercaseString;
NSString *type = @"";
NSArray *types = @[@"baby",@"girls",@"boys",@"shoes"];
for (NSString *tag in self.product.tags) {
if ([types containsObject:tag.lowercaseString]) {
type = tag.lowercaseString;
break;
}
}
// NSString *url= [NSString stringWithFormat:@"https://cemarose.myshopify.com/pages/%@-size-guide-%@",brand,type];
NSString *baseUrl = @"http://www.cemarose.cn/pages/";
NSString *url= [NSString stringWithFormat:@"%@%@-size-guide-%@",baseUrl,brand,type];
// TOWebViewController *wv = [[TOWebViewController alloc] initWithURLString:url];
TOWebViewController *wv = [[TOWebViewController alloc] init];
wv.showPageTitles = NO;
wv.title = @"Size Guide";
wv.navigationButtonsHidden = YES;
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
// manager.responseSerializer = [AFXMLParserResponseSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
[manager GET:url parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
// NJKWebViewProgress *wvp = [vc valueForKeyPath:@"progressManager"];
// [wvp.progressDelegate webViewProgress:wvp updateProgress:downloadProgress.fractionCompleted];
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSString *body = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
body = [NSString stringWithFormat:@"<meta name='viewport' content='width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no'/><style type='text/css'>"
@".main-header-wrap,.main-footer,.doubly-float{display:none}"
@".page-title h1.label{font-size:17px;}"
@".rte.text-content td{padding-left:10px;}"
@"</style>%@",body];
[wv.webView loadHTMLString:body baseURL:[NSURL URLWithString:baseUrl]];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
}];
[self.navigationController pushViewController:wv animated:YES];
__unused id _ = wv.view;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(200 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
NJKWebViewProgress *wvp = [wv valueForKeyPath:@"progressManager"];
[wvp.progressDelegate webViewProgress:wvp updateProgress:0.1];
});
}
-(void)onClickBackBtn:(id)sender{ -(void)onClickBackBtn:(id)sender{
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
} }
......
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