Giter Site home page Giter Site logo

Comments (6)

anupam57 avatar anupam57 commented on July 25, 2024 3

Try this, it worked for me

override open func layoutSubviews() {
    super.layoutSubviews() 
    blurLayer?.frame = self.frame
    gradientLayer?.frame = self.frame
}

from ezygradientview.

fonesti avatar fonesti commented on July 25, 2024 2

To get a smooth orientation change animation the CAGradientLayer should be used as the UIView backing layer.

This is my solution with Swift 4:

import EZYGradientView

@IBDesignable
open class _EZYGradientView: EZYGradientView
{
    public required init?(coder aDecoder: NSCoder)
    {
        super.init(coder: aDecoder)
        self.gradientLayer = self.layer as? CAGradientLayer
    }
    
    override open func draw(_ rect: CGRect) {
        if self.gradientLayer == nil {
            self.gradientLayer = self.layer as? CAGradientLayer
        }
        super.draw(rect)
    }
    
    override open class var layerClass: Swift.AnyClass {
        get {
            return CAGradientLayer.self
        }
    }
}

Problem is well explained here: https://stackoverflow.com/questions/17555986/cagradientlayer-not-resizing-nicely-tearing-on-rotation-video-of-issue-attac

from ezygradientview.

mouness2020 avatar mouness2020 commented on July 25, 2024

yes same problem here
gradient bounds not updated after changing screen orientation

from ezygradientview.

ibrahimtall avatar ibrahimtall commented on July 25, 2024

Same here. Updating height constraints of the gradient view gives me white space on the extended parts.

from ezygradientview.

mouness2020 avatar mouness2020 commented on July 25, 2024

I used this library
https://github.com/soffes/GradientView
and add this line to fix the problem
gradientView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
i don't know if this line solve the problem in this library

from ezygradientview.

ibrahimtall avatar ibrahimtall commented on July 25, 2024

Thanks. Will try it. Tried the autoresizingMask on this one and it does not work.

update
For this one. Putting the gradientView function in "viewWillLayoutSubviews" seems to do the trick. The gradient view is rebuilt with the new frame being transitioned to.

from ezygradientview.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.