Problem with UIScrollView

Posted by leon on Stack Overflow See other posts from Stack Overflow or by leon
Published on 2010-04-18T06:10:52Z Indexed on 2010/04/18 6:13 UTC
Read the original article Hit count: 470

Filed under:
|

Hi,

Sorry for long winded post.

I am trying to understand UIScrollView and running into very simple problem.

  1. I am creating a scroll view
  2. I am making this view 1.5 size larger then normal size
  3. Using UIScrollView I expect to see some edge elements of view out of bounds, but should be able to pan the view therefore bringing missing elements back to the visible area.

However I am seeing that I can't just pan/scroll view anyway I want, instead view always wants to scroll up, as soon as move away my finger from the screen (touch end event).

I am not handling any touches, etc - I just want to understand why does not scaled view stay put where I scroll it?

CGRect viewFrame = self.view.frame ;
    viewFrame.size.width *= 1.5;
    viewFrame.size.height *= 1.5;
    CGSize mySize = viewFrame.size;

    [ ((UIScrollView *) self.view) setContentSize: mySize];

    self.view.transform =   CGAffineTransformMakeScale(1.5, 1.5);

What I really trying to accomplish is something similar to Number on iPad (the same code will work on iPhone):

  • There is a view with lots of controls on it (order entry form)
  • User can zoom into the entire form so all elements look bigger
  • user can pan the form therefore bringing various elements into the visible area of the screen.

It seems that UIScrollView can should be able to handle zoom and pan actions (for now I am using Affine Transform to zoom in to the order entry form and iPad)

Thanks

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about uiscrollview