-3

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.

slider testing

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.

error 1

Does anyone have any idea why I cannot access the parameters? I've got a feeling I've mucked up on the bridging header!

beninabox_uk
  • 684
  • 2
  • 11
  • 27
  • 1
    "the Swift alternative for these doesn't work" That is completely meaningless. Show what you are doing (i.e. your code) and explain what happens when you do it. – matt Oct 09 '15 at 21:30
  • Yeah sorry that was pretty meaning less of me! I get the following error (the red error on the image) because the UISlider doesn't have the member 'popUpViewCornerRadius'. – beninabox_uk Oct 09 '15 at 21:44

1 Answers1

0

The problem is that you have configured self.slider as a UISlider. But the properties you are trying to set do not exist for a UISlider. They exist for a ASValueTrackingSlider.

matt
  • 515,959
  • 87
  • 875
  • 1,141