Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func applyShadow(shadowColor: UIColor, shadowWidth: CGFloat,
- shadowHeigt: CGFloat, shadowRadius: CGFloat,
- subString: String) {
- if let range = self.string.range(of: subString) {
- self.applyShadow(shadowColor: shadowColor, shadowWidth: shadowWidth,
- shadowHeigt: shadowHeigt, shadowRadius: shadowRadius,
- onRange: NSRange(range, in: self.string))
- }
- }
- func applyShadow(shadowColor: UIColor, shadowWidth: CGFloat,
- shadowHeigt: CGFloat, shadowRadius: CGFloat,
- onRange: NSRange) {
- let shadow = NSShadow()
- shadow.shadowOffset = CGSize(width: shadowWidth, height: shadowHeigt)
- shadow.shadowColor = shadowColor
- shadow.shadowBlurRadius = shadowRadius
- self.addAttributes([NSAttributedString.Key.shadow : shadow], range: onRange)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement