UIButton with GradientLayer obscures image and darkens gradient

So I managed to get around this by doing a [button bringSubviewToFront:button.imageView] after adding the gradient. Seems that no matter what I do the new layer will add on top of the imageView, so I need to push that to the front afterwards. Objective-C: [button bringSubviewToFront:button.imageView] Swift 4.1: button.bringSubview(toFront:button.imageView!)

How to change CAGradientLayer color points?

The startPoint and endPoint properties of a CAGradientLayer are defined in the “unit coordinate system”. In the unit coordinate system: (0,0) corresponds to the smallest coordinates of the layer’s bounds rectangle, which on iOS is its upper-left corner unless the layer has been transformed; (1,1) corresponds to the largest coordinates of the layer’s bounds rectangle, … Read more

UIView transparent gradient

This was an embarrassingly easy fix: apply a CAGradientLayer as my subview’s mask. CAGradientLayer *gradientLayer = [CAGradientLayer layer]; gradientLayer.frame = _fileTypeScrollView.bounds; gradientLayer.colors = [NSArray arrayWithObjects:(id)[UIColor whiteColor].CGColor, (id)[UIColor clearColor].CGColor, nil]; gradientLayer.startPoint = CGPointMake(0.8f, 1.0f); gradientLayer.endPoint = CGPointMake(1.0f, 1.0f); _fileTypeScrollView.layer.mask = gradientLayer; Thanks to Cocoanetics for pointing me in the right direction!

CAGradientLayer, not resizing nicely, tearing on rotation

When you create a layer (like your gradient layer), there’s no view managing the layer (even when you add it as a sublayer of some view’s layer). A standalone layer like this doesn’t participate in the UIView animation system. So when you update the frame of the gradient layer, the layer animates the change with … Read more

How to Apply Gradient to background view of iOS Swift App

Xcode 11 • Swift 5.1 You can design your own Gradient View as follow: @IBDesignable public class Gradient: UIView { @IBInspectable var startColor: UIColor = .black { didSet { updateColors() }} @IBInspectable var endColor: UIColor = .white { didSet { updateColors() }} @IBInspectable var startLocation: Double = 0.05 { didSet { updateLocations() }} @IBInspectable var … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)