简体   繁体   中英

UITableView not showing all cells

I'm trying to use a UITableView, but as you can see in the image below, when the view is loaded, part of it is cut of by the UINavigationBar. When I follow one of the selections through to another view, and go back to the view picture below, it fixes itself. Has anyone ever encountered this before?

在此处输入图片说明

I assume your app is running under iOS 7. Since iOS 7 the content of your view controller scrolls under the top bars, here the UINavigationBar and the status bar. But in your case your bars are fully opaque. So to prevent that behaviour you can set

self.edgesForExtendedLayout = UIRectEdgeNone;

in your view controller.

EDIT: I've set up a sample project in Xcode 6 - Beta 6 and configured your setup in IB and didn't make any adjustments in the controller code and it's working from scratch: 界面生成器iOS 8模拟器

Are you able to post same relevant code from your project? What happens in viewDidAppear/viewDidDisappear if the problem fixes itself when you're leaving the current view?

In storyborad attribute inspector set scroll indicator : shows Horizontal indicator to NO

在此处输入图片说明

您使用的导航栏是半透明的,您可以使用以下代码禁用半透明。

self.navigationController.navigationBar.translucent = NO;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM