![]() |
Shadow effect |
shadowColor : set the color of the shadow. Needed to the CGColor.
shadowOpacity: set the opacity 0 to 1 for transparent the shadow.
shadowOffset : its give the 3D offset effect of view.
shadowRadius : it's set for how wide the shadow should be.
This is swift Code :
let viewShadow = UIView(frame: CGRect(x: 0, y: 0, width: 120, height: 120)) viewShadow.center = self.view.center viewShadow.backgroundColor = UIColor.yellow viewShadow.layer.shadowColor = UIColor.red.cgColor viewShadow.layer.shadowOpacity = 1 viewShadow.layer.shadowOffset = CGSize.zero viewShadow.layer.shadowRadius = 5 self.view.addSubview(viewShadow)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.