質問

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