SpinWheelControl icon indicating copy to clipboard operation
SpinWheelControl copied to clipboard

Label font / size / border properties not updating?

Open hebertpalomino opened this issue 5 years ago • 6 comments

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 avatar Apr 08 '19 15:04 hebertpalomino

hello?

hebertpalomino avatar Apr 10 '19 12:04 hebertpalomino

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.

joshdhenry avatar Apr 11 '19 05:04 joshdhenry

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!

hebertpalomino avatar Apr 11 '19 10:04 hebertpalomino

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)

joshdhenry avatar Apr 15 '19 04:04 joshdhenry

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!

hebertpalomino avatar Apr 15 '19 12:04 hebertpalomino

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.

joshdhenry avatar Apr 16 '19 04:04 joshdhenry