Sukhpreet
Sukhpreet

Reputation: 933

UIScrollView automatically scrolls to top on touch action

I'm using UIScrollView inside UIViewController using AutoLayout. I am setting content view height for UIScrollView like this

 if(IS_IPHONE_6) {
        self.contentViewHeight.constant = 750;
    }
    if(IS_IPHONE_5) {
        self.contentViewHeight.constant = 700;
    }

Everything works fine. It is scrolling correctly but when I scroll to bottom and then touch inside content view or I touch any subview of content view, It automatically scrolls up. It is happening in iPhone 6 & 6P. It is working fine in iPhone 5. I went through many StackOverflow posts but couldn't get desired result. I tried to set

_scrollView.scrollsToTop = NO;

But It is not working. Please help me to stop automatic scrolling. I'm setting following constraints to UIScrollview.

enter image description here

Upvotes: 1

Views: 1378

Answers (1)

Sukhpreet
Sukhpreet

Reputation: 933

Finally I managed to stop automatic scrolling to top on touch up inside action. I disabled paging in storyboard and It worked for me. I've no idea why paging turn on automatic scrolling to top.

enter image description here

Upvotes: 2

Related Questions