FROM : I. Savant
DATE : Thu Jul 20 15:05:55 2006
There's also this: http://www.cocoadev.com/index.pl?
CenteringInsideNSScrollView
--
I.S.
On Jul 20, 2006, at 9:04 AM, David Hoerl wrote:
> [for the archives]
>
> The way to get Preview style "scrolling" of images, where images
> that are smaller than the visible rectangle get centered in the
> visible rect is as follows:
>
> - in your CustomeView drawRect method, look to see if the actual
> image rectangle is smaller than the visibleRect of the superview
> (which is of course the contentView).
>
> - if so, for that axis only, expand the frameRect of the
> CustomeView to fit size of that axis of the visibleRect. Save the
> old frameRect.
>
> - use either a NSAffineTransform, or change the origin of the
> boundRect, so that the undrawn space will be evenly split on either
> side of the image.
>
> - draw the image
>
> - restore the original frameRect.
>
> [Note - may be better ways to do this, but this way works.]
>
> David
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%
> 40gmail.com
>
> This email sent to <email_removed>
DATE : Thu Jul 20 15:05:55 2006
There's also this: http://www.cocoadev.com/index.pl?
CenteringInsideNSScrollView
--
I.S.
On Jul 20, 2006, at 9:04 AM, David Hoerl wrote:
> [for the archives]
>
> The way to get Preview style "scrolling" of images, where images
> that are smaller than the visible rectangle get centered in the
> visible rect is as follows:
>
> - in your CustomeView drawRect method, look to see if the actual
> image rectangle is smaller than the visibleRect of the superview
> (which is of course the contentView).
>
> - if so, for that axis only, expand the frameRect of the
> CustomeView to fit size of that axis of the visibleRect. Save the
> old frameRect.
>
> - use either a NSAffineTransform, or change the origin of the
> boundRect, so that the undrawn space will be evenly split on either
> side of the image.
>
> - draw the image
>
> - restore the original frameRect.
>
> [Note - may be better ways to do this, but this way works.]
>
> David
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%
> 40gmail.com
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| David Hoerl | Jul 20, 15:04 | |
| I. Savant | Jul 20, 15:05 |






Cocoa mail archive

