我怎样才能获得 ios 应用程序的响应能力

How can i attain responisveness for ios apps

我正在 ios swift 开发应用程序。 这是它在 iPhone 中的样子。

这是 ipad 中的样子

我使用tableview制作了这个应用。我怎样才能使它在 ipad 上也好看。

您想使用堆栈视图。基本上将您的小部件在堆栈视图中水平或垂直分组。堆栈视图可以嵌套。除了滚动视图本身,你不应该使用任何约束。

有一个很棒的 WWDC 视频,我想是从 2018 年开始的,当然我现在找不到了。但是AUTOLAYOUT和STACKVIEW是你要搜索的关键字。

Here 是一个,但它不是我真正要找的那个。它应该让你开始。

"direct" iPhone 应用 "translations" iPad 很少看起来很完美。您可能需要考虑重新设计 UI 以更好地使用可用屏幕 space。大小 类 和适当的自动布局肯定会让您的应用看起来更好,但永远不会使应用看起来像是为 iPad.

量身定制的

您可能需要考虑重新设计您的 UI,不仅要 re-size 正确,还要在屏幕更大的设备上提供更多可用性。可以帮助您做到这一点的几个 UI 组件是 UICollectionView (https://developer.apple.com/documentation/uikit/uicollectionview, https://www.raywenderlich.com/9334-uicollectionview-tutorial-getting-started), 和 UISplitViewController (https://developer.apple.com/documentation/uikit/uisplitviewcontroller, https://www.raywenderlich.com/265-uisplitviewcontroller-tutorial-getting-started).

There are many ways to do it, one of those is you can use auto layouts and differentiate between iPad and iPhone using size classes.

Add a variation in size inspector if you are using storyboards. For iPhones its Compact width and Regular height and for iPads its Regular width and Regular heights.You can visit this link https://www.bignerdranch.com/blog/designing-for-size-classes-in-ios/ for more details.

If you are doing through code then you can differentiate between iPhone and iPadusing below code snippet

      if UIDevice().userInterfaceIdiom == .phone {
          //This is iPhone
          //Here Provide your content size for iPhone
                                       } 
      else { 
          //This is iPad
          //Here Provide your content size for iPad
           }