【发布时间】:2017-09-09 11:27:27
【问题描述】:
我正在使用 swift3,我的应用包含用于水平滚动的 UIscrollview。它包含带有分页的图像。下面是它的代码示例。
for index in 0..<storyImages.count {
frame.origin.x = self.scrollView.frame.size.width * CGFloat(index)
frame.size = self.scrollView.frame.size
self.scrollView.isPagingEnabled = true
print(self.scrollView.bounds.width * CGFloat(index))
let rect = CGRect(x: CGFloat(self.scrollView.bounds.width * CGFloat(index)), y: 0, width: scrollViewWidth , height: scrollViewHeight)
let imageView = UIImageView()
imageView.frame = rect
imageView.image = storyImages[index]
self.scrollView.addSubview(imageView)
}
它在所有 iPhone 上都能完美运行,但是在 iPad 水平滚动上执行相同的应用程序时会出现延迟。请指教
【问题讨论】:
-
你在哪里设置scrollview的contentSize?
标签: ios swift ipad uiscrollview