How to change retina display system preferences in OSX?
Check out http://www.reddit.com/r/apple/comments/vi9yf/set_your_retina_macbook_pros_resolution_to/ -- uses the private API CGSGetDisplayModeDescriptionOfLength and CGSConfigureDisplayMode to set. Code's included in the kindly distributed .app bundle.
I just wrote up a lengthy post about my endeavours in trying to answer the same question - see
http://garethjenkins.com/2012/07/01/investigating-a-high-resolution-retina-utility-for-macbook-pro-1x-and-2x-modes/
Mac OS X: Best way to do runtime check for retina display?
If you really do need to do this, take a look at -[NSScreen backingScaleFactor]
. But, this does seem wrong-headed, at least without knowing more about why you want to know.
While there is currently only one Mac with a Retina display, there may eventually be standalone displays that support Retina (and can be attached/detached at runtime) and you may be able to configure the built-in Retina display in 1x mode. Thus the answer to the question "is there a Retina display attached" can change at any time.
Rather, you may want to know if your content should be drawn with a given scale by using the -convert*ToBacking:
methods or -[NSWindow backingScaleFactor]
. For a ton more detail, watch the WWDC 2012 session video "Advanced Tips and Tricks for High Resolution on OS X" (when posted, hopefully within the next few weeks).
Related Topics
Swift: Mkannotation Long Title Text
How to Pass a Completion Block to Another Class in Swift
Xcode 6.1 Swift Extensions - Sourcekit Service Crash
Secidentity + Force Cast Violation: Force Casts Should Be Avoided. (Force_Cast)
Swiftui Go Back Programmatically from Representable to View
Swift Loaditem Closure Not Running
Underlying Type for Tuple in Swift
Using Cfarraygetvalueatindex in Swift with Unsafepointer (Aupreset)
Have Label Appear with Delay in Swift
Why Are Implicitly Unwrapped Variables Now Printing Out as Some(...) in Swift 4.1
Weird Toolbar with Nested Conditionals Behavior
Sound for Scene Transition, That Doesn't Stutter
How to Horizontally Center Content of Horizontal Scrollview
Flattened Objects in JSON File to Nested Object Structure in Swift
Uitableview Didselectrow Returns Wrong Row Index Value
Update UIapplicationshortcutitem from Extension
How to Make a Function Operate on a Sequence of Optional Values