hello!
i've googled , googled, , dont seem find complete answer question.
can't find solution how can add actions tab bar items.
have delegate class:
code:
@interface myprojectappdelegate : nsobject <uiapplicationdelegate, uitabbarcontrollerdelegate> { uiwindow *window; uitabbarcontroller *rootcontroller; }
and implementation
code:
#import "myprojectappdelegate.h" @implementation myprojectappdelegate @synthesize window; @synthesize rootcontroller; #pragma mark - #pragma mark application lifecycle -(void) applicationdidfinishlaunching:(uiapplication *)application{ [window addsubview:rootcontroller.view]; [window makekeyandvisible]; }
and i've created seperate classes(with xib files) each tab bar item. switching between views works beautifully. problem however, when select view, want content in view refreshed.
i've seen documentation, , tried understand didselectitem method, cant figure out how working. can please push me in right direction? dont understand how methods in delegate class can acess content in view?
2 ways can "try" achieve u wan't, because don't know u mean, "refreshed".
have code in viewdidload.
want put in viewwillappear. first try.
in delegate methods of uitabbarcontroller (if u command clicked it..) u see there methods u maybe use?
code:
@optional - (bool)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller shouldselectviewcontroller:(uiviewcontroller *)viewcontroller - (void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller didselectviewcontroller:(uiviewcontroller *)viewcontroller; - (void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller willbegincustomizingviewcontrollers:(nsarray *)viewcontrollers - (void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller willendcustomizingviewcontrollers:(nsarray *)viewcontrollers changed: - (void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller didendcustomizingviewcontrollers:(nsarray *)viewcontrollers changed:(bool)changed; @end
there choices.
1 called, didselectviewcontroller.
u maybe add code there..
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
Comments
Post a Comment