On Sep 20, 2008, at 11:26, Peter Alshuth wrote:

I have a window with a scroll view that displays an image. I would like to have a centered symbol (another image) on top of this view independently of the slider positions and movements. Do I have to create another window with a transparent background and sync it with the movements of the other window
in order to create a new layer?

There are easier ways than that, although it's going to depend a little bit the behavior you want when you (say) click on either of the images.

The easiest way is probably to make the scroll view's document view a custom view, and in the custom view's drawRect: method, draw the scrollable image first (positioned relative to the custom view bounds), then draw the symbol image on top (centered on the custom view's visibleRect).

Or subclass the view that's displaying the image, and in a drawRect: override call [super drawRect:] then draw the symbol image centered on the visibleRect.

Or use a custom view with two image subviews, and reposition the symbol image subview whenever the custom view scrolls. (You can monitor the clip view's bounds changes to detect when scrolling happens.)

When doing this kind of thing, make sure you turn off the "copy on scroll" checkbox for the scroll view.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to