Tags » CALayer

Create Designable Subclass of UIView To Create Gradient Layer on Draw View

Source Code

// MARK: – Designable GradientView Class
@IBDesignable final class GradientView: UIView {

@IBInspectable var startColor: UIColor = UIColor.init(colorLiteralRed: 158.0/255.0, green: 201.0/255.0, blue: 250.0/255.0, alpha: 1.0) 116 more words


Animating Views with Custom Timing Functions on iOS

View animation on iOS is a ubiquitous part of the UI. From presenting & dismissing view controllers, to navigation; and on a smaller scale, subviews like buttons and labels, animations are everywhere and are an important element of adding polish to the feel and look of an app. 1,349 more words


Add Circle CALayer Inside A View Using Core Graphics iOS (Xamarin.iOS & Objective-C)


public CALayer createImage(UIColor fillerColor, UIColor borderColor, UIView view, nfloat x, nfloat y)
            // Get the size
            CGSize canvasSize = view.Frame.Size;
            nfloat scale = UIScreen.MainScreen.Scale; 230 more words


CALayer shadow code example

[ setShadowOffset:CGSizeZero];
[ setShadowOpacity:1];
[ setShadowRadius:3];
[ setShadowColor:[ CGColor]];
[ setShadowPath:[] CGPath]];
[ setShouldRasterize:YES];


  22 more words

CALayer shadow не видна при UIView backgroundColor равном clearColor (или nil)

Доказательства наличия проблемы:
1. http://stackoverflow.com/questions/12927626/shadow-not-showing-when-background-color-is-clear-color
2. http://stackoverflow.com/questions/15597956/ios-layer-background-color-not-showing-when-view-background-color-is-clear-colo

Решение: чтобы тень отображалась, цвет вьюхи не должен быть прозрачным (clearColor) или nil. С разными вариантами дальше не разбирался 7 more words