[英]UIViews moving after segue and return
我有一個應用程序,在其中創建兩個彼此疊放的視圖:
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];
UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, self.view.frame.size.height -200)];
[self.view addSubview:headerView];
[self.view addSubview:bottomView];
[headerView setBackgroundColor:[UIColor lightGrayColor]];
[bottomView setBackgroundColor:[UIColor redColor]];
我還使用了一個側面菜單,該菜單使用:
[self.sideMenuViewController setContentViewController:[[UINavigationController alloc] initWithRootViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"welcomeScreen"]]
animated:YES];
[self.sideMenuViewController hideMenuViewController];
初始加載很好,並且頂視圖和底視圖都按預期顯示,但是,當我使用側面菜單導航離開,然后使用側面菜單導航回到首頁時,兩個視圖似乎都向上移動了頁面(在導航欄后面)。
我已經嘗試了從編程約束到檢查導航欄是否存在以及將代碼從viewDidLoad移到viewDidAppear的所有方法,但是我總是得到相同的結果。 關於正在發生什么以及為什么的任何想法? 並且任何有關修復的建議將不勝感激。 謝謝
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
已解決問題!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.