Hey folks,

On the Mac we have NSClipView (and NSScrollView). On iOS we have
UIScrollView and yet sometimes I wondering why.

Let me explain: For an iOS project I have an image that does not fit
on the screen. I need to be able to show a portion of it to the user.
There are couple of ways to approach this.

1) I could just create an UIImageView and just move the origin into
the negative. The clipping happens naturally through the parent view.
2) I could use a UIScrollView and add the large UIImageView to it and
move the content offset
3) I could have a custom view that basically just draws a portion of
the image. Something along the lines of

  CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage
CGImage], cropRect);
  [UIImageView setImage:[UIImage imageWithCGImage:imageRef]];
  CGImageRelease(imageRef);

Now I am trying to understand the details of the different approaches.

When I change the origin of view I assume the system is smart enough
to copy content over. So what could be a reason to use UIScrollView
(or NSClipView on Mac) for this? I assume 3) should be the worst
option as it redraws the complete content. But maybe I am also just
completely off.

Which option would you pick and why?
Some insights would be appreciated.
What docs should I read that I haven't?

cheers,
Torsten
_______________________________________________

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 arch...@mail-archive.com

Reply via email to