简体   繁体   中英

UITextView doesn't keep subviews visible

I'm implementing the a viewController to enter text and images (very similar to Facebook's "Status" entry) and I have most of it complete, however, the last piece isn't working correctly.

The user can select an image and key-in textual data. As more text are added, the images get pushed down. I implemented this by adding UIImageView as subview of UIView , then add UIView as subview of UITextView . They stack up like this:

  • Top: UIImageView
  • Middle: UIView
  • Bottom: UITextView

When I key-in long enough text that it pushes the images down, the images do not stay visible inside the UITextView . I can still see the images if I drag the screen-up, but as soon as I let go, the images bounces down and can't be seen. How do I fix this? Thanks.

UITextView不会保持子视图可见

You do the followings for this.

1- Have a UIimageView and set your image
2- Draw your UITextview on exact location of image. Means (x,y,w,h) equals
3-Set UItextView background color CLEAR.

and CHEERS

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