project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.m
branchios-develop
changeset 12877 00215a7ec5f5
parent 11554 893722a2a1f9
child 13171 ba5c794adae3
--- a/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.m	Fri Dec 29 22:37:31 2017 +0100
+++ b/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.m	Sat Dec 30 01:22:11 2017 +0100
@@ -12,7 +12,7 @@
 #pragma mark -
 #pragma mark Private UIView subclass rendering the popup showing slider value
 @interface SliderValuePopupView : UIView
-@property (nonatomic, retain) UIFont *font;
+@property (nonatomic, strong) UIFont *font;
 @property (nonatomic, copy) NSString *text;
 @property (nonatomic) float arrowOffset;
 @end
@@ -23,7 +23,7 @@
 @synthesize text = _text;
 @synthesize arrowOffset = _arrowOffset;
 
--(id) initWithFrame:(CGRect) frame {
+- (id)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
         self.font = [UIFont boldSystemFontOfSize:18];
@@ -31,13 +31,8 @@
     return self;
 }
 
--(void) dealloc {
-    self.text = nil;
-    self.font = nil;
-    [super dealloc];
-}
 
--(void) drawRect:(CGRect) rect {
+- (void)drawRect:(CGRect)rect {
     // Create the path for the rounded rectangle
     CGRect roundedRect = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, floorf(self.bounds.size.height * 0.8));
     UIBezierPath *roundedRectPath = [UIBezierPath bezierPathWithRoundedRect:roundedRect cornerRadius:6.0];
@@ -95,14 +90,14 @@
 
 #pragma mark Private methods
 
--(void) _constructSlider {
+- (void)_constructSlider {
     valuePopupView = [[SliderValuePopupView alloc] initWithFrame:CGRectZero];
     valuePopupView.backgroundColor = [UIColor clearColor];
     valuePopupView.alpha = 0.0;
     [self addSubview:valuePopupView];
 }
 
--(void) _fadePopupViewInAndOut:(BOOL)aFadeIn {
+- (void)_fadePopupViewInAndOut:(BOOL)aFadeIn {
     [UIView beginAnimations:nil context:NULL];
     [UIView setAnimationDuration:0.25];
     if (aFadeIn) {
@@ -113,7 +108,7 @@
     [UIView commitAnimations];
 }
 
--(void) _positionAndUpdatePopupView {
+- (void)_positionAndUpdatePopupView {
     CGRect _thumbRect = self.thumbRect;
     CGRect popupRect = CGRectOffset(_thumbRect, 0, -floorf(_thumbRect.size.height * 1.5));
     // (-100, -15) determines the size of the the rect
@@ -136,7 +131,7 @@
 
 #pragma mark Memory management
 
--(id) initWithFrame:(CGRect) frame {
+- (id)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
         [self _constructSlider];
@@ -144,7 +139,7 @@
     return self;
 }
 
--(id) initWithCoder:(NSCoder *)aDecoder {
+- (id)initWithCoder:(NSCoder *)aDecoder {
     self = [super initWithCoder:aDecoder];
     if (self) {
         [self _constructSlider];
@@ -152,15 +147,10 @@
     return self;
 }
 
--(void) dealloc {
-    [valuePopupView release];
-    [textValue release];
-    [super dealloc];
-}
 
 #pragma mark -
 #pragma mark UIControl touch event tracking
--(BOOL) beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
     // Fade in and update the popup view
     CGPoint touchPoint = [touch locationInView:self];
     // Check if the knob is touched. Only in this case show the popup-view
@@ -171,17 +161,17 @@
     return [super beginTrackingWithTouch:touch withEvent:event];
 }
 
--(BOOL) continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
     // Update the popup view as slider knob is being moved
     [self _positionAndUpdatePopupView];
     return [super continueTrackingWithTouch:touch withEvent:event];
 }
 
--(void) cancelTrackingWithEvent:(UIEvent *)event {
+- (void)cancelTrackingWithEvent:(UIEvent *)event {
     [super cancelTrackingWithEvent:event];
 }
 
--(void) endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
     // Fade out the popoup view
     [self _fadePopupViewInAndOut:NO];
     [super endTrackingWithTouch:touch withEvent:event];