I am trying to create a uibutton in a NSObject class. i get the error " Use of unresolved identifier 'view'". i figured that it needs to have UIViewController for it to work.
is there a work around so that i create multiple buttons with just this on multiple view controllers. what am i missing?
func createButton () {
let button = UIButton();
button.setTitle("Add", forState: .Normal)
button.setTitleColor(UIColor.blueColor(), forState: .Normal)
button.frame = CGRectMake(15, -50, 200, 100)
view.addSubview(button)
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire