How is CALayer.shadowOffset set from CGSize?

77 views Asked by At

If I do view.layer.shadowOffset = CGSize(width: -1, height: 1) what exactly does the numbers -1 for width, and 1 for height mean? How is the shadow determined from the CGSize passed? I found the documentation, but it's not very useful

1

There are 1 answers

0
DionizB On

Consider width and height as x and y. And you should be aware in iOS coordinates start from top left. CGSize(width: -1, height: 1) means that the shadow will move 1 point to the left on x-axis and 1 point up on y-axis.