【发布时间】:2017-05-10 20:02:31
【问题描述】:
我有带滚动视图的 baseview 控制器。在该滚动视图中,我添加了三个视图控制器视图(xib)。所以我可以水平滚动这三个。在我的第一个视图控制器中,我正在显示一个 tableview。在运行我的应用程序时,它正在显示我所有的 3 个视图控制器。但是当我触摸我的 tableview 单元格时消失了。我在 xcode 7.3 中所做的一样。它工作正常。但在 xcode 8 中它不起作用。请帮我解决这个问题。我附上了我的示例代码
let scrollViewWidth:CGFloat = self.scrollContainer.frame.width
let scrollViewHeight:CGFloat = self.scrollContainer.frame.height
let x = CGFloat(i) * scrollViewWidth
if i == 0{
let qualification = EducationViewController (nibName: "EducationViewController", bundle: nil)
//qualification.view.frame.size.height = scrollViewHeight
//qualification.view.frame.size.width = scrollViewWidth
qualification.view.frame.origin.x = x
self.scrollContainer!.addSubview(qualification.view)
qualification.didMove(toParentViewController: self)
}
else if i == 1{
let state = StateRegistrationViewController (nibName: "StateRegistrationViewController", bundle: nil)
//state.view.frame.size.height = scrollViewHeight
// state.view.frame.size.width = scrollViewWidth
state.view.frame.origin.x = x
self.scrollContainer!.addSubview(state.view)
state.view.backgroundColor = UIColor.red
state.didMove(toParentViewController: self)
}
else if i == 2{
let exp = ExperienceViewController (nibName: "ExperienceViewController", bundle: nil)
// exp.view.frame.size.height = scrollViewHeight
// exp.view.frame.size.width = scrollViewWidth
exp.view.frame.origin.x = x
self.scrollContainer!.addSubview(exp.view)
exp.view.backgroundColor = UIColor.orange
exp.didMove(toParentViewController: self)
}}
【问题讨论】:
标签: ios xcode uitableview uiscrollview xcode8