[英]How can i attain responisveness for ios apps
您想使用一個stackview。 基本上將您的窗口小部件在stackview中水平或垂直地分組。 堆棧視圖可以嵌套。 除了滾動視圖本身之外,不應使用任何約束。
我認為從2018年起有一個精彩的WWDC視頻,我現在當然找不到。 但是AUTOLAYOUT和STACKVIEW是您要搜索的關鍵字。
這是一個,但實際上並不是我要尋找的那個。 它應該可以幫助您入門。
iPad的“直接” iPhone應用程序“翻譯”看起來很少是完美的。 您可能需要考慮重新設計UI,以更好地使用可用的屏幕空間。 尺寸級別和適當的自動布局絕對可以使您的應用程序看起來更好,但絕不會使該應用程序看起來像是為iPad量身定制的。
您可能需要考慮重新設計UI,不僅要適當調整大小,還要在屏幕較大的設備上提供更多可用性。 一對夫婦的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
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.