iOS 7:UITableView顯示在狀態欄下我的應用程序的第一個屏幕是UITableViewController沒有導航欄,這意味著內容在狀態欄下流動,因此存在大量文本沖突。我已經調整了兩個屬性Under top bars,Adjust scroll view insets哪些實際上阻止了它滾動,但代價是保持表視圖的頂部。我試圖將UITableView幀設置為偏移20像素,但它似乎沒有生效,因為我目前需要該應用程序與iOS 6兼容我無法跳轉到iOS 7 Storyboards強制自動布局使用頂部高度指南。有沒有人找到適用于這兩個版本的解決方案?事情我已經嘗試:設置edgesForExtendedLayout,故事情節中更改設置Under top bars和Adjust scroll view,迫使幀到一個新的領域。
3 回答

GCT1015
TA貢獻1827條經驗 獲得超4個贊
請注意:這適用于我的以下配置:
屏幕頂部沒有導航欄(表格視圖與狀態欄相符)
表視圖是不可滾動的
如果不滿足上述兩個要求,您的milage可能會有所不同。
原帖
我以編程方式創建了我的視圖,最終為我工作:
- (void) viewDidLayoutSubviews { // only works for iOS 7+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { CGRect viewBounds = self.view.bounds; CGFloat topBarOffset = self.topLayoutGuide.length; // snaps the view under the status bar (iOS 6 style) viewBounds.origin.y = topBarOffset * -1; // shrink the bounds of your view to compensate for the offset viewBounds.size.height = viewBounds.size.height + (topBarOffset * -1); self.view.bounds = viewBounds; }}
來源(在第39頁底部的topLayoutGuide部分)。
- 3 回答
- 0 關注
- 943 瀏覽
添加回答
舉報
0/150
提交
取消