簡體   English   中英

我如何獲得對iOS應用程序的響應

[英]How can i attain responisveness for ios apps

我正在開發iOS Swift中的應用程序。 這就是iPhone中的外觀。 在此處輸入圖片說明

這就是它在iPad上的外觀 在此處輸入圖片說明

我已經使用tableview做這個程序。 我該如何解決它在ipad上看起來也不錯。

您想使用一個stackview。 基本上將您的窗口小部件在stackview中水平或垂直地分組。 堆棧視圖可以嵌套。 除了滾動視圖本身之外,不應使用任何約束。

我認為從2018年起有一個精彩的WWDC視頻,我現在當然找不到。 但是AUTOLAYOUT和STACKVIEW是您要搜索的關鍵字。

是一個,但實際上並不是我要尋找的那個。 它應該可以幫助您入門。

iPad的“直接” iPhone應用程序“翻譯”看起來很少是完美的。 您可能需要考慮重新設計UI,以更好地使用可用的屏幕空間。 尺寸級別和適當的自動布局絕對可以使您的應用程序看起來更好,但絕不會使該應用程序看起來像是為iPad量身定制的。

您可能需要考慮重新設計UI,不僅要適當調整大小,還要在屏幕較大的設備上提供更多可用性。 一對夫婦的UI組件,可以幫助你做到這一點是UICollectionView( https://developer.apple.com/documentation/uikit/uicollectionviewhttps://www.raywenderlich.com/9334-uicollectionview-tutorial-getting-started )和UISplitViewController( https://developer.apple.com/documentation/uikit/uisplitviewcontrollerhttps://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
           } 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM