ios - Cant set the Delegate of my UITabbar -


i have simple tabbar-controller in storyboard. viewcontroller 1 has navigation controller around itself. viewcontroller 2 not have one.

viewcontroller 1 shown first when app goes up.

i need implement following method:

-(void)tabbar:(uitabbar *)tabbar didselectitem(uitabbaritem *)item 

but cant set delegate of uitabbar. want set deleagte in viewcontroller 1. in ib can show delegate property cant draw line. tried set delegate programmatically. no matter set it, app crashes. have set delegate of uitabbar ?

you should make app delegate delegate of tab bar. should able drag tab bar controller in storyboard appdelegate (maybe file's owner).

in code, can reference tab bar controller , set tbc.delegate = self in didfinishlaunchingwithoptions:.

in both scenarios, make sure first make delegate listen delegate methods adding <uitabbarcontrollerdelegate> interface declaration.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -