iOS 7:UITableView顯示在狀態(tài)欄下我的應(yīng)用程序的第一個(gè)屏幕是UITableViewController沒有導(dǎo)航欄,這意味著內(nèi)容在狀態(tài)欄下流動(dòng),因此存在大量文本沖突。我已經(jīng)調(diào)整了兩個(gè)屬性Under top bars,Adjust scroll view insets哪些實(shí)際上阻止了它滾動(dòng),但代價(jià)是保持表視圖的頂部。我試圖將UITableView幀設(shè)置為偏移20像素,但它似乎沒有生效,因?yàn)槲夷壳靶枰搼?yīng)用程序與iOS 6兼容我無法跳轉(zhuǎn)到iOS 7 Storyboards強(qiáng)制自動(dòng)布局使用頂部高度指南。有沒有人找到適用于這兩個(gè)版本的解決方案?事情我已經(jīng)嘗試:設(shè)置edgesForExtendedLayout,故事情節(jié)中更改設(shè)置Under top bars和Adjust scroll view,迫使幀到一個(gè)新的領(lǐng)域。
3 回答

GCT1015
TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超4個(gè)贊
請(qǐng)注意:這適用于我的以下配置:
屏幕頂部沒有導(dǎo)航欄(表格視圖與狀態(tài)欄相符)
表視圖是不可滾動(dòng)的
如果不滿足上述兩個(gè)要求,您的milage可能會(huì)有所不同。
原帖
我以編程方式創(chuàng)建了我的視圖,最終為我工作:
- (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 關(guān)注
- 950 瀏覽
添加回答
舉報(bào)
0/150
提交
取消