SHARE
TWEET

Untitled

a guest Sep 17th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func applyShadow(shadowColor: UIColor, shadowWidth: CGFloat,
  2.                      shadowHeigt: CGFloat, shadowRadius: CGFloat,
  3.                      subString: String) {
  4.         if let range = self.string.range(of: subString) {
  5.             self.applyShadow(shadowColor: shadowColor, shadowWidth: shadowWidth,
  6.                              shadowHeigt: shadowHeigt, shadowRadius: shadowRadius,
  7.                              onRange: NSRange(range, in: self.string))
  8.         }
  9.     }
  10.     func applyShadow(shadowColor: UIColor, shadowWidth: CGFloat,
  11.                      shadowHeigt: CGFloat, shadowRadius: CGFloat,
  12.                      onRange: NSRange) {
  13.         let shadow = NSShadow()
  14.         shadow.shadowOffset = CGSize(width: shadowWidth, height: shadowHeigt)
  15.         shadow.shadowColor = shadowColor
  16.         shadow.shadowBlurRadius = shadowRadius
  17.         self.addAttributes([NSAttributedString.Key.shadow : shadow], range: onRange)
  18.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top