I have a problem when I try call a UiViewController from another UiViewController on InputView. For example:
I have class main:
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
}
}
class for inputView:
protocol RunKeyboardDelegate:class
{
func runChange(sRun: String?)
}
class 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")
}
}
When I link the storyboard button with the action, on clicked, the app crash and return this message: unrecognized selector sent to instance 0x7fe82d14d5f0.