How to push a view in tab bar application from appDelegate
I have a tab bar application with 4 tabs. And when a user clicks a button on one of the views on one of the tabs, I run a method of an appDelegate. In that method I want to display a view over my tab bar application. I want to do it in appDelegate because I have several buttons of one type and I want to implement one method for them so that d开发者_Go百科ifferent views will share one instance of a class. This is how I tried to do it, but all these attempts didn't work:
-(void)authorizeTwitter{
if(!_engine){
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
_engine.consumerKey = kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;
}
if(![_engine isAuthorized]){
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
if (controller){
//[self.rootController presentModalViewController: controller animated: YES];
//[self.window addSubview:controller.view];
//[self.window makeKeyAndVisible];
//[controller.view showFromTabBar:self.rootController.tabBar];
}
}
}
controller - is a viewController instance and I want to show controller.view over my tab bar and all views
精彩评论