Questions tagged [nsshadow]

An NSShadow object encapsulates the attributes used to create a drop shadow during drawing operations. Available in iOS 6.0 and later in UIKit and available in OS X v10.3 and later in AppKit.

An NSShadow object encapsulates the attributes used to create a drop shadow during drawing operations.

Shadows are always drawn in the default user coordinate space, regardless of any transformations applied to that space. This means that rotations, translations and other transformations of the current transformation matrix (the CTM) do not affect the resulting shadow. Another way to think about this is that changes to the CTM do not move or change the apparent position of the shadow’s light source.

There are two positional parameters for a shadow: an x-offset and a y-offset. These values are expressed using a single size data type (CGSize on iOS, NSSize on OS X) and using the units of the default user coordinate space. Positive values for these offsets extend up and to the right.

In addition to its positional parameters, a shadow also contains a blur radius, which specifies how much a drawn object's image mask is blurred before it is composited onto the destination. A value of 0 means there is no blur. Larger values give correspondingly larger amounts of blurring.

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. Second, it may be used as the value for the NSShadowAttributeName text attribute, in which case it is applied to the glyphs corresponding to the characters bearing this attribute.

23 questions
1
vote
1 answer

NSShadow set() method in iOS

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…
varkor
  • 499
  • 3
  • 13
1
vote
1 answer

Creating NSShadow makes an error

I'm making a white shadow in Objective-C and using the code NSShadow *myShadow = [[NSShadow alloc]init]; [myShadow setShadowColor: [UIColor whiteColor]]; and it seems to work fine, but when I'm trying to shorten it to NSShadow *myShadow =…
turingtested
  • 6,356
  • 7
  • 32
  • 47
1
vote
1 answer

Using NSShadow on Navigation Bar Button Items in iOS 7

I have a navigation bar that looks like so: It was created with the following code: // AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSShadow *textShadow =…
JWK
  • 3,345
  • 2
  • 19
  • 27
1
vote
1 answer

NSShadow drawing bug

Hi in my application i have a custom view with CALayer (i use it for transition animation), in that view i add some subviews, one of them is a view with NSTableView. Each cell of NSTableView, draws it's content with shadow. Code like this: NSShadow*…
Vespen
  • 11
  • 2
0
votes
1 answer

CALayer shadowPath ignored on rendering as image

I am making an app that uses CAlayer to show contents like image in a NSWindow. The layer has shadows styled with shadowPath to make a better appearance. Finally to save/export the whole CAlayer and its contents the parent NSView is converted to an…
vigu
  • 21
  • 4
0
votes
1 answer

Odd problem with NSImage -lockFocusFlipped:

I'm using NSImage's -lockFocusFlipped: method to do some drawing into an image. My code looks like this: NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(256, 256)]; [image lockFocusFlipped:YES]; NSShadow *shadow = [[NSShadow alloc]…
indragie
  • 18,002
  • 16
  • 95
  • 164
0
votes
1 answer

Shadow is drawn in "main" Storyboard but not in any other storyboard

I try to write my own comboBox as NSComboBox does not has features I need. So, I subclassed an NSTextField and monitor the textinput and depending of the stringValue a TableView will get it's data. So when the TableView should be displayed the…
MatzeLoCal
  • 392
  • 3
  • 14
-1
votes
1 answer

Draw NSShadow inside a NSView

I'm trying to draw a NSShadow on the background of a NSView. I want to use it as a replacement for NSGradient, as I need to support Mac OS X Tiger. How may I do that? I know this must be pretty easy and I must be making some mistake. Thanks!
Fernando Valente
  • 1,096
  • 1
  • 8
  • 30
1
2