Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change Tint Colour,Background Image and other layer properties. #17

Open
developerawais1 opened this issue Dec 17, 2019 · 2 comments

Comments

@developerawais1
Copy link

developerawais1 commented Dec 17, 2019

I'm unable to change layer properties from storyboard.

@carlos0193
Copy link

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
}

@carlos0193
Copy link

carlos0193 commented Jan 25, 2021

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants