1

I want to create this layout in which the image is at the top and scrolls along with textview, textview itself should not be scrollable but should expand with the text so that ImageView and textView are together in a single scrollView. I'm not able to figure out the constraints and how to expand that text view.

enter image description here

The image shows the textview ending at the bottom of the screen because I have set it's scrollable property to off, I want the text to run down the screen ,textView to expand .I am ready to use stackViews as well if needed. Thank you

Dinsen
  • 2,139
  • 3
  • 19
  • 25
ssDON_JOE
  • 33
  • 6

1 Answers1

0

You can achieve that by following these steps:

  1. Create a tableView.
  2. Add imageView as your tableView's tableHeaderView. (Use This Link) for more details).
  3. Add only one row to tableView.
  4. Add your textView to your row and add constraints as zero to contentView.
  5. Set UITableViewAutomaticDimension as heightForRowAtIndexPath.

Also you don't need to use scrollView as tableView will do that for you.

Himanth
  • 2,381
  • 3
  • 28
  • 41