Swift自定义InputView按钮操作异常

时间:2015-05-07 13:41:53

标签: ios iphone swift inputview

当我尝试从InputView上的另一个UiViewController调用UiViewController时遇到问题。 例如:

我有班主要:

    class HomeViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, RunKeyboardDelegate
{
    override func viewDidLoad() {
        super.viewDidLoad()
        let view1 = self.storyboard!.instantiateViewControllerWithIdentifier("RunKeyboardViewController") as! RunKeyboardViewController
        view1.delegate = self

       txtRunPaciente.inputView = view1.view
}
}

inputView的类:

protocol RunKeyboardDelegate:class
{
    func runChange(sRun: String?)
}

类RunKeyboardViewController:UIViewController {

weak var delegate : RunKeyboardDelegate?
var sRun: String = ""
override func viewDidLoad()
{
    super.viewDidLoad()
    println("TECLADO INI")
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()

}
@IBAction func buttonAction(sender: UIButton)
{
 /*   sRun = sRun + "1"
    self.delegate?.runChange(sRun)
    */
    if(sender.tag == 1)
    {
        println("BTN1")
    }

}
@IBAction func btn2Action(sender: AnyObject)
{
    /*
     sRun = sRun + "2"
     self.delegate?.runChange(sRun)
    */
     println("BTN1")
}

}

当我将故事板按钮与动作链接时,单击时,应用程序崩溃并返回此消息:无法识别的选择器发送到实例0x7fe82d14d5f0。

0 个答案:

没有答案