문제

I have one parentview as Scrollview.I have added two subviews view1,view2 on that scrollview. But I need to do the following in same time

  1. when I increase the height of one of my subviews view1 in runtime,parentview height should be changed using either Autolayout or Autoresizing

  2. when I increase the height of one of my subviews view2 in runtime,parentview height should not be changed either Autolayout or Autoresizing

  3. When I change the height of parent view in time, it should not affect its subviews.

Any help please?

도움이 되었습니까?

해결책

In Autolayout:

  • Establish a minimum distance between view1 and top border of superview.
  • Establish fixed (minimum) distance between view1 and bottom border of superview.
  • Leave out these minimum distances for view2.

다른 팁

There is no need to use -layoutSubviews. When increasing subview view1's height, you can update scroll view's content size. When increasing subview view2's height or scroll view's height, does nothing else.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top