ios - How do I link my UIButton to a line of code inside my didFinishLaunching? -


i want button restart view when clicked, when click on want run following line of code:

[self.navigationcontroller pushviewcontroller:self.viewcontroller animated:yes]; 

or want run entire didfinishlaunching method?

how link button ?

any appreciated!

i don't know mean

reload app when clicked

but doing on buttonclick have create action button

 [mybutton addtarget:self action:@selector(buttonclicked:) forcontrolevents:uicontroleventtouchupinside];  -(void)buttonclicked { [self.navigationcontroller pushviewcontroller:self.viewcontroller animated:yes]; } 

and explicitly calling didfinishlaunching not right , recommended way it.

you can make method contains didfinishlaunching code , call method on buttonclick

to access appdelegate method viewcontroller use

-(void)buttonclicked {    appdelegate *appdelegate = (appdelegate *)[[uiapplication sharedapplication] delegate];    [appdelegate methodtocall]; } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -