Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I came up with a solution to my problem and will post it here just incase other people want it. I warn you now it is a work around, but I couldn't find an answer so it was the best I could do.</p> <p>First add the UITabBarControllerDelegate to your protocols in which the TabBarController is being created, I am using the AppDelegate so do the following:</p> <pre><code>@interface AppDelegate : UIResponder &lt;UIApplicationDelegate, UITabBarControllerDelegate&gt; </code></pre> <p>This allows access to the following TabBar protocol:</p> <pre><code>- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController </code></pre> <p>This basically gets called whenever one the of TabBarItems is pressed (buttons along the bottom). Within this function I am extracting the name of the viewControllerNibFile as this is what they are named (you can probably use the view.tag if you don't want to worry about naming conventions), and posting an event to the notification center as follows:</p> <pre><code>NSString *notificationName; if ([viewController.nibName isEqualToString:@"IntroViewController"]) notificationName = [NSString stringWithString:@"IntroViewChange"]; NSLog(@"%@", notificationName); [[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:nil]; </code></pre> <p>Then I setup a listener in the class which calls the following event:</p> <pre><code>- (void)updateViewRotation { UIViewController *c = [[UIViewController alloc]init]; [self presentModalViewController:c animated:NO]; [self dismissModalViewControllerAnimated:NO]; [c release]; } </code></pre> <p>Like mentioned before this is a massive work around, it's fairly weighty and ugly to look at but it does what I need. If anyone wants to offer some more efficient code I would happily take it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload