user3288414
user3288414

Reputation: 222

How do you scroll in a UIScrollView in the Playground?

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.

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

Upvotes: 1

Views: 1119

Answers (1)

Dion Larson
Dion Larson

Reputation: 878

EDIT: 7.3 was released to the App Store on 3/21/2016. It's best to download it there.

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.

Upvotes: 1

Related Questions