I'm trying to create a popover for a slider in Swift
. Basically I have a UISlider
that is between 0 and 255. What I want is to be able to do is have the slider show a popover when the user holds the bar, and it to display 0-100%.
Researching, I found this: https://github.com/alskipp/ASValueTrackingSlider and have implemented it in my project. Only thing is that it's in Objective C
. This seems like the perfect popover for my app, but I've imported it into my project, and after creating a bridging header and set the class for the UISlider for ASValueTrackingSlider
.
Now, when dragging the slider, I do get the following popover appear.
However, according to the github.com
page, I should be able to customize the colour of the popover etc and configure the NSNumberFormatter
using the following commands in Objective C
.
self.slider.popUpViewCornerRadius = 12.0;
[self.slider setMaxFractionDigitsDisplayed:0];
self.slider.popUpViewColor = [UIColor colorWithHue:0.55 saturation:0.8 brightness:0.9 alpha:0.7];
self.slider.font = [UIFont fontWithName:@"GillSans-Bold" size:22];
self.slider.textColor = [UIColor colorWithHue:0.55 saturation:1.0 brightness:0.5 alpha:1];
However, doing the Swift alternative for these doesn't work because it cannot access the parameters for some reason. There is no member present for each of the members I've referred to above.
Does anyone have any idea why I cannot access the parameters? I've got a feeling I've mucked up on the bridging header!