|
@@ -0,0 +1,108 @@
|
|
|
+From 7a8668248c5a9ddd65728adc1fd41e9845ec0164 Mon Sep 17 00:00:00 2001
|
|
|
+From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
|
|
|
+Date: Sun, 28 Apr 2013 17:14:15 +0200
|
|
|
+Subject: [PATCH] Convert code to ARC
|
|
|
+
|
|
|
+---
|
|
|
+ OBSlider/OBSlider.h | 8 ++++----
|
|
|
+ OBSlider/OBSlider.m | 20 +++++++-------------
|
|
|
+ 2 files changed, 11 insertions(+), 17 deletions(-)
|
|
|
+
|
|
|
+diff --git a/OBSlider/OBSlider.h b/OBSlider/OBSlider.h
|
|
|
+index 619836d..eeb32af 100644
|
|
|
+--- a/OBSlider/OBSlider.h
|
|
|
++++ b/OBSlider/OBSlider.h
|
|
|
+@@ -13,14 +13,14 @@
|
|
|
+ float scrubbingSpeed;
|
|
|
+ NSArray *scrubbingSpeeds;
|
|
|
+ NSArray *scrubbingSpeedChangePositions;
|
|
|
+-
|
|
|
++
|
|
|
+ CGPoint beganTrackingLocation;
|
|
|
+-
|
|
|
++
|
|
|
+ float realPositionValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ @property (assign, readonly) float scrubbingSpeed;
|
|
|
+-@property (retain) NSArray *scrubbingSpeeds;
|
|
|
+-@property (retain) NSArray *scrubbingSpeedChangePositions;
|
|
|
++@property (strong) NSArray *scrubbingSpeeds;
|
|
|
++@property (strong) NSArray *scrubbingSpeedChangePositions;
|
|
|
+
|
|
|
+ @end
|
|
|
+diff --git a/OBSlider/OBSlider.m b/OBSlider/OBSlider.m
|
|
|
+index 53d880a..1dcf4bc 100644
|
|
|
+--- a/OBSlider/OBSlider.m
|
|
|
++++ b/OBSlider/OBSlider.m
|
|
|
+@@ -28,12 +28,6 @@
|
|
|
+ @synthesize beganTrackingLocation;
|
|
|
+
|
|
|
+
|
|
|
+-- (void) dealloc
|
|
|
+-{
|
|
|
+- self.scrubbingSpeeds = nil;
|
|
|
+- self.scrubbingSpeedChangePositions = nil;
|
|
|
+- [super dealloc];
|
|
|
+-}
|
|
|
+
|
|
|
+
|
|
|
+ - (id) initWithFrame:(CGRect)frame
|
|
|
+@@ -56,7 +50,7 @@
|
|
|
+ - (id) initWithCoder:(NSCoder *)decoder
|
|
|
+ {
|
|
|
+ self = [super initWithCoder:decoder];
|
|
|
+- if (self != nil)
|
|
|
++ if (self != nil)
|
|
|
+ {
|
|
|
+ if ([decoder containsValueForKey:@"scrubbingSpeeds"]) {
|
|
|
+ self.scrubbingSpeeds = [decoder decodeObjectForKey:@"scrubbingSpeeds"];
|
|
|
+@@ -69,7 +63,7 @@
|
|
|
+ } else {
|
|
|
+ self.scrubbingSpeedChangePositions = [self defaultScrubbingSpeedChangePositions];
|
|
|
+ }
|
|
|
+-
|
|
|
++
|
|
|
+ self.scrubbingSpeed = [[self.scrubbingSpeeds objectAtIndex:0] floatValue];
|
|
|
+ }
|
|
|
+ return self;
|
|
|
+@@ -105,7 +99,7 @@
|
|
|
+ return i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+- return NSNotFound;
|
|
|
++ return NSNotFound;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+@@ -116,15 +110,15 @@
|
|
|
+ CGPoint previousLocation = [touch previousLocationInView:self];
|
|
|
+ CGPoint currentLocation = [touch locationInView:self];
|
|
|
+ CGFloat trackingOffset = currentLocation.x - previousLocation.x;
|
|
|
+-
|
|
|
++
|
|
|
+ // Find the scrubbing speed that curresponds to the touch's vertical offset
|
|
|
+ CGFloat verticalOffset = fabsf(currentLocation.y - self.beganTrackingLocation.y);
|
|
|
+- NSUInteger scrubbingSpeedChangePosIndex = [self findIndexOfLowerScrubbingSpeed:self.scrubbingSpeedChangePositions :verticalOffset];
|
|
|
++ NSUInteger scrubbingSpeedChangePosIndex = [self findIndexOfLowerScrubbingSpeed:self.scrubbingSpeedChangePositions :verticalOffset];
|
|
|
+ if (scrubbingSpeedChangePosIndex == NSNotFound) {
|
|
|
+ scrubbingSpeedChangePosIndex = [self.scrubbingSpeeds count];
|
|
|
+ }
|
|
|
+ self.scrubbingSpeed = [[self.scrubbingSpeeds objectAtIndex:scrubbingSpeedChangePosIndex - 1] floatValue];
|
|
|
+-
|
|
|
++
|
|
|
+ CGRect trackRect = [self trackRectForBounds:self.bounds];
|
|
|
+ realPositionValue = realPositionValue + (self.maximumValue - self.minimumValue) * (trackingOffset / trackRect.size.width);
|
|
|
+ if ( ((self.beganTrackingLocation.y < currentLocation.y) && (currentLocation.y < previousLocation.y)) ||
|
|
|
+@@ -146,7 +140,7 @@
|
|
|
+
|
|
|
+ - (void) endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
|
|
|
+ {
|
|
|
+- if (self.tracking)
|
|
|
++ if (self.tracking)
|
|
|
+ {
|
|
|
+ self.scrubbingSpeed = [[self.scrubbingSpeeds objectAtIndex:0] floatValue];
|
|
|
+ [self sendActionsForControlEvents:UIControlEventValueChanged];
|
|
|
+--
|
|
|
+1.7.12.4 (Apple Git-37)
|
|
|
+
|