ios - How to add UIButton Programmatically from a NSObject Class -
i trying create uibutton in nsobject
class. error " use of unresolved identifier view. figured needs have uiviewcontroller
work.
is there work around create multiple buttons on multiple view controllers. 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) }
declare method definition parameter-argument in want add button :
func createbutton (view:uiview) { let button = uibutton(); button.settitle("add", forstate: .normal) button.settitlecolor(uicolor.bluecolor(), forstate: .normal) button.frame = cgrectmake(15, -50, 200, 100) view.addsubview(button) }
Comments
Post a Comment