0

I have a loadView call that basically places one view at the top (like a header) and one at the bottom (like a footer). It's possible via a passed in parameter to not have a header or a footer, to hide them later, or to resize the view. I have all this working, but it's very susceptible to breaking because the views can go in various places of various sizes and all must be manually set to the correct size or they will not use up all the space. I want one in between the two of them that automatically resizes to fill whatever space is not taken by the others.

loadView doesn't seem to be able to obtain the size of its parent's frame (or where it's being fit in, exactly), nor do I see an obvious way to just put the center view at a certain position and have its width and height automatically adapted.

Any ideas?

If I'm not explaining myself well enough and you know Java Swing, think BorderLayout with a BorderLayout.NORTH, BorderLayout.SOUTH, and BorderLayout.CENTER component.

4

1 回答 1

0

loadView 不是一个好地方。您真的想改用 viewWillAppear 。将 autoresizeMask 设置为具有固定边框应该可以满足您的需求,而不必担心计算布局,最好在 IB 中全部完成,而不是一直手动布局。

于 2010-04-13T18:08:20.153 回答