Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
LuckFarm
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmj
LuckFarm
Commits
872cd0cf
Commit
872cd0cf
authored
Oct 23, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f94730fe
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
109 additions
and
90 deletions
+109
-90
GYGiftAlertView.m
GYDemo/GYDemo/Alert/GYGiftAlertView.m
+3
-19
GYGiftAlertView.xib
GYDemo/GYDemo/Alert/GYGiftAlertView.xib
+12
-3
GYOrderAlertView.m
GYDemo/GYDemo/Alert/GYOrderAlertView.m
+6
-28
GYOrderAlertView.xib
GYDemo/GYDemo/Alert/GYOrderAlertView.xib
+14
-4
GYRedPacketView.m
GYDemo/GYDemo/Alert/GYRedPacketView.m
+2
-0
Contents.json
...sets.xcassets/Alert/gift/gift_mask.imageset/Contents.json
+22
-0
矩形@2x.png
...o/Assets.xcassets/Alert/gift/gift_mask.imageset/矩形@2x.png
+0
-0
矩形@3x.png
...o/Assets.xcassets/Alert/gift/gift_mask.imageset/矩形@3x.png
+0
-0
CGUserManager.h
GYDemo/GYDemo/UserManager/CGUserManager.h
+1
-3
CGUserManager.m
GYDemo/GYDemo/UserManager/CGUserManager.m
+6
-15
GYSettingViewController.m
GYDemo/GYDemo/ViewController/GYSettingViewController.m
+17
-13
GYWebViewController.h
GYDemo/GYDemo/ViewController/GYWebViewController.h
+2
-1
GYWebViewController.m
GYDemo/GYDemo/ViewController/GYWebViewController.m
+24
-4
No files found.
GYDemo/GYDemo/Alert/GYGiftAlertView.m
View file @
872cd0cf
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
giftHeaderImv
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*
giftHeaderImv
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
bgView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
bgView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
giftBgView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
giftBgView
;
@property
(
nonatomic
,
strong
)
CAGradientLayer
*
gradientLayer
;
@property
(
nonatomic
,
weak
)
IBOutlet
UICollectionView
*
collectionView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UICollectionView
*
collectionView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataSource
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataSource
;
...
@@ -26,6 +25,7 @@
...
@@ -26,6 +25,7 @@
self
.
hidden
=
YES
;
self
.
hidden
=
YES
;
self
.
bgView
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
bgView
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
giftBgView
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
backgroundColor
=
[[
UIColor
blackColor
]
colorWithAlphaComponent
:
0
.
3
];
self
.
backgroundColor
=
[[
UIColor
blackColor
]
colorWithAlphaComponent
:
0
.
3
];
// UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
// UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
// flowLayout.sectionInset=UIEdgeInsetsMake(0, 0, 0, 0);
// flowLayout.sectionInset=UIEdgeInsetsMake(0, 0, 0, 0);
...
@@ -44,28 +44,10 @@
...
@@ -44,28 +44,10 @@
if
(
@available
(
iOS
11
.
0
,
*
))
{
if
(
@available
(
iOS
11
.
0
,
*
))
{
_collectionView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
_collectionView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
}
}
// gradient
_gradientLayer
=
[
CAGradientLayer
layer
];
_gradientLayer
.
frame
=
_giftBgView
.
bounds
;
_gradientLayer
.
startPoint
=
CGPointMake
(
0
.
5
,
0
.
53
);
_gradientLayer
.
endPoint
=
CGPointMake
(
0
.
5
,
1
);
_gradientLayer
.
colors
=
@[(
__bridge
id
)[
UIColor
colorWithRed
:
249
/
255
.
0
green
:
234
/
255
.
0
blue
:
192
/
255
.
0
alpha
:
1
.
0
].
CGColor
,
(
__bridge
id
)[
UIColor
colorWithRed
:
255
/
255
.
0
green
:
251
/
255
.
0
blue
:
240
/
255
.
0
alpha
:
1
.
0
].
CGColor
];
_gradientLayer
.
locations
=
@[
@
(
0
),
@
(
1
.
0
f
)];
_giftBgView
.
layer
.
cornerRadius
=
10
;
_giftBgView
.
layer
.
shadowColor
=
[
UIColor
colorWithRed
:
171
/
255
.
0
green
:
94
/
255
.
0
blue
:
26
/
255
.
0
alpha
:
0
.
3
].
CGColor
;
_giftBgView
.
layer
.
shadowOffset
=
CGSizeMake
(
0
,
2
);
_giftBgView
.
layer
.
shadowOpacity
=
1
;
_giftBgView
.
layer
.
shadowRadius
=
4
;
[
_gradientLayer
removeFromSuperlayer
];
[
_giftBgView
.
layer
addSublayer
:
_gradientLayer
];
}
}
-
(
void
)
layoutSubviews
{
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
[
super
layoutSubviews
];
_gradientLayer
.
frame
=
_giftBgView
.
bounds
;
}
}
-
(
void
)
setBoxModel
:
(
GYOpenBoxModel
*
)
boxModel
{
-
(
void
)
setBoxModel
:
(
GYOpenBoxModel
*
)
boxModel
{
...
@@ -147,6 +129,8 @@
...
@@ -147,6 +129,8 @@
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
1
,
0
.
1
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
1
,
0
.
1
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
0
,
0
.
0
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
0
,
0
.
0
,
1
.
0
)]];
animation
.
values
=
values
;
animation
.
values
=
values
;
animation
.
removedOnCompletion
=
NO
;
animation
.
fillMode
=
kCAFillModeForwards
;
[
_bgView
.
layer
addAnimation
:
animation
forKey
:
nil
];
[
_bgView
.
layer
addAnimation
:
animation
forKey
:
nil
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
30
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
30
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
...
...
GYDemo/GYDemo/Alert/GYGiftAlertView.xib
View file @
872cd0cf
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"17156"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"17156"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"17125"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"17125"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"System colors in document resources"
minToolsVersion=
"11.0"
/>
<capability
name=
"System colors in document resources"
minToolsVersion=
"11.0"
/>
...
@@ -18,13 +19,16 @@
...
@@ -18,13 +19,16 @@
<rect
key=
"frame"
x=
"16.5"
y=
"243"
width=
"381"
height=
"410"
/>
<rect
key=
"frame"
x=
"16.5"
y=
"243"
width=
"381"
height=
"410"
/>
<subviews>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"gift_bg"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"wec-0m-x6P"
>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"gift_bg"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"wec-0m-x6P"
>
<rect
key=
"frame"
x=
"5"
y=
"
86"
width=
"371"
height=
"334
"
/>
<rect
key=
"frame"
x=
"5"
y=
"
77.5"
width=
"371"
height=
"342.5
"
/>
</imageView>
</imageView>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"LPX-8e-GMj"
>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"LPX-8e-GMj"
>
<rect
key=
"frame"
x=
"18"
y=
"
106"
width=
"345"
height=
"219.5
"
/>
<rect
key=
"frame"
x=
"18"
y=
"
97.5"
width=
"345"
height=
"228
"
/>
<subviews>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"gift_mask"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"KPA-TL-pwU"
>
<rect
key=
"frame"
x=
"-5"
y=
"5"
width=
"355"
height=
"228"
/>
</imageView>
<collectionView
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"scaleToFill"
dataMode=
"none"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"3gA-JC-WLJ"
>
<collectionView
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"scaleToFill"
dataMode=
"none"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"3gA-JC-WLJ"
>
<rect
key=
"frame"
x=
"0.0"
y=
"50"
width=
"345"
height=
"1
69.5
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"50"
width=
"345"
height=
"1
78
"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<collectionViewFlowLayout
key=
"collectionViewLayout"
minimumLineSpacing=
"10"
minimumInteritemSpacing=
"10"
id=
"e4W-tH-xOm"
>
<collectionViewFlowLayout
key=
"collectionViewLayout"
minimumLineSpacing=
"10"
minimumInteritemSpacing=
"10"
id=
"e4W-tH-xOm"
>
<size
key=
"itemSize"
width=
"128"
height=
"128"
/>
<size
key=
"itemSize"
width=
"128"
height=
"128"
/>
...
@@ -36,8 +40,12 @@
...
@@ -36,8 +40,12 @@
</subviews>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraints>
<constraint
firstItem=
"KPA-TL-pwU"
firstAttribute=
"leading"
secondItem=
"LPX-8e-GMj"
secondAttribute=
"leading"
constant=
"-5"
id=
"BPz-MQ-Uzb"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"KPA-TL-pwU"
secondAttribute=
"trailing"
constant=
"-5"
id=
"aXr-aV-Ywu"
/>
<constraint
firstItem=
"3gA-JC-WLJ"
firstAttribute=
"top"
secondItem=
"LPX-8e-GMj"
secondAttribute=
"top"
constant=
"50"
id=
"h1D-Cd-Nu2"
/>
<constraint
firstItem=
"3gA-JC-WLJ"
firstAttribute=
"top"
secondItem=
"LPX-8e-GMj"
secondAttribute=
"top"
constant=
"50"
id=
"h1D-Cd-Nu2"
/>
<constraint
firstItem=
"3gA-JC-WLJ"
firstAttribute=
"leading"
secondItem=
"LPX-8e-GMj"
secondAttribute=
"leading"
id=
"k3m-hV-cua"
/>
<constraint
firstItem=
"3gA-JC-WLJ"
firstAttribute=
"leading"
secondItem=
"LPX-8e-GMj"
secondAttribute=
"leading"
id=
"k3m-hV-cua"
/>
<constraint
firstItem=
"KPA-TL-pwU"
firstAttribute=
"top"
secondItem=
"LPX-8e-GMj"
secondAttribute=
"top"
constant=
"5"
id=
"nLd-QD-Kyf"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"KPA-TL-pwU"
secondAttribute=
"bottom"
constant=
"-5"
id=
"ncY-xC-XgS"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"3gA-JC-WLJ"
secondAttribute=
"bottom"
id=
"wH8-WX-BiD"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"3gA-JC-WLJ"
secondAttribute=
"bottom"
id=
"wH8-WX-BiD"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"3gA-JC-WLJ"
secondAttribute=
"trailing"
id=
"zXM-rR-nSh"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"3gA-JC-WLJ"
secondAttribute=
"trailing"
id=
"zXM-rR-nSh"
/>
</constraints>
</constraints>
...
@@ -109,6 +117,7 @@
...
@@ -109,6 +117,7 @@
<image
name=
"gift_bg"
width=
"335"
height=
"334"
/>
<image
name=
"gift_bg"
width=
"335"
height=
"334"
/>
<image
name=
"gift_cancel"
width=
"32"
height=
"32"
/>
<image
name=
"gift_cancel"
width=
"32"
height=
"32"
/>
<image
name=
"gift_confirm"
width=
"284"
height=
"46"
/>
<image
name=
"gift_confirm"
width=
"284"
height=
"46"
/>
<image
name=
"gift_mask"
width=
"317"
height=
"228"
/>
<image
name=
"order_header"
width=
"353"
height=
"155"
/>
<image
name=
"order_header"
width=
"353"
height=
"155"
/>
<systemColor
name=
"systemBackgroundColor"
>
<systemColor
name=
"systemBackgroundColor"
>
<color
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<color
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
...
...
GYDemo/GYDemo/Alert/GYOrderAlertView.m
View file @
872cd0cf
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
bgView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
bgView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
giftBgView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIView
*
giftBgView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIButton
*
confirmBtn
;
@property
(
nonatomic
,
weak
)
IBOutlet
UIButton
*
confirmBtn
;
@property
(
nonatomic
,
strong
)
CAGradientLayer
*
gradientLayer
;
@property
(
nonatomic
,
weak
)
IBOutlet
UICollectionView
*
collectionView
;
@property
(
nonatomic
,
weak
)
IBOutlet
UICollectionView
*
collectionView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataSource
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataSource
;
@property
(
nonatomic
,
weak
)
IBOutlet
UILabel
*
orderDetailsLab
;
@property
(
nonatomic
,
weak
)
IBOutlet
UILabel
*
orderDetailsLab
;
...
@@ -29,6 +28,7 @@
...
@@ -29,6 +28,7 @@
[
super
awakeFromNib
];
[
super
awakeFromNib
];
self
.
hidden
=
YES
;
self
.
hidden
=
YES
;
self
.
backgroundColor
=
[[
UIColor
blackColor
]
colorWithAlphaComponent
:
0
.
3
];
self
.
backgroundColor
=
[[
UIColor
blackColor
]
colorWithAlphaComponent
:
0
.
3
];
_giftBgView
.
backgroundColor
=
[
UIColor
clearColor
];
_bgView
.
backgroundColor
=
[
UIColor
clearColor
];
_bgView
.
backgroundColor
=
[
UIColor
clearColor
];
// UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
// UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
// flowLayout.sectionInset=UIEdgeInsetsMake(0, 0, 0, 0);
// flowLayout.sectionInset=UIEdgeInsetsMake(0, 0, 0, 0);
...
@@ -47,24 +47,6 @@
...
@@ -47,24 +47,6 @@
if
(
@available
(
iOS
11
.
0
,
*
))
{
if
(
@available
(
iOS
11
.
0
,
*
))
{
_collectionView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
_collectionView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
}
}
// gradient
_gradientLayer
=
[
CAGradientLayer
layer
];
_gradientLayer
.
frame
=
_giftBgView
.
bounds
;
_gradientLayer
.
startPoint
=
CGPointMake
(
0
.
5
,
0
.
53
);
_gradientLayer
.
endPoint
=
CGPointMake
(
0
.
5
,
1
);
_gradientLayer
.
colors
=
@[(
__bridge
id
)[
UIColor
colorWithRed
:
249
/
255
.
0
green
:
234
/
255
.
0
blue
:
192
/
255
.
0
alpha
:
1
.
0
].
CGColor
,
(
__bridge
id
)[
UIColor
colorWithRed
:
255
/
255
.
0
green
:
251
/
255
.
0
blue
:
240
/
255
.
0
alpha
:
1
.
0
].
CGColor
];
_gradientLayer
.
locations
=
@[
@
(
0
),
@
(
1
.
0
f
)];
_gradientLayer
.
cornerRadius
=
10
;
_giftBgView
.
layer
.
cornerRadius
=
10
;
_giftBgView
.
layer
.
shadowColor
=
[
UIColor
colorWithRed
:
171
/
255
.
0
green
:
94
/
255
.
0
blue
:
26
/
255
.
0
alpha
:
0
.
3
].
CGColor
;
_giftBgView
.
layer
.
shadowOffset
=
CGSizeMake
(
0
,
2
);
_giftBgView
.
layer
.
shadowOpacity
=
1
;
_giftBgView
.
layer
.
shadowRadius
=
4
;
[
_gradientLayer
removeFromSuperlayer
];
[
_giftBgView
.
layer
addSublayer
:
_gradientLayer
];
}
}
-
(
void
)
setModel
:
(
GYOrderInfoModel
*
)
model
{
-
(
void
)
setModel
:
(
GYOrderInfoModel
*
)
model
{
...
@@ -88,7 +70,6 @@
...
@@ -88,7 +70,6 @@
-
(
void
)
layoutSubviews
{
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
[
super
layoutSubviews
];
_gradientLayer
.
frame
=
_giftBgView
.
bounds
;
}
}
-
(
void
)
refreshDataSource
{
-
(
void
)
refreshDataSource
{
...
@@ -96,11 +77,6 @@
...
@@ -96,11 +77,6 @@
NSDictionary
*
orderDic
=
[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
];
NSDictionary
*
orderDic
=
[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
];
if
([[
response
objectForKey
:
@"status"
]
integerValue
]
==
200
)
{
NSData
*
data
=
[
NSJSONSerialization
dataWithJSONObject
:
orderDic
options
:
NSJSONWritingFragmentsAllowed
error
:
nil
];
NSString
*
jsonStr
=
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSUTF8StringEncoding
];
}
GYOrderInfoModel
*
model
=
[[
GYOrderInfoModel
alloc
]
init
];
GYOrderInfoModel
*
model
=
[[
GYOrderInfoModel
alloc
]
init
];
[
model
setValuesForKeysWithDictionary
:
orderDic
];
[
model
setValuesForKeysWithDictionary
:
orderDic
];
model
.
orderDetailModels
=
[
NSMutableArray
new
];
model
.
orderDetailModels
=
[
NSMutableArray
new
];
...
@@ -125,9 +101,9 @@
...
@@ -125,9 +101,9 @@
[[
CGNetworkTools
shared
]
postWithAction
:
DrawOrder
parameters
:@{}
success
:^
(
id
_Nonnull
response
)
{
[[
CGNetworkTools
shared
]
postWithAction
:
DrawOrder
parameters
:@{}
success
:^
(
id
_Nonnull
response
)
{
[(
AppDelegate
*
)[
UIApplication
sharedApplication
].
delegate
ios_getOrderData
];
//
[(AppDelegate*)[UIApplication sharedApplication].delegate ios_getOrderData];
[
self
refreshDataSource
];
//
[self refreshDataSource];
//
[self dismiss];
[
self
dismiss
];
}
failure
:^
(
NSError
*
_Nonnull
error
)
{
}
failure
:^
(
NSError
*
_Nonnull
error
)
{
}];
}];
...
@@ -159,6 +135,8 @@
...
@@ -159,6 +135,8 @@
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
1
,
0
.
1
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
1
,
0
.
1
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
0
,
0
.
0
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
0
,
0
.
0
,
1
.
0
)]];
animation
.
values
=
values
;
animation
.
values
=
values
;
animation
.
removedOnCompletion
=
NO
;
animation
.
fillMode
=
kCAFillModeForwards
;
[
_bgView
.
layer
addAnimation
:
animation
forKey
:
nil
];
[
_bgView
.
layer
addAnimation
:
animation
forKey
:
nil
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
30
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
30
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
...
...
GYDemo/GYDemo/Alert/GYOrderAlertView.xib
View file @
872cd0cf
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"17156"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"17156"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"17125"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"17125"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"System colors in document resources"
minToolsVersion=
"11.0"
/>
<capability
name=
"System colors in document resources"
minToolsVersion=
"11.0"
/>
...
@@ -23,13 +24,16 @@
...
@@ -23,13 +24,16 @@
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Lxp-qG-vhw"
>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Lxp-qG-vhw"
>
<rect
key=
"frame"
x=
"24"
y=
"77.5"
width=
"333"
height=
"390"
/>
<rect
key=
"frame"
x=
"24"
y=
"77.5"
width=
"333"
height=
"390"
/>
<subviews>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"gift_mask"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"uiT-rR-pXv"
>
<rect
key=
"frame"
x=
"-5"
y=
"-5"
width=
"343"
height=
"410"
/>
</imageView>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
usesAttributedText=
"YES"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"XsE-NZ-ege"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
usesAttributedText=
"YES"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"XsE-NZ-ege"
>
<rect
key=
"frame"
x=
"4
6"
y=
"50"
width=
"241
.5"
height=
"36"
/>
<rect
key=
"frame"
x=
"4
4.5"
y=
"50"
width=
"244
.5"
height=
"36"
/>
<attributedString
key=
"attributedText"
>
<attributedString
key=
"attributedText"
>
<fragment
content=
"完成当前订单将获得"
>
<fragment
content=
"完成当前订单将获得"
>
<attributes>
<attributes>
<color
key=
"NSColor"
red=
"0.5607843137254902"
green=
"0.29803921568627451"
blue=
"0.0039215686274509803"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"NSColor"
red=
"0.5607843137254902"
green=
"0.29803921568627451"
blue=
"0.0039215686274509803"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<font
key=
"NSFont"
size=
"21"
name=
".PingFangSC-Regular
"
/>
<font
key=
"NSFont"
metaFont=
"system"
size=
"21
"
/>
</attributes>
</attributes>
</fragment>
</fragment>
<fragment
content=
"12"
>
<fragment
content=
"12"
>
...
@@ -41,7 +45,7 @@
...
@@ -41,7 +45,7 @@
<fragment
content=
"元"
>
<fragment
content=
"元"
>
<attributes>
<attributes>
<color
key=
"NSColor"
red=
"0.5607843137254902"
green=
"0.29803921568627451"
blue=
"0.0039215686274509803"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"NSColor"
red=
"0.5607843137254902"
green=
"0.29803921568627451"
blue=
"0.0039215686274509803"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<font
key=
"NSFont"
size=
"21"
name=
".PingFangSC-Regular
"
/>
<font
key=
"NSFont"
metaFont=
"system"
size=
"21
"
/>
</attributes>
</attributes>
</fragment>
</fragment>
</attributedString>
</attributedString>
...
@@ -64,8 +68,12 @@
...
@@ -64,8 +68,12 @@
</subviews>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraints>
<constraint
firstAttribute=
"bottom"
secondItem=
"uiT-rR-pXv"
secondAttribute=
"bottom"
constant=
"-15"
id=
"5vf-FC-Nw9"
/>
<constraint
firstItem=
"XsE-NZ-ege"
firstAttribute=
"centerX"
secondItem=
"Lxp-qG-vhw"
secondAttribute=
"centerX"
id=
"ID6-Bp-dyo"
/>
<constraint
firstItem=
"XsE-NZ-ege"
firstAttribute=
"centerX"
secondItem=
"Lxp-qG-vhw"
secondAttribute=
"centerX"
id=
"ID6-Bp-dyo"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"uiT-rR-pXv"
secondAttribute=
"trailing"
constant=
"-5"
id=
"IQu-z8-A9H"
/>
<constraint
firstItem=
"uiT-rR-pXv"
firstAttribute=
"top"
secondItem=
"Lxp-qG-vhw"
secondAttribute=
"top"
constant=
"-5"
id=
"Itd-Ro-7jT"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"tw6-yx-5Z1"
secondAttribute=
"bottom"
constant=
"10"
id=
"Shp-hl-5x4"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"tw6-yx-5Z1"
secondAttribute=
"bottom"
constant=
"10"
id=
"Shp-hl-5x4"
/>
<constraint
firstItem=
"uiT-rR-pXv"
firstAttribute=
"leading"
secondItem=
"Lxp-qG-vhw"
secondAttribute=
"leading"
constant=
"-5"
id=
"mjI-Rc-e8d"
/>
<constraint
firstItem=
"tw6-yx-5Z1"
firstAttribute=
"top"
secondItem=
"XsE-NZ-ege"
secondAttribute=
"bottom"
constant=
"9"
id=
"ndH-SW-o4o"
/>
<constraint
firstItem=
"tw6-yx-5Z1"
firstAttribute=
"top"
secondItem=
"XsE-NZ-ege"
secondAttribute=
"bottom"
constant=
"9"
id=
"ndH-SW-o4o"
/>
<constraint
firstItem=
"XsE-NZ-ege"
firstAttribute=
"top"
secondItem=
"Lxp-qG-vhw"
secondAttribute=
"top"
constant=
"50"
id=
"okA-MP-KQM"
/>
<constraint
firstItem=
"XsE-NZ-ege"
firstAttribute=
"top"
secondItem=
"Lxp-qG-vhw"
secondAttribute=
"top"
constant=
"50"
id=
"okA-MP-KQM"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"tw6-yx-5Z1"
secondAttribute=
"trailing"
constant=
"30"
id=
"tF7-L2-orQ"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"tw6-yx-5Z1"
secondAttribute=
"trailing"
constant=
"30"
id=
"tF7-L2-orQ"
/>
...
@@ -87,9 +95,10 @@
...
@@ -87,9 +95,10 @@
</connections>
</connections>
</button>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"A5E-Ea-tdS"
>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"A5E-Ea-tdS"
>
<rect
key=
"frame"
x=
"4
8.5"
y=
"476.5"
width=
"284
"
height=
"52.5"
/>
<rect
key=
"frame"
x=
"4
9"
y=
"476.5"
width=
"283
"
height=
"52.5"
/>
<constraints>
<constraints>
<constraint
firstAttribute=
"width"
secondItem=
"A5E-Ea-tdS"
secondAttribute=
"height"
multiplier=
"248:46"
id=
"JFt-2h-US1"
/>
<constraint
firstAttribute=
"width"
secondItem=
"A5E-Ea-tdS"
secondAttribute=
"height"
multiplier=
"248:46"
id=
"JFt-2h-US1"
/>
<constraint
firstAttribute=
"height"
constant=
"52.5"
id=
"Rnd-Cb-rta"
/>
</constraints>
</constraints>
<fontDescription
key=
"fontDescription"
type=
"system"
weight=
"medium"
pointSize=
"18"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
weight=
"medium"
pointSize=
"18"
/>
<state
key=
"normal"
title=
"继续种植完成订单"
backgroundImage=
"gift_confirm"
/>
<state
key=
"normal"
title=
"继续种植完成订单"
backgroundImage=
"gift_confirm"
/>
...
@@ -147,6 +156,7 @@
...
@@ -147,6 +156,7 @@
<resources>
<resources>
<image
name=
"gift_cancel"
width=
"32"
height=
"32"
/>
<image
name=
"gift_cancel"
width=
"32"
height=
"32"
/>
<image
name=
"gift_confirm"
width=
"284"
height=
"46"
/>
<image
name=
"gift_confirm"
width=
"284"
height=
"46"
/>
<image
name=
"gift_mask"
width=
"317"
height=
"228"
/>
<image
name=
"order_bg"
width=
"335"
height=
"486"
/>
<image
name=
"order_bg"
width=
"335"
height=
"486"
/>
<image
name=
"order_header"
width=
"353"
height=
"155"
/>
<image
name=
"order_header"
width=
"353"
height=
"155"
/>
<systemColor
name=
"systemBackgroundColor"
>
<systemColor
name=
"systemBackgroundColor"
>
...
...
GYDemo/GYDemo/Alert/GYRedPacketView.m
View file @
872cd0cf
...
@@ -63,6 +63,8 @@
...
@@ -63,6 +63,8 @@
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
1
,
0
.
1
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
1
,
0
.
1
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
0
,
0
.
0
,
1
.
0
)]];
[
values
addObject
:[
NSValue
valueWithCATransform3D
:
CATransform3DMakeScale
(
0
.
0
,
0
.
0
,
1
.
0
)]];
animation
.
values
=
values
;
animation
.
values
=
values
;
animation
.
removedOnCompletion
=
NO
;
animation
.
fillMode
=
kCAFillModeForwards
;
[
_bgView
.
layer
addAnimation
:
animation
forKey
:
nil
];
[
_bgView
.
layer
addAnimation
:
animation
forKey
:
nil
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
31
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
31
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
...
...
GYDemo/GYDemo/Assets.xcassets/Alert/gift/gift_mask.imageset/Contents.json
0 → 100644
View file @
872cd0cf
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"矩形@2x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"矩形@3x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
GYDemo/GYDemo/Assets.xcassets/Alert/gift/gift_mask.imageset/矩形@2x.png
0 → 100644
View file @
872cd0cf
12 KB
GYDemo/GYDemo/Assets.xcassets/Alert/gift/gift_mask.imageset/矩形@3x.png
0 → 100644
View file @
872cd0cf
23.4 KB
GYDemo/GYDemo/UserManager/CGUserManager.h
View file @
872cd0cf
...
@@ -23,9 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -23,9 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
NSDictionary
*
)
h5_url
;
-
(
NSDictionary
*
)
h5_url
;
-
(
NSDictionary
*
)
open1close0
;
-
(
NSDictionary
*
)
appSwitch
;
-
(
NSDictionary
*
)
config
;
-
(
BOOL
)
isShowSplashAd
;
-
(
BOOL
)
isShowSplashAd
;
...
...
GYDemo/GYDemo/UserManager/CGUserManager.m
View file @
872cd0cf
...
@@ -63,12 +63,8 @@ static CGUserManager * manager;
...
@@ -63,12 +63,8 @@ static CGUserManager * manager;
return
[[
_data
Read
]
objectForKey
:
@"urlInfo"
];
return
[[
_data
Read
]
objectForKey
:
@"urlInfo"
];
}
}
-
(
NSDictionary
*
)
open1close0
{
-
(
NSDictionary
*
)
appSwitch
{
return
[[
_data
Read
]
objectForKey
:
@"open1close0"
];
return
[[
_data
Read
]
objectForKey
:
@"switch"
];
}
-
(
NSDictionary
*
)
config
{
return
[[
_data
Read
]
objectForKey
:
@"config"
];
}
}
-
(
BOOL
)
isMember
{
-
(
BOOL
)
isMember
{
...
@@ -180,17 +176,12 @@ static CGUserManager * manager;
...
@@ -180,17 +176,12 @@ static CGUserManager * manager;
if
([[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"h5_url"
])
{
if
([[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"h5_url"
])
{
[
self
.
data
WirteDic
:[[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"h5_url"
]
Key
:
@"urlInfo"
];
[
self
.
data
WirteDic
:[[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"h5_url"
]
Key
:
@"urlInfo"
];
}
else
{
}
else
{
[
self
.
data
removeDicForKey
:
@"urlInfo"
];
// [self.data removeDicForKey:@"urlInfo"];
}
if
([[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"config"
])
{
[
self
.
data
WirteDic
:[[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"config"
]
Key
:
@"config"
];
}
else
{
// [self.data removeDicForKey:@"config"];
}
}
if
([[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"
open1close0
"
])
{
if
([[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"
switch
"
])
{
[
self
.
data
WirteDic
:[[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"
open1close0"
]
Key
:
@"open1close0
"
];
[
self
.
data
WirteDic
:[[[
response
objectForKey
:
@"result"
]
objectForKey
:
@"data"
]
objectForKey
:
@"
switch"
]
Key
:
@"switch
"
];
}
else
{
}
else
{
// [data removeDicForKey:@"open1close0"];
}
}
success
?
success
()
:
nil
;
success
?
success
()
:
nil
;
}
else
{
}
else
{
...
...
GYDemo/GYDemo/ViewController/GYSettingViewController.m
View file @
872cd0cf
...
@@ -41,14 +41,14 @@
...
@@ -41,14 +41,14 @@
[
UINavigationBar
appearance
].
translucent
=
YES
;
[
UINavigationBar
appearance
].
translucent
=
YES
;
}
}
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
//
- (void)viewWillDisappear:(BOOL)animated{
[
self
.
navigationController
setNavigationBarHidden
:
true
animated
:
true
];
//
[self.navigationController setNavigationBarHidden:true animated:true];
//
self
.
navigationController
.
navigationBar
.
tintColor
=
tintColor
;
//
self.navigationController.navigationBar.tintColor = tintColor;
self
.
navigationController
.
navigationBar
.
titleTextAttributes
=
@{
NSForegroundColorAttributeName
:
titleColor
};
//
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:titleColor};
self
.
navigationController
.
navigationBar
.
barTintColor
=
barTintColor
;
//
self.navigationController.navigationBar.barTintColor = barTintColor;
[
UINavigationBar
appearance
].
translucent
=
YES
;
//
[UINavigationBar appearance].translucent = YES;
}
//
}
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
...
@@ -94,9 +94,12 @@
...
@@ -94,9 +94,12 @@
cell
.
titleLab
.
text
=
_dataSourceArray
[
indexPath
.
row
];
cell
.
titleLab
.
text
=
_dataSourceArray
[
indexPath
.
row
];
if
(
indexPath
.
row
==
0
)
{
cell
.
detailsLab
.
text
=
[
NSString
stringWithFormat
:
@"官方@@:%@"
,
[[
CGUserManager
shared
].
appSwitch
objectForKey
:
@"qq"
]];
}
else
if
(
indexPath
.
row
==
1
)
{
cell
.
detailsLab
.
text
=
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleShortVersionString"
];
cell
.
detailsLab
.
text
=
[[
NSBundle
mainBundle
]
objectForInfoDictionaryKey
:
@"CFBundleShortVersionString"
];
cell
.
detailsLab
.
hidden
=
indexPath
.
row
!=
1
;
}
cell
.
detailsLab
.
hidden
=
!
(
indexPath
.
row
==
1
||
indexPath
.
row
==
0
);
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
return
cell
;
...
@@ -135,8 +138,9 @@
...
@@ -135,8 +138,9 @@
GYWebViewController
*
web
=
[[
GYWebViewController
alloc
]
init
];
GYWebViewController
*
web
=
[[
GYWebViewController
alloc
]
init
];
web
.
url
=
urlStr
;
web
.
url
=
urlStr
;
web
.
webTitle
=
_dataSourceArray
[
indexPath
.
row
];
web
.
webTitle
=
_dataSourceArray
[
indexPath
.
row
];
UINavigationController
*
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
web
];
web
.
showNav
=
YES
;
[
self
presentViewController
:
nav
animated
:
YES
completion
:
nil
];
// UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:web];
[
self
.
navigationController
pushViewController
:
web
animated
:
YES
];
}
}
...
...
GYDemo/GYDemo/ViewController/GYWebViewController.h
View file @
872cd0cf
...
@@ -13,7 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -13,7 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface
GYWebViewController
:
UIViewController
@interface
GYWebViewController
:
UIViewController
@property
(
nonatomic
,
copy
)
NSString
*
url
;
@property
(
nonatomic
,
copy
)
NSString
*
url
;
@property
(
nonatomic
,
copy
)
NSString
*
webTitle
;
@property
(
nonatomic
,
copy
)
NSString
*
webTitle
;
@property
(
nonatomic
,
assign
)
bool
showNav
;
@end
@end
...
...
GYDemo/GYDemo/ViewController/GYWebViewController.m
View file @
872cd0cf
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#import "GYWebViewController.h"
#import "GYWebViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WebKit.h>
#import "GYSettingViewController.h"
@interface
GYWebViewController
()
<
WKUIDelegate
,
WKNavigationDelegate
,
WKScriptMessageHandler
>
@interface
GYWebViewController
()
<
WKUIDelegate
,
WKNavigationDelegate
,
WKScriptMessageHandler
>
...
@@ -19,6 +20,11 @@
...
@@ -19,6 +20,11 @@
@implementation
GYWebViewController
@implementation
GYWebViewController
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
!
_showNav
animated
:
true
];
}
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
...
@@ -37,6 +43,7 @@
...
@@ -37,6 +43,7 @@
// Fallback on earlier versions
// Fallback on earlier versions
}
}
[
webViewConfig
.
userContentController
addScriptMessageHandler
:
self
name
:
@"backTrack"
];
[
webViewConfig
.
userContentController
addScriptMessageHandler
:
self
name
:
@"backTrack"
];
[
webViewConfig
.
userContentController
addScriptMessageHandler
:
self
name
:
@"settingCallBack"
];
//屏蔽底部黑框
//屏蔽底部黑框
self
.
webView
=
[[
WKWebView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
KScreenWidth
,
KScreenHeight
)
configuration
:
webViewConfig
];
self
.
webView
=
[[
WKWebView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
KScreenWidth
,
KScreenHeight
)
configuration
:
webViewConfig
];
...
@@ -69,16 +76,23 @@
...
@@ -69,16 +76,23 @@
// backButton.frame = CGRectMake(0, 0, 50, 44);
// backButton.frame = CGRectMake(0, 0, 50, 44);
// [backButton setImage:[UIImage imageNamed:@"back_black"] forState:UIControlStateNormal];
// [backButton setImage:[UIImage imageNamed:@"back_black"] forState:UIControlStateNormal];
// [backButton addTarget:self action:@selector(goBackController) forControlEvents:UIControlEventTouchUpInside];
// [backButton addTarget:self action:@selector(goBackController) forControlEvents:UIControlEventTouchUpInside];
self
.
navigationItem
.
leftBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"返回"
style
:
UIBarButtonItemStyleDone
target
:
self
action
:
@selector
(
goBackController
)];
// self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:self action:@selector(goBackController)];
if
(
!
_showNav
){
if
(
@available
(
iOS
11
.
0
,
*
))
{
self
.
webView
.
scrollView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
}
else
{
self
.
automaticallyAdjustsScrollViewInsets
=
NO
;
}
}
}
}
-
(
void
)
onBack
:
(
UIButton
*
)
button
{
-
(
void
)
onBack
:
(
UIButton
*
)
button
{
[
self
goBackController
];
[
self
goBackController
];
}
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
-
(
void
)
goSetting
{
[
super
viewWillAppear
:
animated
];
GYSettingViewController
*
setting
=
[[
UIStoryboard
storyboardWithName
:
@"GYNative"
bundle
:
nil
]
instantiateViewControllerWithIdentifier
:
@"GYSettingViewController"
];
[
self
.
navigationController
setNavigationBarHidden
:
false
animated
:
true
];
[
self
.
navigationController
pushViewController
:
setting
animated
:
YES
];
}
}
-
(
void
)
webView
:
(
WKWebView
*
)
webView
didStartProvisionalNavigation
:
(
null_unspecified
WKNavigation
*
)
navigation
{
-
(
void
)
webView
:
(
WKWebView
*
)
webView
didStartProvisionalNavigation
:
(
null_unspecified
WKNavigation
*
)
navigation
{
...
@@ -179,6 +193,7 @@
...
@@ -179,6 +193,7 @@
-
(
void
)
dealloc
{
-
(
void
)
dealloc
{
[
_webView
removeObserver
:
self
forKeyPath
:
@"estimatedProgress"
];
[
_webView
removeObserver
:
self
forKeyPath
:
@"estimatedProgress"
];
[
_webView
.
configuration
.
userContentController
removeScriptMessageHandlerForName
:
@"backTrack"
];
[
_webView
.
configuration
.
userContentController
removeScriptMessageHandlerForName
:
@"backTrack"
];
[
_webView
.
configuration
.
userContentController
removeScriptMessageHandlerForName
:
@"settingCallBack"
];
}
}
...
@@ -189,6 +204,11 @@
...
@@ -189,6 +204,11 @@
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
5
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
5
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
weakSelf
goBackController
];
[
weakSelf
goBackController
];
});
});
}
else
if
([
message
.
name
isEqualToString
:
@"settingCallBack"
]){
__weak
typeof
(
self
)
weakSelf
=
self
;
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
5
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
weakSelf
goSetting
];
});
}
}
}
}
...
...
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