Closed kishanbh closed 3 years ago
Yes.
@sh-khashimov can we handle slice text ad image with vertical offset in the center of the slice of the wheel or with something else can you provide some suggestion or help then it will be helpful.
Did you try set TextPreferences.alignment to .center? You can set your image as a slice' background. You cannot change background image offset, try to change your image size instead.
@sh-khashimov thanks for the quick reply,
I'm using these for slice configuration like in your library example
let sliceContent = [Slice.ContentType.assetImage(name: prize.imageName, preferences: .variousWheelPodiumImage),
Slice.ContentType.text(text: prize.name, preferences: .variousWheelPodiumText(textColor: prize.textColor))]
var slice = Slice(contents: sliceContent, backgroundColor: prize.color)
Wherein background color I set UIColor with pattern image for square purple layer
With these, it can be possible to get desired output?
is there any option for a set size of image for a background image? like imageSize preferences because I'm setting image dynamically with a slice width
e.g., if there is only 4 slice then set cross image according to slice's frame
Take a look at the example project, which you can see at BackgroundImageExampleViewController.swift
.
You should set the image to backgroundImage
, not a backgroundColor
to the Slice.
Then you can change content mode for background image at fortuneWheel.configuration?.wheelPreferences.slicePreferences.backgroundImageContentMode
.
Hi, is it possible to set image (dynamic size --> fit to slice segment frame) and text in the center of the slice for any no. of slices in the wheel? I actually tried and get the following output but not able to set image and text in the center but with a vertical offset, we can not get desired output. Any help would be appreciated. can you provide some guidance?