我使用的是BBWalkthrough (https://github.com/ariok/BWWalkthrough),我想直接从presentViewController转换转到BWWalkthroughViewController的UIScrollView中的一个特定页面。
我怎么能这么做?注意,由于viewController在不同的故事板中,所以我不使用segues。
如果我对BBWalkthroughViewController实例walk的子VC执行了一个walk,那么它显示得很好,但您不能从该视图中滚动(也就是说,您在视图中,但没有滚动函数,因为它没有与其他视图的任何链接)。
func instantiateControllers(){
// Get view controllers and build the walkthrough
let stb = UIStoryboard(name: "Walkthrough", bundle: nil)
let walkthrough = stb.instantiateViewControllerWithIdentifier("walk") as! BWWalkthroughViewController
let page_A = stb.instantiateViewControllerWithIdentifier("walkA") as! UIViewController
let page_B = stb.instantiateViewControllerWithIdentifier("walkB") as! UIViewController
let page_C = stb.instantiateViewControllerWithIdentifier("walkC")as! UIViewController
let page_D = stb.instantiateViewControllerWithIdentifier("walkD")as! UIViewController
let page_E = stb.instantiateViewControllerWithIdentifier("walkE")as! UIViewController
let page_outro = stb.instantiateViewControllerWithIdentifier("walkOUT")as! UIViewController
// Attach the pages to the master
walkthrough.delegate = self
walkthrough.addViewController(page_A)
walkthrough.addViewController(page_B)
walkthrough.addViewController(page_C)
walkthrough.addViewController(page_D)
walkthrough.addViewController(page_E)
walkthrough.addViewController(page_outro)
self.presentViewController(walkthrough, animated: true, completion: nil)
}发布于 2015-08-12 21:02:13
我只需要调用walkthrough的walkthrough方法所需的次数。它相当于模拟用户的页面点击完整的动画,这要么是一个错误或一个功能。
或者只是破解代码的源代码--这就是开源的重点。-)只需使gotoPage()函数非私有,并从上面的代码中调用它一次。该设计没有充分理由使该函数具有私密性。
在这两种情况下,我认为您必须这样做,作为完成处理程序的一部分。
示例:
// Assuming you've removed 'private' from the gotoPage() function
self.presentViewController(walkthrough, animated: true) { walkthrough.gotoPage(3) }或者:
self.presentViewController(walkthrough, animated: true) {
for _ in 0..<3 {
walkthrough.nextPage()
}
}https://stackoverflow.com/questions/31975022
复制相似问题