• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSGraphicsContext currentContext() returns nil on OSX 10.11
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSGraphicsContext currentContext() returns nil on OSX 10.11


  • Subject: Re: NSGraphicsContext currentContext() returns nil on OSX 10.11
  • From: email@hidden
  • Date: Mon, 12 Oct 2015 21:24:44 +0900




> On Oct 12, 2015, at 8:45 PM, Lakshmi P Shanmugam <email@hidden> wrote:
>
> I'm running our application on OSX 10.11. NSGraphicsContext
> currentContext() returns nil in one of the drawing methods. The same code
> works fine on OSX 10.9.5 and 10.10.3.
> According to the documentation, currentContext returns an instance of a
> concrete subclass of NSGraphicsContext. It doesn't mention that it can
> return nil.
>
> Is this is a known issue with OSX 10.11? Are there valid/un-documented
> cases when currentContext can return nil?
Apple docs can be sparse.
It's implicit in 10.11 if it doesn't say nonnull or it isn't wrapped in NS_ASSUME_NONNULL
The Swift version returns an Optional.
So yes it can return nil.
If your view is not in a view hierarchy in a window, it can be nil.
In its essence a graphics context is a rect that can be drawn into.
You can also draw into a bitmap context but that is really a buffer of sorts.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >NSGraphicsContext currentContext() returns nil on OSX 10.11 (From: Lakshmi P Shanmugam <email@hidden>)

  • Prev by Date: NSGraphicsContext currentContext() returns nil on OSX 10.11
  • Next by Date: Re: NSButton with NSTexturedRoundedBezelStyle outside of NSToolbar
  • Previous by thread: NSGraphicsContext currentContext() returns nil on OSX 10.11
  • Next by thread: Re: NSGraphicsContext currentContext() returns nil on OSX 10.11
  • Index(es):
    • Date
    • Thread