• 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
Re: NSImageView and ZoomFactors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImageView and ZoomFactors


  • Subject: Re: NSImageView and ZoomFactors
  • From: Quincey Morris <email@hidden>
  • Date: Fri, 20 Aug 2010 10:35:44 -0700

On Aug 20, 2010, at 06:46, Brian Postow wrote:

> If I don't want to be using NSImageView, what DO I want to be using? I started out trying to use IKImageView, but that is  swatting a fly with a bazooka. It takes like 2 seconds to draw the image because its doing lots of thumbnailing and stuff that I don't need... is there another kind of imageview I should use?

Given a scroll view architecture, your document view can be a single view, or the parent of an entire sub-hierarchy of views (Kyle's suggestion).

If you're going to use a sub-hierarchy, then using a NSImageView within it is fine and probably convenient. (It doesn't do anything that you can't do yourself in a couple of lines of code, but a saving is a saving.)

If you're going to use a single view, then you'd use a custom NSView, and draw all of the pieces in the right order within its 'drawRect:'. The part of the view that's occupied by the image would be drawn with [NSImage drawInRect...], for example. You *could* make your custom view a subclass of NSImageView, but in this case there's no point that I can see.

Unlike IKImageView, NSImageView doesn't encapsulate a lot of behavior. (Offhand, all I can think of is: scaling, optionally drawing a border, and drawing a background when there's no image.) It's *mostly* a convenience for adding images to XIBs in IB without having to write any code, but with your scaling requirements you're already committed to writing UI glue code. So I'm suggesting you shouldn't feel obliged to use NSImageView at all, unless it genuinely saves you some effort.

> Ok,. Since the NSImageView wants to always center the image in the bounds rect, that should make the translation (moving the origin) not too hard, yes?

Yes, though I'd say it differently. What's important is the size of the document view, and where its frame is positioned within the bounds rect of the content (clip) view. That's because zooming has an impact on the limits and scroll position of the scroll bars.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSImageView and ZoomFactors
      • From: Brian Postow <email@hidden>
References: 
 >NSImageView and ZoomFactors (From: Brian Postow <email@hidden>)
 >Re: NSImageView and ZoomFactors (From: Quincey Morris <email@hidden>)
 >Re: NSImageView and ZoomFactors (From: Brian Postow <email@hidden>)
 >Re: NSImageView and ZoomFactors (From: Quincey Morris <email@hidden>)
 >Re: NSImageView and ZoomFactors (From: Quincey Morris <email@hidden>)
 >Re: NSImageView and ZoomFactors (From: Brian Postow <email@hidden>)
 >Re: NSImageView and ZoomFactors (From: Quincey Morris <email@hidden>)
 >Re: NSImageView and ZoomFactors (From: Brian Postow <email@hidden>)

  • Prev by Date: Re: Statically link libmysqlclient.a to my Foundation tool
  • Next by Date: Embedding a system preference pane
  • Previous by thread: Re: NSImageView and ZoomFactors
  • Next by thread: Re: NSImageView and ZoomFactors
  • Index(es):
    • Date
    • Thread