简体   繁体   中英

Why do some of my static cells disappear from the simulator screen when I rotate the simulator to a landscape mode?

I'm running through Apple's "Start Developing iOS Apps Today" lessons using Xcode 5.1.1. I'm doing the tutorial on storyboards, which can be found here . I am currently in the section called "Display Static Content in a Table View." I have 13 cells set up in a table view controller and when I run the app in portrait mode I am able to scroll down and see them all, which is what I expect. However, when I go to Hardware and select Rotate Left or Rotate Right and switch to landscape mode, only the first 7 cells appear, and there is no way to scroll down to see the rest. Does anyone know how to keep all of the cells after rotating to landscape? As far as I can tell I have followed all of their instructions. The whole recursiveDescription can be found here .

This is probably a problem with the auto layout constraints (or lack thereof, if you're using auto layout) or the resizing masks if you're not using auto layout.

You can confirm this diagnosis if you run the app through Xcode, rotate the screen, and then hit the "pause" button. Then, at the (lldb) prompt, type:

po [[UIWindow keyWindow] recursiveDescription]

You'll see a lengthy hierarchy of all of the views, and look at the frame of the table view and see if it makes sense for the current orientation.

Perhaps you can update your question with that output if you have a hard time interpreting the results.

For information on how to use auto layout, see the Auto Layout Guide .

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