Explorar o código

VLCStatusLabel: override initialization methods, remove redundant CoreGraphics method invocation

Gleb Pinigin %!s(int64=11) %!d(string=hai) anos
pai
achega
19b50edcdc
Modificáronse 1 ficheiros con 27 adicións e 3 borrados
  1. 27 3
      Sources/VLCStatusLabel.m

+ 27 - 3
Sources/VLCStatusLabel.m

@@ -21,6 +21,31 @@
 
 @implementation VLCStatusLabel
 
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self)
+        [self initialize];
+
+    return self;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)aDecoder
+{
+    self = [super initWithCoder:aDecoder];
+    if (self)
+        [self initialize];
+
+    return self;
+}
+
+- (void)initialize
+{
+    self.backgroundColor = [UIColor clearColor];
+}
+
+#pragma mark -
+
 - (void)showStatusMessage:(NSString *)message
 {
     self.text = message;
@@ -74,11 +99,10 @@
     [UIView animateWithDuration:duration animations:animationBlock completion:completionBlock];
 }
 
+#pragma mark -
+
 - (void)drawRect:(CGRect)rect
 {
-    self.backgroundColor = [UIColor clearColor];
-    CGContextClearRect(UIGraphicsGetCurrentContext(), rect);
-
     UIColor *drawingColor = [UIColor VLCDarkBackgroundColor];
     [drawingColor setFill];