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
defc1736
Commit
defc1736
authored
7 years ago
by
lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add size guide
parent
942e6a36
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
9 deletions
+152
-9
KWMFirstDetailView.h
iCemarose/Class/UI/NewProduct/Cell/KWMFirstDetailView.h
+2
-1
KWMFirstDetailView.m
iCemarose/Class/UI/NewProduct/Cell/KWMFirstDetailView.m
+12
-5
KWMFirstDetailView.xib
iCemarose/Class/UI/NewProduct/Cell/KWMFirstDetailView.xib
+53
-3
KWMNewProductVC.m
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
+84
-0
Header-Prefix.h
iCemarose/Header-Prefix.h
+1
-0
No files found.
iCemarose/Class/UI/NewProduct/Cell/KWMFirstDetailView.h
View file @
defc1736
...
...
@@ -14,6 +14,7 @@
-
(
void
)
kwm_onClickImage
:
(
NSMutableArray
*
)
imageArr
currentIndex
:
(
NSInteger
)
currentIndex
;
-
(
void
)
kwm_onClickSizeBtn
;
-
(
void
)
kwm_goToBrandVC
;
-
(
void
)
kwm_sizeGuide
;
@end
...
...
@@ -31,6 +32,6 @@
-
(
void
)
setData
:(
BUYProduct
*
)
product
;
@property
(
nonatomic
)
BOOL
sizeGuideHidden
;
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/NewProduct/Cell/KWMFirstDetailView.m
View file @
defc1736
...
...
@@ -33,6 +33,9 @@
@property
(
nonatomic
,
weak
)
IBOutlet
KWMPageControl
*
pageControl
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIView
*
sizeGuideView
;
@property
(
weak
,
nonatomic
)
IBOutlet
NSLayoutConstraint
*
sizeGuideViewHeightConstraint
;
@property
(
nonatomic
)
BUYProduct
*
product
;
@property
(
nonatomic
)
NSMutableArray
*
imageArr
;
...
...
@@ -254,6 +257,11 @@
}
}
-
(
IBAction
)
sizeGuideAction
:
(
id
)
sender
{
[
self
.
delegate
kwm_sizeGuide
];
}
-
(
void
)
onClickBlandBtn
:
(
id
)
sender
{
if
(
self
.
delegate
){
[
self
.
delegate
kwm_goToBrandVC
];
...
...
@@ -273,10 +281,9 @@
}
}
-
(
void
)
setSizeGuideHidden
:
(
BOOL
)
sizeGuideHidden
{
self
.
sizeGuideView
.
hidden
=
sizeGuideHidden
;
self
.
sizeGuideViewHeightConstraint
.
constant
=
sizeGuideHidden
?
0
:
50
;
}
@end
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/NewProduct/Cell/KWMFirstDetailView.xib
View file @
defc1736
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1212
1
"
systemVersion=
"16F73"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"1212
0
"
systemVersion=
"16F73"
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=
"1208
9
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"1208
8
"
/>
<capability
name=
"Aspect ratio constraints"
minToolsVersion=
"5.1"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
...
...
@@ -19,6 +19,8 @@
<outlet
property=
"lbPrice"
destination=
"gpT-Sg-ghu"
id=
"FGd-AA-Yiv"
/>
<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=
"sizeGuideViewHeightConstraint"
destination=
"CLu-Pt-dGG"
id=
"yih-xF-sL8"
/>
<outlet
property=
"vView"
destination=
"iN0-l3-epB"
id=
"TQD-W9-jEg"
/>
</connections>
</placeholder>
...
...
@@ -246,16 +248,59 @@
<outletCollection
property=
"gestureRecognizers"
destination=
"Bn3-BY-NZm"
appends=
"YES"
id=
"5YW-Qp-ioO"
/>
</connections>
</view>
<view
hidden=
"YES"
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"sRa-JA-uEq"
userLabel=
"Size Guide"
customClass=
"KWMItemView"
>
<rect
key=
"frame"
x=
"0.0"
y=
"190"
width=
"375"
height=
"0.0"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"尺码参考"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"TKI-ds-uBS"
>
<rect
key=
"frame"
x=
"21"
y=
"-9"
width=
"48"
height=
"17"
/>
<fontDescription
key=
"fontDescription"
name=
"PingFangSC-Light"
family=
"PingFang SC"
pointSize=
"12"
/>
<color
key=
"textColor"
red=
"0.1529411765"
green=
"0.14901960780000001"
blue=
"0.21176470589999999"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
</label>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"uPE-YR-dUl"
userLabel=
"line"
>
<rect
key=
"frame"
x=
"20"
y=
"-1"
width=
"355"
height=
"1"
/>
<color
key=
"backgroundColor"
red=
"0.84705882349999995"
green=
"0.85882352939999995"
blue=
"0.87058823529999996"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"1"
id=
"aZ5-j8-htj"
/>
</constraints>
</view>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"button_mine_more"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"thi-C2-XsQ"
>
<rect
key=
"frame"
x=
"348"
y=
"-7"
width=
"7"
height=
"14"
/>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"7"
id=
"0AO-H1-1QW"
/>
<constraint
firstAttribute=
"height"
constant=
"14"
id=
"eYQ-zU-dNQ"
/>
</constraints>
</imageView>
</subviews>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<gestureRecognizers/>
<constraints>
<constraint
firstAttribute=
"height"
id=
"CLu-Pt-dGG"
/>
<constraint
firstItem=
"TKI-ds-uBS"
firstAttribute=
"centerY"
secondItem=
"sRa-JA-uEq"
secondAttribute=
"centerY"
id=
"MNr-f8-wK4"
/>
<constraint
firstItem=
"uPE-YR-dUl"
firstAttribute=
"leading"
secondItem=
"sRa-JA-uEq"
secondAttribute=
"leading"
constant=
"20"
id=
"OdU-WY-fl8"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"uPE-YR-dUl"
secondAttribute=
"bottom"
id=
"Rs7-5n-j55"
/>
<constraint
firstItem=
"TKI-ds-uBS"
firstAttribute=
"leading"
secondItem=
"sRa-JA-uEq"
secondAttribute=
"leading"
constant=
"21"
id=
"fLf-3b-nJK"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"thi-C2-XsQ"
secondAttribute=
"trailing"
constant=
"20"
id=
"imC-XO-I0R"
/>
<constraint
firstItem=
"thi-C2-XsQ"
firstAttribute=
"centerY"
secondItem=
"sRa-JA-uEq"
secondAttribute=
"centerY"
id=
"vxn-93-Pge"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"uPE-YR-dUl"
secondAttribute=
"trailing"
id=
"yPN-GE-gtc"
/>
</constraints>
<connections>
<outletCollection
property=
"gestureRecognizers"
destination=
"GPA-oO-7UP"
appends=
"YES"
id=
"idl-7c-IV1"
/>
</connections>
</view>
</subviews>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<constraints>
<constraint
firstItem=
"sRa-JA-uEq"
firstAttribute=
"top"
secondItem=
"wgu-cH-TXa"
secondAttribute=
"bottom"
id=
"0Tr-TT-0nX"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"wgu-cH-TXa"
secondAttribute=
"trailing"
id=
"1BE-r2-etn"
/>
<constraint
firstItem=
"wgu-cH-TXa"
firstAttribute=
"top"
secondItem=
"iJa-Oj-Sd2"
secondAttribute=
"bottom"
constant=
"10"
id=
"3E1-qY-lsE"
/>
<constraint
firstItem=
"sRa-JA-uEq"
firstAttribute=
"leading"
secondItem=
"Ymw-Cg-156"
secondAttribute=
"leading"
id=
"3dS-8p-JTq"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"sRa-JA-uEq"
secondAttribute=
"bottom"
id=
"8LP-Bk-QII"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"iJa-Oj-Sd2"
secondAttribute=
"trailing"
id=
"8a6-sG-pwj"
/>
<constraint
firstItem=
"iJa-Oj-Sd2"
firstAttribute=
"top"
secondItem=
"Ymw-Cg-156"
secondAttribute=
"top"
id=
"Vl5-q8-AzT"
/>
<constraint
firstItem=
"iJa-Oj-Sd2"
firstAttribute=
"leading"
secondItem=
"Ymw-Cg-156"
secondAttribute=
"leading"
id=
"hhQ-sM-yEW"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"sRa-JA-uEq"
secondAttribute=
"trailing"
id=
"jq7-29-LTi"
/>
<constraint
firstItem=
"wgu-cH-TXa"
firstAttribute=
"leading"
secondItem=
"Ymw-Cg-156"
secondAttribute=
"leading"
id=
"oIc-Ag-UZg"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"wgu-cH-TXa"
secondAttribute=
"bottom"
id=
"uTa-HP-Rfa"
/>
</constraints>
</view>
</subviews>
...
...
@@ -287,6 +332,11 @@
<action
selector=
"onClickSizeBtn:"
destination=
"-1"
id=
"Xre-Rk-3w3"
/>
</connections>
</tapGestureRecognizer>
<tapGestureRecognizer
id=
"GPA-oO-7UP"
userLabel=
"sizeGuide"
>
<connections>
<action
selector=
"sizeGuideAction:"
destination=
"-1"
id=
"M2I-CX-KdI"
/>
</connections>
</tapGestureRecognizer>
</objects>
<resources>
<image
name=
"button_mine_more"
width=
"7"
height=
"14"
/>
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Class/UI/NewProduct/KWMNewProductVC.m
View file @
defc1736
...
...
@@ -18,6 +18,9 @@
#import "KWMImageUtil.h"
#import "KWMStringUtil.h"
#import "KWMShopCartVC.h"
#import <TOWebViewController/TOWebViewController.h>
#import <PPNetworkHelper/PPNetworkHelper.h>
#import <TOWebViewController/NJKWebViewProgress.h>
@interface
KWMNewProductVC
()
...
...
@@ -50,6 +53,8 @@
//选中的数量
@property
(
nonatomic
)
NSInteger
count
;
@property
(
nonatomic
)
NSString
*
typeTag
;
@property
(
nonatomic
)
BOOL
isLikeVariant
;
...
...
@@ -104,8 +109,12 @@
[
self
initShopCartCount
];
[
self
initMidViewHight
];
[
self
.
btnLike
setImage
:[
UIImage
imageNamed
:
@"ic_like_unable"
]
forState
:
UIControlStateNormal
];
}
-
(
void
)
initShopCartCount
{
NSNumber
*
count
=
[[
KWMShoppingCart
sharedInstance
]
count
];
[
self
.
btnShopCart
setTitle
:
count
.
stringValue
forState
:
UIControlStateNormal
];
...
...
@@ -299,6 +308,68 @@
[
self
showPresentation
:
variantsVC
size
:
size
tapOutsideClose
:
YES
style
:
MZFormSheetPresentationTransitionStyleFade
];
}
-
(
void
)
kwm_sizeGuide
{
NSString
*
brand
=
[
self
.
product
.
vendor
stringByReplacingOccurrencesOfRegex
:
@"
\\
s*
\\
W
\\
s*"
withString
:
@"-"
].
lowercaseString
;
NSString
*
baseUrl
=
@"http://www.cemarose.cn/pages/"
;
NSString
*
url
=
[
NSString
stringWithFormat
:
@"%@%@-size-guide-%@"
,
baseUrl
,
brand
,
self
.
typeTag
];
NSLog
(
@"size guide url: %@"
,
url
);
// TOWebViewController *wv = [[TOWebViewController alloc] initWithURLString:url];
TOWebViewController
*
wv
=
[[
TOWebViewController
alloc
]
init
];
__unused
id
_
=
wv
.
view
;
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 = [body stringByReplacingOccurrencesOfRegex:@"<meta[\\w\\W]*?/?>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<script[\\w\\W]*?</script>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<header[\\w\\W]*?</header>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<footer[\\w\\W]*?</footer>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<head>" withString:@"<head><meta name=\"viewport\" content=\"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no\" /><style type='text/css'>"
// @".page-title h1.label{font-size:17px;}"
// @".rte.text-content td{padding-left:10px;}"
// @"</style>"];
// [wv.webView loadHTMLString:body baseURL:[NSURL URLWithString:baseUrl]];
// } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
// }];
void
(
^
success
)(
id
)
=
^
(
id
body
){
if
(
!
body
)
{
return
;
}
body
=
[[
NSString
alloc
]
initWithData
:
body
encoding
:
NSUTF8StringEncoding
];
body
=
[
body
stringByReplacingOccurrencesOfRegex
:
@"<meta[
\\
w
\\
W]*?/?>"
withString
:
@""
];
body
=
[
body
stringByReplacingOccurrencesOfRegex
:
@"<script[
\\
w
\\
W]*?</script>"
withString
:
@""
];
body
=
[
body
stringByReplacingOccurrencesOfRegex
:
@"<header[
\\
w
\\
W]*?</header>"
withString
:
@""
];
body
=
[
body
stringByReplacingOccurrencesOfRegex
:
@"<footer[
\\
w
\\
W]*?</footer>"
withString
:
@""
];
body
=
[
body
stringByReplacingOccurrencesOfRegex
:
@"<head>"
withString
:
@"<head><meta name=
\"
viewport
\"
content=
\"
width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no
\"
/><style type='text/css'>"
@".page-title h1.label{font-size:17px;}"
@".rte.text-content td{padding-left:10px;}"
@"</style>"
];
[
wv
.
webView
loadHTMLString
:
body
baseURL
:[
NSURL
URLWithString
:
baseUrl
]];
};
__weak
typeof
(
self
)
this
=
self
;
[
PPNetworkHelper
setAFHTTPSessionManagerProperty
:
^
(
AFHTTPSessionManager
*
sessionManager
)
{
sessionManager
.
responseSerializer
=
[
AFHTTPResponseSerializer
serializer
];
sessionManager
.
responseSerializer
.
acceptableContentTypes
=
[
NSSet
setWithObjects
:
@"text/html"
,
nil
];
}];
[
PPNetworkHelper
GET
:
url
parameters
:
nil
responseCache
:
success
success
:
success
failure
:^
(
NSError
*
error
)
{
[
this
showError
:
error
];
}];
[
self
.
navigationController
pushViewController
:
wv
animated
:
YES
];
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
)
kwm_goToBrandVC
{
if
(
self
.
product
&&
self
.
product
.
vendor
){
...
...
@@ -571,6 +642,19 @@
-
(
void
)
setProduct
:
(
BUYProduct
*
)
product
{
_product
=
product
;
NSArray
*
types
=
@[
@"baby"
,
@"girls"
,
@"boys"
,
@"shoes"
,
@"newborn"
];
for
(
NSString
*
tag
in
self
.
product
.
tags
)
{
if
([
types
containsObject
:
tag
.
lowercaseString
])
{
self
.
typeTag
=
tag
.
lowercaseString
;
break
;
}
}
[
self
.
detailView1
setSizeGuideHidden
:
!
self
.
typeTag
];
}
...
...
This diff is collapsed.
Click to expand it.
iCemarose/Header-Prefix.h
View file @
defc1736
...
...
@@ -13,6 +13,7 @@
#import "NSDecimalNumber+Currency.h"
#import "UIViewController+HTTP.h"
#import <RXCollections/RXCollection.h>
#import <RegexKitLite/RegexKitLite.h>
#ifndef Header_Prefix_h
#define Header_Prefix_h
...
...
This diff is collapsed.
Click to expand it.
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