Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8474923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:45:22+00:00 2026-06-10T17:45:22+00:00

Given an NSView , how can I get its screen-rect and the display it’s

  • 0

Given an NSView, how can I get its screen-rect and the display it’s on, so I can use CGDisplayCreateImageForRect?

I found the NSWindow convertRectToScreen method, but it’s only available from 10.7 (I need 10.6 as well), and it still doesn’t give the display the NSView is on.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:45:24+00:00Added an answer on June 10, 2026 at 5:45 pm

    Assuming you don’t care about getting the actual pixel size of the view (because it’d differ between HDPI and regular displays — I can’t imagine it’d be a useful value right now), you basically just want to use a combination of NSView’s convertRect:toView: and NSWindow’s convertBaseToScreen:. So, for example, [someView.window convertBaseToScreen:[someView convertRect:someView.bounds toView:nil]]. This is assuming you aren’t transforming the view in any unusual-ish sort of ways (rotating it or something). Bear in mind that you should still add a check for whether the window responds to convertRectToScreen: and use that if it does — that way you avoid using the deprecated method (convertBaseToScreen:) where possible.

    Afterward, if you need the exact pixel size for the screen, you’d use NSScreen’s convertRectToBacking: (I’m not sure if you’ll need it for this). As for determining the screen, NSWindow has its screen method, which should be sufficient in most cases. The only issue I can see is when the view crosses screens, so you may have to check if it’s intersecting any other displays and merge images and so on. That said, I’m not sure if CGDisplayCreateImageForRect will account for this or not. You’ll have to test that yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this method to work on a HTML page in a webbrowser: bool semaphoreForDocCompletedEvent;
Given the jQuery dropdown plugin below. Is there a way to add a method
I need to use a custom NSView subclass to draw some content, but it
Given the following : // get the list of the players , in order
Given the following string: s = 'abcdefg*' How can I match it or any
Given a storyboard-based application, how can any one view controller invoke the methods of
Given a reference DateTime and given a DateTime to be verified, how can I
I am rotating an NSView using: setFrameRotation: Which rotates the view around its bottom
Given: Two vertically placed elements on the screen (ViewPager and Fragment) Action in the
Given the following code snippet from inside a method; NSBezierPath * tempPath = [NSBezierPath

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.