-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
If the frame of a view is large, for example: width = 3_000 and height = 3_000.
The CPU runs >100% for a bit then drops to 0 quickly and there is an incorrect result with gradient.
for example if: width = 2_000 and height = 2_000 , there is no problem:

Code to test this bug:
import UIKit
import UIGradient
import TinyConstraints
class ViewController: UIViewController {
lazy var scrollView: UIScrollView = {
let scrollView = UIScrollView()
return scrollView
}()
lazy var view1 = UIView()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
view.addSubview(scrollView)
scrollView.edgesToSuperview(usingSafeArea: true)
scrollView.addSubview(view1)
let width: CGFloat = 3_000
let height: CGFloat = 3_000
view1.edgesToSuperview()
view1.width(width)
view1.height(height)
let frame = CGRect(origin: .zero, size: CGSize(width: width, height: height))
view1.backgroundColor = UIColor.fromGradientWithDirection(.topToBottom, frame: frame, colors: [UIColor.blue, UIColor.green])
}
}
simple demo:
TestProject1.zip
Metadata
Metadata
Assignees
Labels
No labels
