I have two UITableView
's instances. When I add them as subviews to the root view of the UIViewController
, which is in a UINavigationController
, I got one of them was automatically added contentOffset
with y
is -64, because of the new property automaticallyAdjustsScrollViewInsets
, but another one is 0. Only the first one will be adjusted.
I have do some research from Apple's Documents and the Internet. Still cannot find any clue.
Here is the code I adding the table views.
- (void)viewDidLoad
{
[super viewDidLoad];
// the table views are init in their getter methods
// both frames are equal to root view of this view controller
[self.view addSubview:self.firstTableView];
[self.view addSubview:self.secondTableView]; // this one will not have contentOffset
}
After the addSubview
, 'cause I want both of them have contentOffset
. But even I have try to set contentOffset
to secondTableView
manually, somehow it was change back to 0 after the view controller was shown, the break point is in viewDidAppear:
, on the screen.
Miscs: Xcode 5.0.2, iOS 7 SDK, ARC, neither Storyboards nor xibs.
I will be grateful if any one could help me with this.