0

I'm new to IOS development and I'm trying to make one of my parent view become automatically fit to its child views.

enter image description here

For example the picture above have a red circle which indicates a blank space I'm going to adjust the text upward so it fulfill the spaces and I also want that the container of all the text will automatically adjust its height to fit for its content.

Thanks.

NewDroidDev
  • 1,656
  • 5
  • 19
  • 33

2 Answers2

0

You need to override the willMoveToSuperView and didMoveToSuperView

Check the answer here iPhone/iOS: Will there be called any method if a UIView is added as a subview

You can then adjust the view according to its super view. However, using auto layouts is a much preferred way.

Community
  • 1
  • 1
zakishaheen
  • 5,551
  • 1
  • 22
  • 29
0

You Should do one thing.
First alloc your parent view and give it a frame then, when your child view will alloc and it has a frame then set your parent view's frame one's again.

So, when your child view will appear then your parent view's frame will automatically set.

Hope this helps...

Sam
  • 431
  • 7
  • 23