1

I am showing the terms and conditions in the UITextView. when users reached the last line of the text in the UITextView and then only enabling the button (which navigates to the next screen) available at the bottom of the screen.

I have implemented the required logic using text view delegate.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    
        float scrollViewHeight = scrollView.frame.size.height;
        float scrollContentSizeHeight = scrollView.contentSize.height;
        float scrollOffset = scrollView.contentOffset.y;

        if (scrollOffset + scrollViewHeight == scrollContentSizeHeight)
        {   // login to enable the button 
        }
    
}

This logic is working fine but in ipad Pro devices this is causing trouble. The ipad pro screen is large and all the text is visible without scroll.

How to find out text is visible in UITextView with out scroll. Also how to handle the problem in ipad Pro.

Rakesh
  • 29
  • 6

1 Answers1

1

Add the following if statement within viewDidLoad for example. (making the assumption your UITextView is called textView here)

 if (self.textView.contentSize.height <= self.textView.frame.size.height) {
     // Enable the continue button.
 }

As this will only be fall here if the content is likely to be fully visible. As not needed, scrollViewDidScroll: isn't called of course.

Hope this helps

Jim Tierney
  • 4,078
  • 3
  • 27
  • 48