iOS App crashes on button tap in Swift -
i new swift. having small problem iboutlet button action. when click button app crashes. scenario under:
in default viewcontroller.swift:
override func viewdidload() { super.viewdidload() var mv = mycontroller(nibname:"mycontroller",bundle:nil); self.view.addsubview(mv.view); }
my iboutlet button in mycontroller.swift loads different .xibs per device screen size. have added button action on mycontroller under:
@ibaction func test(sender:anyobject){ nslog(" hello "); }
and here xib looks like:
now when click app crashes. clue guys?
i recommend recreate button in way
1) drag button storyboard. next, select assistant editor @ top right hand corner of xcode , navigate view controller code.
2) select show document outline located @ bottom part of storyboard , click on button. next use ctrl click code , under connection, selectibaction
3) under new block of code generated ibaction, use println("is working?")
, run on ios simulator. should work fine tried on new project.
Comments
Post a Comment