简体   繁体   中英

iOS - Links on UITextView don't work with UIScrollView

I have a UITextView on a UIScrollView. The text view contains a few links.The links don't work if the text view is originally outside screen and scrolled into view. If the textview is originally in the screen, the links work fine.

Anyone knows the solution for that?

I got the solution myself. It was the height of the content UIView on the UIScrollView that was making the problem. The content view's height was equal to the scrollview's height. But, the subviews' total height was a lot larger. Although everything seems displayed correctly, user interactions outside the content view's bounds was not passed to subviews properly.

So, I override viewWillLayoutSubviews and manually update the content view's height constraint. The links are working fine now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM