Skip to content

Commit

Permalink
fix HBDiscreteSliderTableCell breaking ios 5
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Mar 7, 2015
1 parent 401a73f commit 4e43919
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ws.hbang.common
Name: Cephei
Depends: mobilesubstrate, preferenceloader
Version: 1.2.1
Version: 1.2.2
Architecture: iphoneos-arm
Description: Useful functions for tweak developers
Maintainer: HASHBANG Productions <[email protected]>
Expand Down
5 changes: 3 additions & 2 deletions prefs/HBDiscreteSliderTableCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* number. Additionally, when dragging the slider, it jumps to these lines
* so the user's preference will always be a whole number.
*
* Requires iOS 7.0 or later.
* Requires iOS 7.0 or later. Superclass is dynamically changed at runtime to
* not break iOS 5 and 6, which do not have the PSSliderTableCell class.
*
* ### Specifier Parameters
* All parameters specific to
Expand All @@ -33,7 +34,7 @@
* </dict>
*/

@interface HBDiscreteSliderTableCell : PSSliderTableCell
@interface HBDiscreteSliderTableCell : PSControlTableCell

@property (nonatomic, retain) PSDiscreteSlider *control;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ @implementation HBDiscreteSliderTableCell
#pragma mark - PSControlTableCell

- (PSDiscreteSlider *)newControl {
PSDiscreteSlider *slider = [[PSDiscreteSlider alloc] initWithFrame:CGRectZero];
slider.trackMarkersColor = [UIColor colorWithWhite:0.596078f alpha:1];
PSDiscreteSlider *slider = [[%c(PSDiscreteSlider) ?: UISlider.class alloc] initWithFrame:CGRectZero];

if ([slider respondsToSelector:@selector(setTrackMarkersColor:)]) {
slider.trackMarkersColor = [UIColor colorWithWhite:0.596078f alpha:1];
}

return slider;
}

Expand Down
16 changes: 15 additions & 1 deletion prefs/Tweak.x
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#import <UIKit/UIKit.h>
#import "HBDiscreteSliderTableCell.h"
#import <version.h>

#pragma mark - iOS < 7 UISlider label fix

static NSInteger const kUISliderLabelTag = 1986096245;

Expand All @@ -12,3 +15,14 @@ static NSInteger const kUISliderLabelTag = 1986096245;
}

%end

#pragma mark - Version-specific runtime changes

%ctor {
if (IS_IOS_OR_NEWER(iOS_7_0)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
class_setSuperclass(HBDiscreteSliderTableCell.class, %c(PSSliderTableCell));
#pragma clang diagnostic pop
}
}

0 comments on commit 4e43919

Please sign in to comment.