joshdhenry / SpinWheelControl

An inertial spinning wheel UI control that allows selection of an item. Cocoapod written in Swift.
BSD 3-Clause "New" or "Revised" License
73 stars 25 forks source link

Label font / size / border properties not updating? #18

Open hebertpalomino opened 5 years ago

hebertpalomino commented 5 years ago

Hello,

I'm doing the following in wedgeForSliceAtIndex and nothing is being updated:

        let wedge = SpinWheelWedge()
        wedge.shape.borderColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 0.2029152685)
        wedge.shape.borderWidth = 0
        wedge.shape.fillColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 0.2029152685)
        wedge.label.text = String(index+1)
        wedge.label.font.withSize(30)
        return wedge

The only thing that updates is the text and the fillColor. Everything else is ignored. Any ideas?

hebertpalomino commented 5 years ago

hello?

joshdhenry commented 5 years ago

I'm able to recreate this. I think making wedge borders will involve creating a separate CAShapeLayer to be the border for each wedge when the wheel is drawn. I'll see if I can get an example working for you. It'll have to be a change in the library's code until I can get it supported from the outside. I'll look into changing the font size, too.

hebertpalomino commented 5 years ago

Yes there's 2 things that I cannot do that seem like they should be supported:

  1. Wedge border width set to 0 shouldn't show a border (also border color doesn't seem to affect anything)
  2. Label font or color don't seem to do anything either although the actual text content is affected. Thanks again!
joshdhenry commented 5 years ago

I'm going to make these values accessible from the outside in the next version, which should be out soon. But for now, here are the manual changes you'll need to make to the code to get what you're looking for.

Set the border width and color in SpinWheelWedgeShape.swift, lines 14 and 15.

Change the label color in SpinWheelWedgeLabel.swift, line 14.

Change the font size by deleting line 16 in SpinWheelWedgeLabel.swift and adding this line: self.font = font.withSize(36)

hebertpalomino commented 5 years ago

Thank you! I believe I tried that before and it still didn't work and realized I also had to change this in my podfile install! 'cocoapods', :disable_input_output_paths => true because of xcode bug where changes in dev pods require a clean and re-build. Good to have this option in the library though. Thanks again!

joshdhenry commented 5 years ago

Thanks I didn't know this was a bug but I did notice I've been needing to clean and rebuild constantly. I've been picking up development on this library a bit more lately and couldn't remember if it was just always that way. I'll give that line a shot in my own environment.