HamzaGhazouani / HGCircularSlider

A custom reusable circular / progress slider control for iOS application.
MIT License
2.6k stars 278 forks source link

Can't customize slider with code. #66

Closed AndyIbanez closed 4 years ago

AndyIbanez commented 4 years ago

I'm having a weird issue that I don't know how to fix.

I dragged a view through storyboard and changed its class to CircularView. In code, I'm setting the numberOfRounds property as so:

circularSlider.numberOfRounds = 1

My app crashes with EXC_BAD_ACCESS.

I don't see anything strange in the definition of the method in the source code, so I don't know why this isn't working. If I customize the view via Interface Builder, nothing shows up.

I installed the dependency with CocoaPods. Currently using v2.2.0.

Trying to debug the app:

(lldb) po circularSlider
▿ Optional<CircularSlider>
  - some : <UIView: 0x7fbae370a270; frame = (82 146; 250 250); autoresize = RM+BM; layer = <CALayer: 0x600003d0ef80>>

(lldb) po circularSlider.numberOfRounds
error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0).
The process has been returned to the state before expression evaluation.
(lldb) 

And again, the numberOfRows property is not even set as an optional in the source code, so I don't think it's crashing due to it being nil? I'm very dumbfounded with this problem.

AndyIbanez commented 4 years ago

Figured it out.

I was also getting this in the console:

2020-03-18 10:20:26.786758-0400 JustDesign[12539:12145945] [Storyboard] Unknown class CircularSlider in Interface Builder file.

I forgot I had to set the Module in Interface builder. Select your slider and then in Module write HGCircularSlider. It will work properly then.