我正在尝试集成库BWWalkthrough (https://github.com/ariok/BWWalkthrough)。我成功地完成了演练。我试图在演练视图的顶部添加登录/注册按钮,如下所示。这就是我所面临的问题。
请参阅下面的图片:

“登录”按钮和“非成员”按钮应分别启动登录和注册视图控制器。由于这两个按钮是在BWWalkthroughViewController中生成的,所以我尝试在所述控制器中添加IBAction,并得到错误"Type 'BWWalkthroughViewController‘不符合协议'LoginViewController'"。我到处找遍了,但没能解开这个谜题。
代码和相关代码片段在这里:http://codepen.io/anon/pen/aONBVP?editors=001
//RegisterViewController
// Defined the delegate
import UIKit
import Parse
@objc protocol RegisterViewControllerDelegate {
}
class RegisterViewController: UIViewController, UITextFieldDelegate {
var delegate: RegisterViewControllerDelegate?
// BWWalkthroughViewController
// the troubled code
@IBAction func loginButtonTapped() {
}
@IBAction func registerButtonTapped() {
println("registerButtontapped")
let stb = UIStoryboard(name: "Main", bundle: nil)
let register = stb.instantiateViewControllerWithIdentifier("register") as RegisterViewController
register.delegate = self //the buggy line
// error is: Type 'BWWalkthroughViewController' does not conform to protocol 'RegisterViewControllerDelegate'
self.presentViewController(register, animated: true, completion: nil)
}我遵循了youtube教程:https://www.youtube.com/watch?v=O2mbveNs-0k用于集成BWWalkthrough。视频的相关部分约为11分钟和15分钟。
有个善良的灵魂能帮我解决这个问题吗?(请:)
发布于 2015-05-14 09:03:54
杰出的西蒙·阿彻(http://www.simonarcher.me/blog/wp/,他创建了youtube指南)在youtube上回答了我的问题,我在这里分享:
“嗨,塔尔文德,谢谢你抽出时间观看这段视频。不幸的是,斯威夫特1.2版(和iOS 8.3版)出现了这个问题。我必须更新视频,但BWWalkthrough库(0.5版)的作者已经对他的演示项目进行了更新,同时你可以比较他在那部分的代码,看看如何使用SWIFT1.2来处理它。再次感谢,我希望这会有所帮助!”
我注释掉了login.delegate = self行,问题解决了。
https://stackoverflow.com/questions/30218723
复制相似问题