harshiYL
harshiYL

Reputation: 251

Scrollview doesn't display top part of its content without scrolling it down in iphone application

I have view which contains a scrollView.The scrollview contains buttons,labels and several textfields.To view the top content of the scrollview, I have to scroll it down.Otherwise it shows only the bottom part.How can I show the the top elements of my scrollview without scrolling it down?It is ok to scroll it up to view bottom contents of the scrollview.

Upvotes: 0

Views: 1839

Answers (3)

Owen Godfrey
Owen Godfrey

Reputation: 3373

I had a similar problem. I had to pull down the scroll view to view the content at the top, but when released it would "bounce" back up?

The problem for me turned out to be auto-layout. The view I had place within the scroll view was being centred. As a result, with all the changes that occurred during layout, I think the view got pushed up into negative space.

For me, the solution was to change the layout so that the view was anchored to the top of the scroll view instead of the middle.

Upvotes: 1

rehan
rehan

Reputation: 141

@harshiYL it would be better if u post some code in order to detect errors.What i suspect is ur scroll views frame and content size.Use the code below:-

- (void)viewDidLoad
 {
 [super viewDidLoad];
 scrollView.frame = CGRectMake(0, 0, 320, 460);
 [scrollView setContentSize:CGSizeMake(320, 678)];
 }

Hope it helps.

Upvotes: 2

rockstarberlin
rockstarberlin

Reputation: 1853

By default the scrollView shows always the top. Means ContentOffset is 0. Does the orientation change in any time after launching the app, and showing the scrollView? perhaps you can check your Autosizing settings in the Size Insprector.

Hope that helps!

Upvotes: 0

Related Questions