我试图使我的标志形象的一些阴影效果,但效果并不炫耀。.
func setUpLogo(){
view.addSubview(logoView)
logoView.translatesAutoresizingMaskIntoConstraints = false
logoView.topAnchor.constraint(equalTo: view.topAnchor,constant: 220).isActive = true
logoView.widthAnchor.constraint(equalToConstant: 140).isActive = true
logoView.heightAnchor.constraint(equalToConstant: 190).isActive = true
logoView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
logoView.image = UIImage(named: "logoCharity")
logoView.layer.cornerRadius = 11
logoView.clipsToBounds = true
logoView.layer.shadowColor = UIColor.red.cgColor
logoView.layer.shadowOpacity = 1
logoView.layer.shadowOffset = CGSize(width: 0, height: 0)
logoView.layer.shadowRadius = 10
}
2条答案
按热度按时间7kjnsjlb1#
基本上,你不能让 * 裁剪角 * 和 * 阴影 * 重叠视图边界。
要实现这一点,您需要有两个视图-一个用于剪裁,一个用于阴影。
t9eec4r02#
你能试试这个吗?或者改为logoView。clipsToBounds = false