使用swift 3,我在我的主視圖中有一個UIScrollView。我把它稱爲我的「功能滾動視圖」如何從主視圖控制器訪問滾動視圖子類(初學者)
我還添加了一個自定義類來我的UIScrollView,其中有一個功能叫loadFeatures()
featureScrollView.swift:
class featureScrollView: UIScrollView {
public func loadFeatures() {
//Add Pictures to the UIScrollView
}
我該怎麼辦在我的主視圖中從ViewController.swift類中存在的UIScrollView實例上調用loadFeatures()
?
在我ViewController.swift我想簡單地寫
scrollView.loadFeatures()
,並在loadFeatures()
代碼應用到了滾動當前在屏幕上。我開始學習Swift,我非常感謝大家的幫助!
image of ScrollView and corresponding class
非常感謝! –