简体   繁体   中英

Swift: UIScrollView/UITextView jumps up when entering text

I'm using a UITextView inside a UIView that's inside a UIScrollView. Whenever I launch the app for the first time and attempt to type something into the UITextView, the view jumps up. Also, when the view is first visible, the textview is not completely visible.

I've attempted to pin the UIView to the top layout guide. It stops that issue from occurring, however when a large body of text is entered in the UITextView, I'm unable to scroll down to view the song thumbnail.

What could be done to fix this?

在此处输入图片说明

This wasn't necessarily the fix I wanted, but I realised UIScrollView is sometimes a little tricky to overcome.

I removed the UIView that held the UITextView and the album image and placed them directly into the UIScrollView. Then clipped the bottom of the UIScrollView to the bottom layout guide.

This stopped the jitter issue when typing but it's still not perfect.

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