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