forked from coding/Coding-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlowImageView.m
More file actions
executable file
·44 lines (35 loc) · 1 KB
/
GlowImageView.m
File metadata and controls
executable file
·44 lines (35 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// GlowImageView.m
// JackFastKit
//
// Created by 曾 宪华 on 14-10-13.
// Copyright (c) 2014年 华捷 iOS软件开发工程师 曾宪华. All rights reserved.
//
#import "GlowImageView.h"
@implementation GlowImageView
/**
* 设置阴影的颜色
*/
- (void)setGlowColor:(UIColor *)newGlowColor {
_glowColor = newGlowColor;
if (newGlowColor) {
[self setUpProperty];
}
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
/**
* 根据阴影 设置图层 默认属性
*/
- (void)setUpProperty {
self.layer.shadowColor = self.glowColor.CGColor;
self.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(-5, -5, CGRectGetWidth(self.bounds) + 10, CGRectGetHeight(self.bounds) + 10) cornerRadius:(CGRectGetHeight(self.bounds) + 10) / 2.0].CGPath;
self.layer.shadowOffset = CGSizeMake(0.0, 0.0);
self.layer.shadowOpacity = 0.5;
self.layer.masksToBounds = NO;
}
@end