0
我正在做大小類的通用應用程序。它從5到6 Plus的iPhone上看起來相當不錯。但我需要4S的卷軸。所以我添加了一個滾動視圖,我像advice here一樣。但我的滾動不能修復iPhone 5-6Plus。它滾動一點點。但我希望它僅在4S上提供。我已經用了一天多的時間,我嘗試了不同的約束條件,但沒有任何幫助。請給我一些建議。大小類和滾動視圖 - 無法處理滾動視圖
我正在做大小類的通用應用程序。它從5到6 Plus的iPhone上看起來相當不錯。但我需要4S的卷軸。所以我添加了一個滾動視圖,我像advice here一樣。但我的滾動不能修復iPhone 5-6Plus。它滾動一點點。但我希望它僅在4S上提供。我已經用了一天多的時間,我嘗試了不同的約束條件,但沒有任何幫助。請給我一些建議。大小類和滾動視圖 - 無法處理滾動視圖
在iPhone 5/6/..上,您可以將scrollview的contentSize-property設置爲scrollView自身的height/width。
// determine which device (here just schematically) ...
switch (device)
{
case "iPhone 4S":
// ...
default: // means that the user has an iPhone 5/6/.../iPad/...
scrollView.contentSize = CGSize(width: scrollView.frame.width, height: scrollView.frame.height)
scrollView.bounces = false
// make sure that the scrollView does not show vertical/horizontal scroll indicators ...
}
然後scrollView的大小和它的contentSize的大小是相等的,所以你不應該能夠滾動它。要確定您的設備類型,請使用例如Determine device (iPhone, iPod Touch) with iPhone SDK