Re: NSScrollView and Custom Views
Re: NSScrollView and Custom Views
- Subject: Re: NSScrollView and Custom Views
- From: Joshua Scott Emmons <email@hidden>
- Date: Mon, 27 Jun 2005 09:34:40 -0400
Anyone have any ideas? Am I way off course?
Can't say if you're off course or not, but I've never been able to
get my custom view out of the lower-left corner (or upper-left if
I've overridden -isFlipped to return YES) when working with a scroll
view.
But, truth be told, you really don't need it to be moved anywhere
else. You should be thinking of that view as the piece of paper that
you will draw all of your other stuff on. The only thing it needs to
worry about is resizing itself so that whatever it contains is
displayed. When you think of it that way, it doesn't make much sense
to have this:
+---------------+
| |
| +------+ |
| | text | |
| +------+ |
| |
+---------------+
Because if the view gets too big, it'll look like this:
+---------------+ ^
| | *
| +-----------| |
| | text is cu| |
| | off at odd| |
| | because | |
+---------------+ v
<=-------------->
The user will scroll so that the document fits:
+--------------+ ^
|+------------+| |
|| text is cut|| *
|| off at odd || |
|| because of || |
|+------------+| |
+--------------+ v
<---=----------->
So now everything looks as it should, but the scroll bars are still
there, and their thumbs are at wonky positions because of that big
margin you have in the upper left.
A better solution is to size your custom view (the paper) to be the
same size as the scroll view that contains it, and then center the
thing you want to display in the custom view. Then you can resize
your custom view as its contents grows and the scroll view will Do
The Right Thing.
Cheers,
-Joshua Emmons
_______________________________________________
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