首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在BWWalkthroughViewController中使用presentViewController转到特定视图

在BWWalkthroughViewController中使用presentViewController转到特定视图
EN

Stack Overflow用户
提问于 2015-08-12 20:43:20
回答 1查看 176关注 0票数 1

我使用的是BBWalkthrough (https://github.com/ariok/BWWalkthrough),我想直接从presentViewController转换转到BWWalkthroughViewController的UIScrollView中的一个特定页面。

我怎么能这么做?注意,由于viewController在不同的故事板中,所以我不使用segues。

如果我对BBWalkthroughViewController实例walk的子VC执行了一个walk,那么它显示得很好,但您不能从该视图中滚动(也就是说,您在视图中,但没有滚动函数,因为它没有与其他视图的任何链接)。

代码语言:javascript
复制
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)
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-12 21:02:13

我只需要调用walkthroughwalkthrough方法所需的次数。它相当于模拟用户的页面点击完整的动画,这要么是一个错误或一个功能。

或者只是破解代码的源代码--这就是开源的重点。-)只需使gotoPage()函数非私有,并从上面的代码中调用它一次。该设计没有充分理由使该函数具有私密性。

在这两种情况下,我认为您必须这样做,作为完成处理程序的一部分。

示例:

代码语言:javascript
复制
// Assuming you've removed 'private' from the gotoPage() function
self.presentViewController(walkthrough, animated: true) {  walkthrough.gotoPage(3) }

或者:

代码语言:javascript
复制
self.presentViewController(walkthrough, animated: true) {
    for _ in 0..<3 {
        walkthrough.nextPage()
    }
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31975022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档