0002-Convert-code-to-ARC.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. From 7a8668248c5a9ddd65728adc1fd41e9845ec0164 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
  3. Date: Sun, 28 Apr 2013 17:14:15 +0200
  4. Subject: [PATCH] Convert code to ARC
  5. ---
  6. OBSlider/OBSlider.h | 8 ++++----
  7. OBSlider/OBSlider.m | 20 +++++++-------------
  8. 2 files changed, 11 insertions(+), 17 deletions(-)
  9. diff --git a/OBSlider/OBSlider.h b/OBSlider/OBSlider.h
  10. index 619836d..eeb32af 100644
  11. --- a/OBSlider/OBSlider.h
  12. +++ b/OBSlider/OBSlider.h
  13. @@ -13,14 +13,14 @@
  14. float scrubbingSpeed;
  15. NSArray *scrubbingSpeeds;
  16. NSArray *scrubbingSpeedChangePositions;
  17. -
  18. +
  19. CGPoint beganTrackingLocation;
  20. -
  21. +
  22. float realPositionValue;
  23. }
  24. @property (assign, readonly) float scrubbingSpeed;
  25. -@property (retain) NSArray *scrubbingSpeeds;
  26. -@property (retain) NSArray *scrubbingSpeedChangePositions;
  27. +@property (strong) NSArray *scrubbingSpeeds;
  28. +@property (strong) NSArray *scrubbingSpeedChangePositions;
  29. @end
  30. diff --git a/OBSlider/OBSlider.m b/OBSlider/OBSlider.m
  31. index 53d880a..1dcf4bc 100644
  32. --- a/OBSlider/OBSlider.m
  33. +++ b/OBSlider/OBSlider.m
  34. @@ -28,12 +28,6 @@
  35. @synthesize beganTrackingLocation;
  36. -- (void) dealloc
  37. -{
  38. - self.scrubbingSpeeds = nil;
  39. - self.scrubbingSpeedChangePositions = nil;
  40. - [super dealloc];
  41. -}
  42. - (id) initWithFrame:(CGRect)frame
  43. @@ -56,7 +50,7 @@
  44. - (id) initWithCoder:(NSCoder *)decoder
  45. {
  46. self = [super initWithCoder:decoder];
  47. - if (self != nil)
  48. + if (self != nil)
  49. {
  50. if ([decoder containsValueForKey:@"scrubbingSpeeds"]) {
  51. self.scrubbingSpeeds = [decoder decodeObjectForKey:@"scrubbingSpeeds"];
  52. @@ -69,7 +63,7 @@
  53. } else {
  54. self.scrubbingSpeedChangePositions = [self defaultScrubbingSpeedChangePositions];
  55. }
  56. -
  57. +
  58. self.scrubbingSpeed = [[self.scrubbingSpeeds objectAtIndex:0] floatValue];
  59. }
  60. return self;
  61. @@ -105,7 +99,7 @@
  62. return i;
  63. }
  64. }
  65. - return NSNotFound;
  66. + return NSNotFound;
  67. }
  68. @@ -116,15 +110,15 @@
  69. CGPoint previousLocation = [touch previousLocationInView:self];
  70. CGPoint currentLocation = [touch locationInView:self];
  71. CGFloat trackingOffset = currentLocation.x - previousLocation.x;
  72. -
  73. +
  74. // Find the scrubbing speed that curresponds to the touch's vertical offset
  75. CGFloat verticalOffset = fabsf(currentLocation.y - self.beganTrackingLocation.y);
  76. - NSUInteger scrubbingSpeedChangePosIndex = [self findIndexOfLowerScrubbingSpeed:self.scrubbingSpeedChangePositions :verticalOffset];
  77. + NSUInteger scrubbingSpeedChangePosIndex = [self findIndexOfLowerScrubbingSpeed:self.scrubbingSpeedChangePositions :verticalOffset];
  78. if (scrubbingSpeedChangePosIndex == NSNotFound) {
  79. scrubbingSpeedChangePosIndex = [self.scrubbingSpeeds count];
  80. }
  81. self.scrubbingSpeed = [[self.scrubbingSpeeds objectAtIndex:scrubbingSpeedChangePosIndex - 1] floatValue];
  82. -
  83. +
  84. CGRect trackRect = [self trackRectForBounds:self.bounds];
  85. realPositionValue = realPositionValue + (self.maximumValue - self.minimumValue) * (trackingOffset / trackRect.size.width);
  86. if ( ((self.beganTrackingLocation.y < currentLocation.y) && (currentLocation.y < previousLocation.y)) ||
  87. @@ -146,7 +140,7 @@
  88. - (void) endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
  89. {
  90. - if (self.tracking)
  91. + if (self.tracking)
  92. {
  93. self.scrubbingSpeed = [[self.scrubbingSpeeds objectAtIndex:0] floatValue];
  94. [self sendActionsForControlEvents:UIControlEventValueChanged];
  95. --
  96. 1.7.12.4 (Apple Git-37)