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

标签 ios swift iphone ipad

我正在 ios swift 中开发一个应用程序。 这就是它在 iPhone 中的样子。 enter image description here

这是它在 ipad 中的样子 enter image description here

我已经使用 tableview 制作了这个应用程序。我怎样才能修复它以使其在 ipad 上看起来也不错。

最佳答案

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
           } 

关于ios - 我怎样才能获得 ios 应用程序的响应能力,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57057424/

相关文章:

iphone - MKMap查看问题

ios - xcode 7.1 swift 框架应用程序构建但不存档

ios - 带有两个 UILabel 的自动调整 UITableViewCell 大小

ios - 找不到目标 'x86_64-apple-ios-simulator' 的模块

iphone - 关于 UIView 的 sizeThatFits 的问题

iphone - 许多 UIButton 的共享操作,获取按钮特定的字符串

ios - 我可以在图像 Assets 中定位特定的 iPhone 型号吗?

ios - 核心数据 : Sync data from Rest API

swift - 'Publishers.Once' 的替代方案是什么?

ios - 与服务器自动同步 Realm