UIScrollView won't stay in place after user finishes scrolling?

Okay, the easiest way to get this scrollview working as you desire is to ensure that content size of the scrollview is identical to the frame size of the content you wish to scroll.

Up vote 1 down vote favorite 1 share g+ share fb share tw.

Within my UIView, I have a UIScrollView which fills the first view, so than when the content is bigger than the iPhone screen size, the user can scroll the page down. It works well, but when the user finishes the scroll movement - i.e. Removes his fingers, the page snaps back into it's original position.

Obviously that is not what I want, how can it be avoided? Here is the relevant code in the UIView class which declares and uses the UIScrollView class. @implementation TestView - (id)initWithFrame:(CGRect)frame { self = super initWithFrame:frame; if (self) { // Initialization code.

} CGRect scrollViewFrame = CGRectMake(0, 0, 320, 460); UIScrollView *scrollView = UIScrollView alloc initWithFrame:scrollViewFrame; scrollView. CanCancelContentTouches=NO; self addSubview:scrollView; CGSize scrollViewContentSize = CGSizeMake(320, 500); scrollView setContentSize:scrollViewContentSize; CGRect rectForBigRedSquare = CGRectMake(50, 50, 200, 200); UILabel *redSquare = UILabel alloc initWithFrame:rectForBigRedSquare; redSquare setBackgroundColor:UIColor redColor; scrollView addSubview:redSquare; return self; } An additional question is this: how is it possible to make it such that the user can only scroll down, that is to see content at the bottom which was out of view, but not to scroll up so that there is space before the start of the content. In ios link|improve this question edited Nov 18 '11 at 9:13jbat1006,3971317 asked Nov 18 '11 at 9:11user1052610142 0% accept rate.

I've had this problem also, haven't found a satisfactory answer. Think its more a bug than anything else. – jbat100 Nov 18 '11 at 9:15 I could answer your additional question, but you should ask it as a separate question.

Asking it like this does not help any future visitors with that problem. – Aberrant Nov 18 '11 at 9:28 1 One more thing, you should place your initialization code where it says "//initialization code. ".

;) – Aberrant Nov 18 '11 at 9:42.

Okay, the easiest way to get this scrollview working as you desire is to ensure that content size of the scrollview is identical to the frame size of the content you wish to scroll. You can achieve this by having a content view into which you add all the views you wish to be visible and then add that content view to the scrollview while ensuring that the content size of the scrollview is set to the content view's frame size. UIScrollView *scrollView = UIScrollView alloc initWithFrame:CGRectMake(0, 0, 320, 460); UIView* contentView = UIView alloc initWithFrame:CGRectMake(0, 0, 1280, 460); UIView* redView = UIView alloc initWithFrame:CGRectMake(0, 0, 320, 460); redView setBackgroundColor:UIColor redColor; contentView addSubview:redView; redView release; UIView* blueView = UIView alloc initWithFrame:CGRectMake(960, 0, 320, 460); redView setBackgroundColor:UIColor blueColor; contentView addSubview:blueView; blueView release; CGSize contentViewSize = contentView.frame.

Size; scrollView addSubview:contentView; scrollView setContentSize:contentViewSize; contentView release; self addSubview:scrollView.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions