Can you actually scroll in a UIScrollView in a Playground? In the example bellow, I want to be able to scroll down and see the label.
你真的可以在Playground中的UIScrollView中滚动吗?在下面的示例中,我希望能够向下滚动并查看标签。
import UIKit
import XCPlayground
let contentView = UIView(frame: CGRectMake(0, 0, 200, 200))
contentView.backgroundColor = UIColor.yellowColor()
let label = UILabel(frame: CGRectMake(0, 120, 20, 20))
label.text = "a"
contentView.addSubview(label)
let scrollView = UIScrollView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
scrollView.contentSize = CGSize(width: 200, height: 200)
scrollView.addSubview(contentView)
scrollView.flashScrollIndicators()
XCPlaygroundPage.currentPage.liveView = scrollView
1 个解决方案
#1
1
EDIT: 7.3 was released to the App Store on 3/21/2016. It's best to download it there.
编辑:7.3于2016年3月21日发布到App Store。最好在那里下载。
As Eric says, interactivity with playgrounds was added in Xcode 7.3 beta 3. You can read the full announcement here. Since Xcode 7.3 is still in beta, you'll need to download it from here.
正如Eric所说,在Xcode 7.3 beta 3中增加了与游乐场的交互性。你可以在这里阅读完整的公告。由于Xcode 7.3仍处于测试阶段,因此您需要从此处下载。
#1
1
EDIT: 7.3 was released to the App Store on 3/21/2016. It's best to download it there.
编辑:7.3于2016年3月21日发布到App Store。最好在那里下载。
As Eric says, interactivity with playgrounds was added in Xcode 7.3 beta 3. You can read the full announcement here. Since Xcode 7.3 is still in beta, you'll need to download it from here.
正如Eric所说,在Xcode 7.3 beta 3中增加了与游乐场的交互性。你可以在这里阅读完整的公告。由于Xcode 7.3仍处于测试阶段,因此您需要从此处下载。