IPhone : How to call a UIViewController inside a UIButton in swift NSCoder

on Saturday, March 28, 2015

I don't know how call a UIViewController inside a UIButton.


I have this ViewController:


import UIKit


class ExampleViewController: UIViewController {



private var activity: UIActivityIndicatorView
private var label: UILabel

required init(coder aDecoder: NSCoder) {
label = UILabel()
activity = UIActivityIndicatorView()
super.init(coder: aDecoder)
}

override func viewDidLoad() {
super.viewDidLoad()


.....


And in another file the calling like this:



@IBAction func myButton(sender: UIButton) {

var pointer = ExampleViewController(coder: NSCoder)


}


I don't know what I should write in NSCoder in this case. If I write ExampleViewController(), Xcode shows an error "Missing argument for parameter coder in call". I suppose I don't understand something but I don't have a lot of experience so I will appreciate some information about that. Thanks in advance!!!


0 comments:

Post a Comment