I couldn't find this info anywhere so asking here.
What does element.layer.shadowOffset = CGSizeMake(2.0, 2.0)]
do exactly?
What offset does it indicate with respect to the element?
ShadowOffset is a CGSize representing how far to offset the shadow from the path. The default value of this property is (0.0, -3.0).
shadowColor : this will allow us to set the color of our shadow. shadowColor is a CGColor . shadowOffset : this will allow us to offset the shadow from the layer. shadowOffset is a CGRect where the width will move the shadow left and right and the height will move the shadow up and down.
shadowRadius : the blur radius used to render the layer's shadow. A value of zero creates a hard-edged shadow that exactly matches the shape of the view. A larger value creates a soft-edged shadow that looks more natural. The default value of this property is 3.0 .
iOS has built-in support for adding shadows to UIView components. All you need to do in order to add a shadow to a UIView object is to set the shadow properties of the view's layer. Shadows are a powerful user interface design element, making the visual components stand out by giving them a 3D look and feel.
The shadowOffset value changes the location of the shadow with respect to the element's frame. An offset of (2,2) will put the shadow 2 pixels to the right and 2 pixels down with respect to the element. An offset of (15,45) will put the shadow 15 pixels to the right and 45 pixels down. These can also be negative values if you want the shadow to be to the top or left of the element.
And by pixels I mean units. Based off the original (non-retina) pixel sizes of apple devices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With