Chcę zwiększyć rozprzestrzenianie się cienia w mojej UILabel, ale nie mogę znaleźć właściwość do tego. Dodałem zdjęcie poniżej, aby zilustrować problem.iOS - Cień rozprzestrzeniony na UILabel
Top Label jest pożądany efekt jestem w stanie stworzyć w programie Photoshop. Dolna etykieta ilustruje właściwości, które udało mi się znaleźć w iOS. Oto kod, którego użyłem do dolnej etykiety.
let bottomLabel = UILabel(frame: CGRectMake(0, 0, maxWidth, 18))
bottomLabel.backgroundColor = UIColor.clearColor()
bottomLabel.textColor = UIColor.whiteColor()
bottomLabel.font = UIFont.boldSystemFontOfSize(16)
bottomLabel.text = title
bottomLabel.textAlignment = .Center
bottomLabel.numberOfLines = 1
bottomLabel.layer.shadowOffset = CGSize(width: 0, height: 0)
bottomLabel.layer.shadowOpacity = 1
bottomLabel.layer.shadowRadius = 2
Znalazłem sugestię użycia drugiej etykiety jako cienia, ale nie dało to pożądanego rezultatu. Oto kod tej etykiety.
let bottomLabelShadow = UILabel(frame: CGRectMake(0, 1, maxWidth, 18))
bottomLabelShadow.backgroundColor = UIColor.clearColor()
bottomLabelShadow.textColor = UIColor.blackColor()
bottomLabelShadow.font = UIFont.boldSystemFontOfSize(16)
bottomLabelShadow.text = title
bottomLabelShadow.textAlignment = .Center
bottomLabelShadow.numberOfLines = 1
bottomLabelShadow.layer.shadowOffset = CGSize(width: 0, height: 0)
bottomLabelShadow.layer.shadowOpacity = 1
bottomLabelShadow.layer.shadowRadius = 2
Właściwie nie jest dobry artykuł o cieniach https://makeapppie.com/2015/05/19/swift-swift-how-to-make-a-drop-shadow-in-user-interfaces/ –