Deepu
Deepu

Reputation: 2616

How to add AutoScroll to Scrollview in iOS?

I am having Scollview in iOS. In that scrollview I have two Table Views.

If the contents of Table view get increased dynamically (by row), then I want to add the AutoScroll to the Scrollview.

Anybody has any idea about this?

Thanks in advance.

Upvotes: 2

Views: 2551

Answers (2)

Arun
Arun

Reputation: 3404

i code like this in the text field....

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    if(textField == expenseAmount)
    {

        [self.expenseScrollview setContentOffset:CGPointMake(0.0,50) animated:YES];
       // [self registerForKeyboardNotifications];
    }
    if(textField == exchangeRate){

        [self.expenseScrollview setContentOffset:CGPointMake(0.0,120) animated:YES];

    }


    return YES;
}

by following this idea you implement that in table view increment [at the point u need to set ]

and the thing u need to increase the scroll size means u need to use this....

scrollView.contentSize = CGSizeMake(yourWidth,yourHeight);

Upvotes: 1

Romit M.
Romit M.

Reputation: 898

you this following line to make one time autoscroll.

set x if you want to scroll horizontally, otherwise set y to scroll vertical.

[scrollView setContentOffset:CGPointMake(x, y) animated:YES];

Upvotes: 2

Related Questions