tapptitude / TTFortuneWheel-iOS

Fortune spinning wheel that supports custom drawing.
MIT License
132 stars 41 forks source link

Images #2

Closed inkl closed 6 years ago

inkl commented 6 years ago

Hi, is it possible to adding image or showing image instead of text? Thanks a lot.

EfraimB commented 6 years ago

Hello, You can add any cg graphics to your slice by overriding this methods. public func drawAdditionalGraphics(in context:CGContext, circularSegmentHeight:CGFloat,radius:CGFloat,sliceDegree:CGFloat). You can see a example on how we added the needle image in the slice implementation FortuneWheelSliceImpl. You will have to dynamically compute the radian position of the image using the provided parameters ( circularSegmentHeight, radius, sliceDegree). Here is a graphic legend of all the properties https://gist.github.com/EfraimB/a43382a2360ae0311dd7823432578f94