无法获取滚动视图以在我的WatchOS

时间:2017-10-28 12:28:04

标签: swift xcode watch

我无法让pickerview scrollview在watchOS上工作

我正在使用“版本8.3.2(8E2002)”

步骤:1

import WatchKit
import Foundation


class InterfaceController: WKInterfaceController {

    @IBOutlet var picker: WKInterfacePicker!

    override func awake(withContext context: Any?) {
        super.awake(withContext: context)

        // Configure interface objects here.

        let item1 = WKPickerItem()
        item1.title = "1"

        let item2 = WKPickerItem()
        item2.title = "2"

        let item3 = WKPickerItem()
        item3.title = "3"

        let item4 = WKPickerItem()
        item4.title = "4"

        let itemsArray = [item1, item2, item3, item4]

        picker.setItems(itemsArray)


        picker.setEnabled(true)
    }

    override func willActivate() {
        // This method is called when watch view controller is about to be visible to user
        super.willActivate()
    }

    override func didDeactivate() {
        // This method is called when watch view controller is no longer visible
        super.didDeactivate()
    }
}

我的问题是它没有在WatchOS模拟器中滚动

1 个答案:

答案 0 :(得分:1)

你见过这个吗?:Apple Watch Simulator not Vertically Scrolling

另外,你在帖子顶部提到的版本,我认为它是Xcode?您是否尝试使用鼠标或触控板通过单击手表模拟器进行滚动,然后像在Mac上一样滚动?