How can I set position of 3 UITable and 2 Navigation Bar?
My XIB has 3 UITable and 3 Navigation bar.UITables are dynamic scale and I use navigation bar to seperate UITable and show title of UITable name.
I want to set first navigation bar under the first table and second navigation bar under second table.
I try to find frame of first table to get position x,y and height of table but it don't work.
- (void)viewDidLoad
{
blah blah...
CGRect table1frame = table1.frame; //But it don't work
开发者_如何学JAVA}
I don't know where to get each table frame. please help me or guide me.Thank you very much
I'm not sure I understand what you're trying to do, but keep in mind that the geometry of the view controller's view (its bounds) is not yet set when viewDidLoad
is called. The bounds (and frames) of any subviews have not been set either. That means that all frames are pretty much set to zero at this point. And, that may be what you are noticing if you are trying to access the view's frame, or the frame of any of its subviews,
So, if you need to do anything based on the view's geometry (on its frame or the frame of any of its subviews), it is generally done in viewWillAppear
.
Your problem may not be where to get the table view's frame, but when to get it. You are looking for it in the right place (the table view's frame property), but you are too early. I hope this is helpful.
精彩评论