我的問題是,我的Button和其他所有控件不工作時,我已經編程添加滾動視圖到我的子視圖。滾動視圖的UIbutton不互動
override func viewDidLoad() {
super.viewDidLoad()
if(self.appDelegate.screenWidth < 568){
self.scrollView = UIScrollView(frame: view.bounds)
self.scrollView.delegate = self
self.scrollView.contentSize = CGSizeMake(self.appDelegate.screenWidth, 568)
scrollView.delaysContentTouches = false
scrollView.canCancelContentTouches = true
scrollView.scrollEnabled = true
// mainView consists all other controls like UIButton and other
scrollView.addSubview(mainView)
view.addSubview(scrollView)
}
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if(self.appDelegate.screenWidth < 568){
scrollView.frame = view.bounds
mainView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height)
}
}
解決此查詢的任何建議?
在此先感謝
我沒有看到調用super.viewDidLoad() – Marcio
請參閱我的更新後文章 –