开发者

The best way to handle different orientations in an iPad

I was hoping that folks on the forum could help me with something I am struggling with. I am writing an iPad application that has slightly different layouts depending on the orientation of the device. The device is going to show a bunch of tiles on the layout (think of a checker board), each is going to have content related to the application. While in Portrait you will get more tiles with just a few bits of information. In landscape we want to reduce the number of tiles and show more information about each tile.

My question is what is the better way to achieve this from a layout perspective? I would prefer to stay in one xib, but I am having a had time getting the auto resizing to work correctly. I know I could load separate XIB files depending on orientation, and then again when the o开发者_开发技巧rientation changes, but that sounds clunky to me.

What are you doing to handle this type of thing?


You can implement two views in one xib and change which is visible in rotation, but this results in requiring twice as many IBOutlets one for each property for each view.

If it is difficult layout changes I would probably change the xib, but for simple stuff (where the autosizing resizing isn't working great) I often just set the frame to the new position in code. Keep in mind this create a nice chunk of code that is not ro pretty to look at. I will often mock the view up in IB still so I can get the frame positions to move to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜