自定义横向/纵向视图

发布于 2024-11-10 19:23:51 字数 198 浏览 1 评论 0原文

我想让我的按钮以特定的方式排列为我的纵向视图和不同的方式为我的横向视图。我还希望能够将现在可能位于纵向视图中的内容添加到横向视图中。我知道这是可能的原因显然是每部 iPhone 都附带的计算器应用程序。当你将其横向倾斜时,它会给你一套全新的按钮。有谁知道如何创建在 iphone 正面朝上时加载的自定义纵向视图,以及如何在 iphone 侧面朝上时创建具有不同按钮的自定义横向视图?

I would like to have my buttons arranged a specific way for my portrait view and and different way for my landscape view. I would also like to be able to add things to my landscape view that might now have been in my portrait view. The reasons i know this is possible is obviously, the calculator app that comes with every iphone. When you tilt it sideways into landscape it gives you a whole new set of buttons. Does anyone know how to create a custom portrait view that is loaded when the iphone is right side up and how to create a custom landscape view when the iphone is on its side with different buttons?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叹倦 2024-11-17 19:23:51

您可以尝试为每个方向使用两个单独的笔尖文件。您可以在此基础上自定义笔尖。

You can try having two separate nib files for each orientation. You can customize the nib based on that.

荒人说梦 2024-11-17 19:23:51
  1. 创建两个不同的视图控制器(即 NIB 文件或故事板中的项目)。调用类 MyViewControllerLandscape 和 MyViewControllerPortrait。

  2. 以编程方式创建第三个视图控制器类。将其命名为 MyViewController,并使其成为横向和纵向控制器的父类。

    这样您就可以将两个控制器的所有通用代码放入父类中,而仅将方向特定的代码放入另外两个控制器中。

  3. 按照

  1. Create two different view controllers (i.e. NIB files or items in your storyboard). Call the classes MyViewControllerLandscape and MyViewControllerPortrait.

  2. Create a third view controller class programatically. Call it MyViewController, and make it the parent class of the landscape and portrait controllers.

    This makes it so that you can put all the common code for the two controllers in the parent class and put only the orientation specific code in the other two.

  3. Follow the instructions at http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/BasicViewControllers/BasicViewControllers.html#//apple_ref/doc/uid/TP40007457-CH101-SW26 to see how to switch between the landscape and portrait viewControllers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文