• 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
clipping and scrolling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

clipping and scrolling


  • Subject: clipping and scrolling
  • From: Torsten Curdt <email@hidden>
  • Date: Fri, 12 Aug 2011 13:27:28 +0200

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 (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: clipping and scrolling
      • From: David Duncan <email@hidden>
    • Re: clipping and scrolling
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: core data, boolean attribute, and dynamic
  • Next by Date: Underlining text
  • Previous by thread: Re: core data, boolean attribute, and dynamic
  • Next by thread: Re: clipping and scrolling
  • Index(es):
    • Date
    • Thread