1

In Apple's documentation for NSShadow in UIKit, they state:

An NSShadow object may be used in one of two ways. First, it may be set, like a color or a font, in which case its attributes are applied to all content drawn thereafter—or at least until another shadow is applied or a previous graphics state is restored.

But NSShadow does not appear to have a set() method, at least with UIKit. Am I missing something, or is this a mistake on Apple's part (possible due to being copied verbatim from the AppKit Mac OS X NSShadow documentation)?

Is there any way to achieve the set() behaviour, or are NSAttributedStrings the only thing NSShadow is useful for in UIKit?

varkor
  • 499
  • 3
  • 13

1 Answers1

1

Is there any way to achieve the set() behaviour

Not with NSShadow. Keep in mind, though, that all UIKit drawing is just a convenience for using CoreGraphics directly, which is where all the real action is anyway. Thus, for drawing in general, call CGContextSetShadow.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • 1
    For example code and further discussion, see my book: http://www.apeth.com/iOSBook/ch15.html#_shadows Note in particular that transparency layers are useful for accumulating drawing to which a single unified shadow is to be applied. – matt Jul 09 '15 at 19:22