Code:
HDComposeViewController *vc = [[HDComposeViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:nav animated:YES];
The present modal view can't rotate while device rotated. If I change modalPresentationStyle to UIModalPresentationFormSheet, it works!!!
HDComposeViewController has already implement rotate delegate:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (BOOL)shouldAutorotate
{
return YES;
}
Is there anything wrong? Thanks.
You need to add a category for navigation controlller to rotate in ios 6.
#interface UINavigationController (RotationAll)
-(NSUInteger)supportedInterfaceOrientations;
#end
#implementation UINavigationController (RotationAll)
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
#end
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
-(BOOL)shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
Related
I am using tab bar controller in my iPhone app having 4 tabs. I have written code for both orientations.
The problem is when I switch my tabs from portrait to landscape view I'm having trouble.For eg. if I'm in tab1 landscape mode and now I switch my tab and move to tab2 landscape mode but i can see portrait setting of that particular view and not the landscape view.
The code so far on my launch view controller that contains the tab bar controller is as follows :
-(void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
if (self.interfaceOrientation==UIInterfaceOrientationLandscapeLeft)
{
[self rotatingLandscape];
}
else if (self.interfaceOrientation==UIInterfaceOrientationLandscapeRight)
{
[self rotatingLandscape];
}
if (self.interfaceOrientation==UIInterfaceOrientationPortrait)
{
[self RotatingPotrait];
}
else if (self.interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown)
{
[self RotatingPotrait];
}
[super viewWillAppear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation==UIInterfaceOrientationPortrait)
{
rotate=YES;
[self RotatingPotrait];
}
if (interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown)
{
rotate=YES;
[self RotatingPotrait];
}
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
rotate=NO;
[self rotatingLandscape];
}
if (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
rotate=NO;
[self rotatingLandscape];
}
return YES;
}
-(void)rotatingLandscape
{
int selIndex = [self.tabBarController selectedIndex];
if (selIndex == 0)
{
[view1p rotatingLandscape];
}
else if (selIndex == 1)
{
[view2 rotatingLandscape];
}
else if (selIndex == 2)
{
[view3 rotatingLandscape];
}
else if (selIndex == 3)
{
[view4 rotatingLandscape];
}
self.tabBarController.view.frame=CGRectMake(0, 0, 480, 300);
}
-(void)RotatingPotrait
{
int selIndex = [self.tabBarController selectedIndex];
if (selIndex == 0)
{
[view1p RotatingPotrait];
}
else if (selIndex == 1)
{
[view2 RotatingPotrait];
}
else if (selIndex == 2)
{
[view3 RotatingPotrait];
}
else if (selIndex == 3)
{
[view4 RotatingPotrait];
}
self.tabBarController.view.frame=CGRectMake(0, 0, 320, 460);
}
I have fixed problem for my project support iOS 6.0+
Steps:
1 create Subclass of UITabBarViewController and add
- (BOOL)shouldAutorotate
{
return [self.selectedViewController shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
return [self.selectedViewController supportedInterfaceOrientations];
}
2 Subclass UINavigationController add
- (BOOL)shouldAutorotate
{
return [self.topViewController shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
return [self.topViewController supportedInterfaceOrientations];
}
3 to AppDelegate add
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
NSUInteger orientations = UIInterfaceOrientationMaskAllButUpsideDown;
if(self.window.rootViewController){
UIViewController *presentedViewController = [[[[(UINavigationController *)self.window.rootViewController viewControllers] objectAtIndex:self.tabBarController.selectedIndex] viewControllers] lastObject];
orientations = [presentedViewController supportedInterfaceOrientations];
}
return orientations;
}
4 to each UIViewController add self.tabBarCotroller.delegate = self;
and delegate method
- (void)tabBarController:(UITabBarController *)theTabBarController didSelectViewController:(UIViewController *)viewController {
NSUInteger indexOfTab = [theTabBarController.viewControllers indexOfObject:viewController];
NSLog(#"Tab index = %u ", indexOfTab);
UIViewController *mVC = [[UIViewController alloc] init];
mVC.view.backgroundColor = [UIColor redColor];
mVC.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:mVC animated:NO completion:nil];
[self dismissViewControllerAnimated:NO completion:nil];
}
5 to each UIViewController add orientation what you need
- (BOOL)shouldAutorotate
{
if (self.interfaceOrientation==UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation==UIInterfaceOrientationLandscapeRight)
{
return NO;
} else {
return YES;
}
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape; //UIInterfaceOrientationMaskPortraite
}
for me it is work
I have created example
My App have one Parent View Controller(MainViewController.h/m - UIViewController, without NIB file) for all other UIViewControllers, which is at the same time RootViewController.
My App should support iOS 5, so AutoLayout is off..
Hier some code:
In AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.mainViewController = [[MainViewController alloc] init];
[self.window setRootViewController:self.mainViewController];
[self.window makeKeyAndVisible];
return YES;
}
In MainViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if ([[UIScreen mainScreen] bounds].size.height == 568) {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController~iPhone5" bundle:nil];
} else {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController~iPhone" bundle:nil];
}
} else {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController" bundle:nil];
}
[self addChildViewController:_homeViewController];
[self.view addSubview:_homeViewController.view];
[_homeViewController didMoveToParentViewController:self];
}
- (void)changeFromViewController:(UIViewController*)fromViewController toViewController:(UIViewController*)toViewController withDuration:(NSNumber*)duration {
toViewController.view.frame = self.view.bounds;
[toViewController.view layoutIfNeeded];
[self addChildViewController:toViewController];
[self transitionFromViewController:fromViewController
toViewController:toViewController
duration:[duration floatValue]
options:UIViewAnimationOptionTransitionCrossDissolve
animations:nil
completion:^(BOOL finished) {
[toViewController didMoveToParentViewController:self];
[fromViewController willMoveToParentViewController:nil];
[fromViewController removeFromParentViewController];
}];
}
HomeViewController*.xib contains 7 UIButtons. If one of them touched MainViewController Class is being called to change from one ChildViewController(HomeViewController, etc..) to another.
HomeViewController.m
- (IBAction)firstButton_click:(id)sender {
[(MainViewController *)self.parentViewController setAnimationForChangeFrom:self toStartTestSettingsViewControllerWithDuration:[NSNumber numberWithDouble:0.4] andWithDelay:[NSNumber numberWithDouble:0.1]];
}
Now about the Problem.
On iPhone(Device or Simulater) with iOS 6 and above UIButtons respond only after several touches. Buttons placed on the bottom of the view to work, must be touched more times, then buttons placed on the top. After several touches, when event fired and view was changed, when I come back to this View everything work normally. I have this problem only with iPhone iOS 6.x. It works normally on iPhone iOS 5.x and iPad 5.x-6.x.
If I make HomeViewController RootViewController, Buttons of course respond to events. But then I can't transform with UIViewAnimationOptionTransitionCrossDissolve Animation[[UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:], because view must have same Parent View Controller.
What did I wrong? Is it bug? Is there any solution?
Any help would be greatly appreciated.
Write this in .pch file
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if (IS_IPHONE_5) {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController~iPhone5" bundle:nil];
} else {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController~iPhone" bundle:nil];
}
} else {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController" bundle:nil];
}
[self addChildViewController:_homeViewController];
[self.view addSubview:_homeViewController.view];
}
The Problem was because of [_homeViewController didMoveToParentViewController:self];.
It is superfluous.
ViewDidLoad in MainViewController should be:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if ([[UIScreen mainScreen] bounds].size.height == 568) {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController~iPhone5" bundle:nil];
} else {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController~iPhone" bundle:nil];
}
} else {
_homeViewController = [[HomeViewController alloc] initWithNibName:#"HomeViewController" bundle:nil];
}
[self addChildViewController:_homeViewController];
[self.view addSubview:_homeViewController.view];
}
Now everything works..
I am using this code in my button action function:
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.allowsEditing = NO;
picker.wantsFullScreenLayout = YES;
[self presentViewController:picker animated:YES completion:nil];
I am implementing the delegate also. UIImagePickerControllerDelegate
But it gets crashed at
[self presentViewController:picker animated:YES completion:nil];
Can som one help me out on what I am doing wrong?
This is for IOS 6. These delegate methods are supported only in IOS 6.
I got the answer to my own question. My application was developed for landscape mode only. So the imagePickerView was not able to present itself as its default orientation is landscape. So I made my application supported for landscape and portrait mode. In the app delegate I used the method,
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
else /* iphone */
return UIInterfaceOrientationMaskAllButUpsideDown;
}
And in the rootViewController I used the following delegates to force the viewController to be in landscape mode and remain in landscape mode.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
return YES;
else
return NO;
}
- (BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
And it worked.
didAnimateFirstHalfOfRotationToInterfaceOrientation is deprecated in iOS 5.0. However I would like to use this method in my application. I am using the sample code that Apple offers in the iOS Dev Center, project name AlternateViews. I would like the app to rotate the portraitView while fading in the landscapeView. Can this be done in iOS 5 or is this feature forever gone?
portraitView currently calls:
[self presentModalViewController:self.landscapeViewController animated:YES];
while landscapeView calls this in code in the init method:
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
It appears all of the animation is done in the following PortraitViewController.m:
#import "PortraitViewController.h"
#import "LandscapeViewController.h"
#implementation PortraitViewController
#synthesize landscapeViewController;
- (void)viewDidLoad
{
self.view.backgroundColor = [UIColor colorWithRed:197.0/255.0 green:204.0/255.0 blue:211.0/255.0 alpha:1.0];
LandscapeViewController *viewController = [[LandscapeViewController alloc]
initWithNibName:#"LandscapeView" bundle:nil];
self.landscapeViewController = viewController;
[viewController release];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification object:nil];
}
- (void)viewDidUnload
{
self.landscapeViewController = nil;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[landscapeViewController release];
[super dealloc];
}
- (void)orientationChanged:(NSNotification *)notification
{
// We must add a delay here, otherwise we'll swap in the new view
// too quickly and we'll get an animation glitch
[self performSelector:#selector(updateLandscapeView) withObject:nil afterDelay:0];
}
- (void)updateLandscapeView
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView)
{
[self presentModalViewController:self.landscapeViewController animated:YES];
isShowingLandscapeView = YES;
}
else if (deviceOrientation == UIDeviceOrientationPortrait && isShowingLandscapeView)
{
[self dismissModalViewControllerAnimated:YES];
isShowingLandscapeView = NO;
}
}
// override to allow orientations other than the default portrait orientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait); // support only portrait
}
#end
Here is my current implementation files which fail miserably.
PortraitViewController.m:
#import "PortraitViewController.h"
#import "LandscapeViewController.h"
#implementation PortraitViewController
#synthesize landscapeViewController;
- (void)viewDidLoad
{
LandscapeViewController *viewController = [[LandscapeViewController alloc]
initWithNibName:#"LandscapeView" bundle:nil];
self.landscapeViewController = viewController;
[viewController release];
NSLog(#"Portrait viewDidLoad");
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
}
- (void)viewDidUnload
{
self.landscapeViewController = nil;
}
- (void)dealloc
{
[landscapeViewController release];
[super dealloc];
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
NSLog(#"Portrait-willAnimateRotationToInterfaceOrientation Portrait");
} else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
NSLog(#"Portrait-willAnimateRotationToInterfaceOrientation Landscape");
}
[self performSelector:#selector(updateLandscapeView) withObject:nil afterDelay:0];
}
- (void)updateLandscapeView
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView)
{
NSLog(#"Portrait-present Landscape");
[self presentModalViewController:self.landscapeViewController animated:YES];
isShowingLandscapeView = YES;
}
else if (deviceOrientation == UIDeviceOrientationPortrait && isShowingLandscapeView)
{
NSLog(#"Portrait-dismiss Landscape");
[self dismissModalViewControllerAnimated:YES];
isShowingLandscapeView = NO;
}
}
// override to allow orientations other than the default portrait orientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
return NO;
else
return YES;
}
#end
LandscapeViewController.m
#import "LandscapeViewController.h"
#implementation LandscapeViewController
// the designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
{
self.wantsFullScreenLayout = YES; // we want to overlap the status bar.
// when presented, we want to display using a cross dissolve
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
}
return self;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
oldStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
NSLog(#"Landscape viewWillAppear");
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[[UIApplication sharedApplication] setStatusBarStyle:oldStatusBarStyle animated:NO];
}
// override to allow orientations other than the default portrait orientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// return YES for supported orientations
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
return NO;
else
return YES;
//return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
NSLog(#"Landscape-willAnimateRotationToInterfaceOrientation Portrait");
[self dismissModalViewControllerAnimated:YES];
} else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
NSLog(#"Landscape-willAnimateRotationToInterfaceOrientation Landscape");
}
}
#end
In Apple's UIViewController reference page, you'll find this useful paragraph in the "Handling View Rotations" section:
If you want to perform custom animations during an orientation change,
you can do so in one of two ways. Orientation changes used to occur in
two steps, with notifications occurring at the beginning, middle, and
end points of the rotation. However, in iOS 3.0, support was added for
performing orientation changes in one step. Using a one-step
orientation change tends to be faster than the older two-step process
and is generally recommended for any new code.
To add animations for an orientation change, override the
willAnimateRotationToInterfaceOrientation:duration: method and perform
your animations there.
Could you override the willAnimateRotationToInterfaceOrientation: method to do your animations?
As this configuration is not supported I was wondering what alternatives people have used.
I have a universal app which currently uses a 4 tab UITabBarController on both the iPhone and iPad.
As I'd now like to use the splitviewcontroller I am faced with a design decision.
I guess I could just go with a toolbar at the top and go from there but was hoping there were more interesting techniques.
You could replicate a UITabBar within a modelViewController that pops up when a button on the bottom of the screen is taped and swap Views. :)
I created a UITabBarController subclass which properly propagates the rotation messages to all UISplitViewControllers it contains. This maintains the correct internal state of the UISplitViewControllers. However, one of the SplitViewController delegate methods is not called if the SplitViewController is not visible, so I account for this in the detail view controller viewWillAppear method. I've confirmed this works in iOS5.0 - iOS6.1
AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
OSMasterViewController *masterViewController = [[[OSMasterViewController alloc] initWithNibName:#"OSMasterViewController_iPhone" bundle:nil] autorelease];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
self.window.rootViewController = self.navigationController;
} else {
OSMasterViewController *masterViewController = [[[OSMasterViewController alloc] initWithNibName:#"OSMasterViewController_iPad" bundle:nil] autorelease];
UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
OSDetailViewController *detailViewController = [[[OSDetailViewController alloc] initWithNibName:#"OSDetailViewController_iPad" bundle:nil] autorelease];
UINavigationController *detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
masterViewController.detailViewController = detailViewController;
UISplitViewController *splitViewController = [[[OSSplitViewController alloc] init] autorelease];
splitViewController.viewControllers = #[masterNavigationController, detailNavigationController];
splitViewController.delegate = detailViewController;
OSTestViewController *secondaryController = [[[OSTestViewController alloc] init] autorelease];
OSTabBarController *tabBarController = [[[OSTabBarController alloc] init] autorelease];
tabBarController.viewControllers = #[self.splitViewController, secondaryController];
self.window.rootViewController = tabBarController;
}
[self.window makeKeyAndVisible];
return YES;
}
OSTabBarController.m
#import "OSTabBarController.h"
#implementation OSTabBarController
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
for(UIViewController *targetController in self.viewControllers){
if(targetController != self.selectedViewController && [targetController isKindOfClass:[UISplitViewController class]]){
[targetController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
}
}
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
for(UIViewController *targetController in self.viewControllers){
if(targetController != self.selectedViewController && [targetController isKindOfClass:[UISplitViewController class]]){
[targetController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
}
}
#end
DetailViewController
#implementation OSDetailViewController
-(void)viewWillAppear:(BOOL)animated{
//the splitViewController:willHideViewController:withBarButtonItem:forPopoverController: may not have been called
if(!UIInterfaceOrientationIsPortrait(self.interfaceOrientation)){
self.navigationItem.leftBarButtonItem = nil;
}
}
#pragma mark - UISplitViewControllerDelegate Methods
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
}
- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
}
#end