开发者

UITableView in UITabBarController gets 10 px shift down on rotation

开发者 https://www.devze.com 2023-02-13 09:03 出处:网络
I have a UITableView inside UITabBarController, when the starting orientation for the TableView is Landsc开发者_开发问答ape there is no problem, but when the Starting Orientation is Portrait it get sh

I have a UITableView inside UITabBarController, when the starting orientation for the TableView is Landsc开发者_开发问答ape there is no problem, but when the Starting Orientation is Portrait it get shifted down by 10 px after rotating, please see Images,

Before Rotating:

UITableView in UITabBarController gets 10 px shift down on rotation

After Rotating:

UITableView in UITabBarController gets 10 px shift down on rotation

The gray 10 pixel rect is shown between the Status and the UINavigationController.

Any help would be so much appreciated. Thanks all.


Open the XIB in interface builder, click on the tableview, open the inspector, choose the View Size tab (third from the left). Under Autoresizing (not size and position) you will see a white rectangle, with a black rectangle inside, and bunch of arrows and lines that will effect that way the view reacts to resizing of the superview (correct me if i'm wrong). Basically, play around with those :) I might be wrong but i think that in your case, you should select both autoresizing arrows (the 2 inside the small black rectangle) and the lines to the top and to the left of it (outside of the black rectangle).


I have found the solution, but it seems has nothing to do with what i was facing but i tried everything and this finally did the job.

Here what i used to do to:

Before

I used to load My UITabController through an IBOutlet connected from on XIB and load it as follow:

[window addSubview:self.oTabNavigationViewController.view];

Now

I Removed my UITabViewController from the XIB and load it from the application delegate as follows:

self.oTabNavigationViewController = [[TabNavigationViewController alloc] initWithNibName:@"TabNavigationViewController_ipad" bundle:nil];

[self.oTabNavigationViewController.view setFrame:[[UIScreen mainScreen ]applicationFrame]];
[window addSubview:self.oTabNavigationViewController.view];

Thanks all for the effort.

0

精彩评论

暂无评论...
验证码 换一张
取 消