Re: How can i determine the mac pixel ratio?
Re: How can i determine the mac pixel ratio?
- Subject: Re: How can i determine the mac pixel ratio?
- From: Uli Kusterer <email@hidden>
- Date: Mon, 21 Nov 2005 14:47:48 +0100
Am 21.11.2005 um 09:27 schrieb Rolando Sacramento:
Im totally new in mac development, and i got this prob, i hope
someone could help me. My application computes for the location to
where he will be starting (by NSRect). i forgot to consider that
there are different pixel rating on some machine, mine is 1024 x
780 ( i think). How can I get the pixel setting of a machine? is
there any class for this?
The pixel ratio is always 1x1 on a Mac. Apple hasn't shipped
computers with non-square pixels since the Apple ][ days.
If you meant the screen size: Getting the screen size doesn't really
make much sense, as there may be several screens, set to different
sizes. E.g. I have one typically set to 800x600 and another one set
to 1280x1024. If you size your window so it covers both, part of the
window will be offscreen on the smaller screen. So, you'll either
want to et the user pick one screen (don't just pick the main screen
-- I, for instance, like to watch movies on the 800x600 screen where
they are larger. Then I work on the bigger one, which obviously is
the main screen), or you'll want to cover all screens but make sure
nothing important ends up offscreen.
If you mean you're trying to draw something, you don't want the
screen size, you want the size of whatever view is doing the drawing.
Typically you do this using [self bounds] in your -drawRect: method
(also check out [self frame]).
If you're trying to position your window, check out NSWindow's
methods, in particular -cascadeTopLeftFromPoint: and -center and
similar ones, depending on what you need. If you're using an
NSWindowController (you get that for example when you start from the
Cocoa-document-based application template), the window controller
will call that for you.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden