Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMBase
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMBase
Commits
a91e72ed
Commit
a91e72ed
authored
Mar 02, 2018
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化注释
parent
4d359407
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
23 deletions
+7
-23
UIView+NavigationShadow.h
GMBase/Classes/UIView+NavigationShadow.h
+1
-1
UIView+NavigationShadow.m
GMBase/Classes/UIView+NavigationShadow.m
+6
-22
No files found.
GMBase/Classes/UIView+NavigationShadow.h
View file @
a91e72ed
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
// 注意只适用于UI规范中的导航范围:导航栏阴影,segment切换的阴影。
@interface
UIView
(
NavigationShadow
)
@interface
UIView
(
NavigationShadow
)
/**
/**
...
...
GMBase/Classes/UIView+NavigationShadow.m
View file @
a91e72ed
...
@@ -17,43 +17,27 @@
...
@@ -17,43 +17,27 @@
@implementation
UIView
(
NavigationShadow
)
@implementation
UIView
(
NavigationShadow
)
-
(
void
)
addNavigationShadow
{
-
(
void
)
addNavigationShadow
{
self
.
layer
.
masksToBounds
=
NO
;
self
.
layer
.
masksToBounds
=
NO
;
// self.layer.shadowOpacity = 1.0f;
// self.layer.shadowRadius = 2.0f;
// self.layer.shadowOffset = CGSizeMake(0.0, ONE_PIXEL);
// self.isShowShadow = YES;
// self.hideTopShadow = YES;
// UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, self.bounds.size.height - 12, Constant.screenWidth, 12)];
// view.backgroundColor = [UIColor whiteColor];
// view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
// [self addSubview:view];
// [self sendSubviewToBack:view];
// view.layer.masksToBounds = NO;
// view.layer.shadowOpacity = 1.0f;
// view.layer.shadowRadius = 2.0f;
// view.layer.shadowOffset = CGSizeMake(0.0, ONE_PIXEL);
// //view.isShowShadow = YES;
// view.layer.shadowColor = [UIColor colorWithWhite:0 alpha:0.1].CGColor;
self
.
shadowLayer
=
[
CALayer
layer
];
self
.
shadowLayer
=
[
CALayer
layer
];
self
.
shadowLayer
.
bounds
=
CGRectMake
(
0
,
0
,
Constant
.
screenWidth
,
12
);
self
.
shadowLayer
.
bounds
=
CGRectMake
(
0
,
0
,
Constant
.
screenWidth
,
12
);
self
.
shadowLayer
.
position
=
CGPointMake
(
self
.
bounds
.
size
.
width
/
2
,
self
.
bounds
.
size
.
height
-
6
);
self
.
shadowLayer
.
position
=
CGPointMake
(
self
.
bounds
.
size
.
width
/
2
,
self
.
bounds
.
size
.
height
-
6
);
self
.
shadowLayer
.
backgroundColor
=
[
UIColor
whiteColor
].
CGColor
;
self
.
shadowLayer
.
backgroundColor
=
[
UIColor
whiteColor
].
CGColor
;
[
self
.
layer
insertSublayer
:
self
.
shadowLayer
atIndex
:
0
];
self
.
shadowLayer
.
masksToBounds
=
NO
;
self
.
shadowLayer
.
masksToBounds
=
NO
;
self
.
shadowLayer
.
shadowOpacity
=
1
.
0
f
;
self
.
shadowLayer
.
shadowOpacity
=
1
.
0
f
;
self
.
shadowLayer
.
shadowRadius
=
2
.
0
f
;
self
.
shadowLayer
.
shadowRadius
=
2
.
0
f
;
self
.
shadowLayer
.
shadowOffset
=
CGSizeMake
(
0
.
0
,
ONE_PIXEL
);
self
.
shadowLayer
.
shadowOffset
=
CGSizeMake
(
0
.
0
,
ONE_PIXEL
);
self
.
isShowShadow
=
YES
;
self
.
isShowShadow
=
YES
;
self
.
shadowLayer
.
shadowPath
=
CGPathCreateWithRect
(
CGRectMake
(
0
,
self
.
shadowLayer
.
bounds
.
size
.
height
-
6
,
Constant
.
screenWidth
,
6
),
nil
);
self
.
shadowLayer
.
shadowPath
=
CGPathCreateWithRect
(
CGRectMake
(
0
,
self
.
shadowLayer
.
bounds
.
size
.
height
-
6
,
Constant
.
screenWidth
,
6
),
nil
);
self
.
shadowLayer
.
shadowColor
=
[
UIColor
colorWithWhite
:
0
alpha
:
0
.
1
].
CGColor
;
}
}
-
(
void
)
setIsShowShadow
:
(
BOOL
)
isShowShadow
{
-
(
void
)
setIsShowShadow
:
(
BOOL
)
isShowShadow
{
objc_setAssociatedObject
(
self
,
@selector
(
isShowShadow
),
@
(
isShowShadow
),
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
objc_setAssociatedObject
(
self
,
@selector
(
isShowShadow
),
@
(
isShowShadow
),
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
if
(
isShowShadow
)
{
if
(
isShowShadow
&&
self
.
shadowLayer
.
superlayer
==
nil
)
{
self
.
shadowLayer
.
shadowColor
=
[
UIColor
colorWithWhite
:
0
alpha
:
0
.
1
].
CGColor
;
[
self
.
layer
insertSublayer
:
self
.
shadowLayer
atIndex
:
0
]
;
}
else
{
self
.
shadowLayer
.
shadowColor
=
[
UIColor
clearColor
].
CGColor
;
}
else
if
(
!
isShowShadow
&&
self
.
shadowLayer
.
superlayer
!=
nil
)
{
[
self
.
shadowLayer
removeFromSuperlayer
];
[
self
.
shadowLayer
removeFromSuperlayer
];
}
}
}
}
...
...
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