Abhinav
Abhinav

Reputation: 38162

Restricting a UISCrollView to scroll up

I have a custom view covering entire screen in iPod touch. I need to put add another view in this which will initially be hidden but will come on screen when view is scrolled down. I hav achieved this but not I can scroll my view to upside also. I so not want user to pull up the custom view. I just want a pull down feature and no pull up.

When someone pull down I am bringing the view to original position programatically. So, when user pull down they can see some information for 5 secs and then view is back to original position.

Hoe can I restrict my UIScrollView from being scrolled towards up on manual interaction?

Upvotes: 2

Views: 1188

Answers (1)

Abhinav
Abhinav

Reputation: 38162

I did this by following code. Its working now.

(void)scrollViewDidScroll:(UIScrollView *)iScrollView {
     // Refrain the view from scrolling up
     if (iScrollView.contentOffset.y > 0.0) {
           iScrollView.contentOffset = CGPointZero;
     }
}

Upvotes: 2

Related Questions