• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSScrollView keeping to top left [SOLUTION]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSScrollView keeping to top left [SOLUTION]


  • Subject: NSScrollView keeping to top left [SOLUTION]
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Fri, 22 Oct 2004 16:26:54 +0200

I've heard this problem a couple of times on this list, so I thought, now that I've found the ridiculously easy solution thanks to the archived WODeveloper list, I'd share it with you:

PROBLEM:
If the document view of an NSScrollView (i.e. the "view being scrolled" that contains all your little subviews) is smaller than the scroll view, it is always in the lower left of the scrollable area. What most people really want is their view in the upper left.

SOLUTION:
Override the -(BOOL)isFlipped; method of your content view and have it return TRUE.

Of course, this won't work if your document view is an NSImageView or similar, because that will actually turn the image upside down. What I did was create my own NSView subclass called UKScrollDocumentView that returns YES for isFlipped, and embedded my views in that.

I vaguely recall that isFlipped as a solution came up previously, but I think the problem was that the poster was using an NSImageView.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
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
  • Prev by Date: Re: Copy and release
  • Next by Date: Re: Tall NSTableView Column Headers
  • Previous by thread: Re: Menu in iTunes
  • Next by thread: [NEWBIE]: Writing a circular text editor question.
  • Index(es):
    • Date
    • Thread