Search code examples
iphoneuiscrollviewsubviewsgaps-in-visuals

Gap between subviews of UIScrollView


I have two subviews of UIScrollView. One is textView and other is tableView. I made textview's height flexible based on its content, but I have one problem. If the text in the textview (which is parsed data) is small, there is a big gap between textview and tableview. Or if the text is too large then it covers the tableview. How can I keep the same gap between textview and tableview irrespective of the amount of content of text view? This is all done in IB. Thanks.


Solution

  • you must handle both textview and tableview position dynamically like ur text view height and y-axis is y-axis 10; height 40; now in tableview setframe:cgrectmake(your X coordinate, textview.frame.size.height+20)

    so its always show same difference between textview and tableview if your textview height is 60 than tableview y point is 60+20