I use Objective-C to develop an iOS tabBar app. When users open the app, it is in tab1. When users click a picture in tab1, the app will jump to tab3 with the picture's name.
The problem is where to call addObserver in tab3 since tab3 never opens?
I use Objective-C to develop an iOS tabBar app. When users open the app, it is in tab1. When users click a picture in tab1, the app will jump to tab3 with the picture's name.
The problem is where to call addObserver in tab3 since tab3 never opens?
Copyright © 2021 Jogjafile Inc.
If I get your question correctly you just want to open tab3 when you click a photo from tab 1
IMO, it should have something like window->mainController->tabController [tabs]
In your tab1Controller you can setup a delegate lets call it "Tab1ControllerDelegate" having a method named "tab1DidSelectSomething:(NSString *)something". then in your mainController you can assign the delegate to self.
In your tab1Controller picker action you can do something like:
if(_delegate){ [_delegate tab1DidSelectSomething:<whatEverheSelected>]; }Then in your mainController:
-(void)tab1DidSelectSomething:(NSString *)something{ // get the viewController here UIViewController *controller = _tabController.viewControllers[2]; [controller updateselected:something]; _tabController.selectedIndex = 2; }