我有一个标签栏控制器应用程序,它有19个视图,因此需要按下“更多”按钮才能切换到其中一些。
问题在于当我切换到某个视图时,该视图内部包含一个Scroll View,并且当视图出现时,它位于索引No 5(因此只能通过单击MORE按钮选择),它会向下移动我相信大约20像素!有趣的是,如果我编辑标签顺序并将有问题的视图移动到位置4(因此现在可以选择而不点击“更多”按钮),那么当视图出现时它不再向下移动!
对于其中不包含Scroll View的其他视图,不会发生此向下移位。所有视图的界面构建设置都相同。
我一直试图找到一个解决方案现在好几天,这让我绝对疯了!还有什么我应该做的吗?
很多很多人!
答案 0 :(得分:0)
问题解决了! :-)
//***********************************************************************************
//There is a bug from Apple
//To avoid the view shifting down when changing the order of the tab views
//You must first create a new view and then assign the scroll view to this new view!
UIView *vi = [[UIView alloc] initWithFrame:CGRectMake(-10, -10, 1, 1)];
[vi setBackgroundColor:[UIColor clearColor]];
[self.view addSubview:vi];
//***********************************************************************************
//Now add the scroll view to the new view
[self.view addSubview:DesiredScrollerView];
[见这里] [1]