Comments (6)
Try this, it worked for me
override open func layoutSubviews() {
super.layoutSubviews()
blurLayer?.frame = self.frame
gradientLayer?.frame = self.frame
}
from ezygradientview.
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.
yes same problem here
gradient bounds not updated after changing screen orientation
from ezygradientview.
Same here. Updating height constraints of the gradient view gives me white space on the extended parts.
from ezygradientview.
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.
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)
- Doesn't update on changing properties HOT 2
- Any similar library for Android?
- how to add multiple color in gradient? HOT 1
- Gradient partially not working HOT 1
- Hi, Do you know how to get this effect? I would like the top edge of Visual Effect View to be invisible. Example :
- Exposing gradientLayer property HOT 3
- swift 3 support HOT 7
- Version 1.5.1 Not working with actual Swift language HOT 2
- Release new version HOT 2
- argument labels do not match error HOT 1
- Swift 4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ezygradientview.