- Fix dealloc crash

This commit is contained in:
giuseppenuc committed 2016-04-05 15:23:13 +02:00
1 parent 52ac833f7c
commit afddd1e959
1 file changed
+1 -5
+1 -5
View File
@@ -9,8 +9,6 @@
#import "GradientButton.h" #import "GradientButton.h"
#import "PureLayout.h" #import "PureLayout.h"
static char ClassNameKVOContext = 0;
@interface GradientButton() @interface GradientButton()
@property (nonatomic, strong) CAGradientLayer *gradientLayer; @property (nonatomic, strong) CAGradientLayer *gradientLayer;
@@ -114,11 +112,9 @@ static char ClassNameKVOContext = 0;
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{ {
if (context == ClassNameKVOContext && object == self && [keyPath isEqualToString:@"bounds"]) { if (object == self && [keyPath isEqualToString:@"bounds"]) {
if(_gradientLayer) { if(_gradientLayer) {
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint]; [self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
} }
} }
} }