CircleBar
CircleBar copied to clipboard
Unable to change Tint Colour,Background Image and other layer properties.
I'm unable to change layer properties from storyboard.
I'm unable to change layer properties from storyboard.
You need to change the class with this
image?.withRenderingMode(.alwaysTemplate)
UIColor.white.set()
or the color that you want
private func image(with image: UIImage?, scaledTo newSize: CGSize) -> UIImage? {
image?.withRenderingMode(.alwaysTemplate)
UIGraphicsBeginImageContextWithOptions(newSize, _: false, _: 0.0)
UIColor.white.set()
image?.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))
let newImage: UIImage? = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage
}
on SCHCircleBar
let fillColor: UIColor = UIColor.black
you need to set color to backGounr
override func draw(_ rect: CGRect) {
let fillColor: UIColor = UIColor.black
tabWidth = self.bounds.width / CGFloat(self.items!.count)
let bezPath = drawPath(for: index)
bezPath.close()
fillColor.setFill()
bezPath.fill()
let mask = CAShapeLayer()
mask.fillRule = .evenOdd
mask.fillColor = fillColor.cgColor
mask.path = bezPath.cgPath
if (self.animated) {
let bezAnimation = CABasicAnimation(keyPath: "path")
let bezPathFrom = drawPath(for: previousIndex)
bezAnimation.toValue = bezPath.cgPath
bezAnimation.fromValue = bezPathFrom.cgPath
bezAnimation.duration = 0.3
bezAnimation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
mask.add(bezAnimation, forKey: nil)
}
self.layer.mask = mask
}