问题
I am using KTPhotoBrowser. Can any one tell me why when I use the TabBarSample of this code in my project, I am not able to make the photos work for landscape? The photos always display in portrait mode as my project only runs in portrait. How do I solve this issue? I have added the following
-(BOOL)shouldAutorotate {
return YES;
}
in SDWebImageRootViewController.m
but still no luck.
Please can anyone download this and see why the TabBarSample(project) not working for the landscape ?
回答1:
I highly recommend Ryan's answer for anyone else who read this.
But in this particular case, what happened was the UITabBarController is not being set as the root view controller in the app window. I can only guess that this worked differently before iOS 6 (that Github project is 3 years old). Therefore you got this message in the log:
Application windows are expected to have a root view controller at the end of application launch
To solve this, change this line in your app delegate:
[window addSubview:tabBarController.view];
To this:
[self.window setRootViewController:tabBarController];
And then as Anill said, we need to make sure all of the view controllers in the tab bar agree to rotate.
回答2:
You need two lines for iOS6 rotation. You say yes I want your to auto rotate, and here are the supported orientations. Add these to all your viewControllers.
// iOS5 Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
// iOS6 Rotation
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (BOOL)shouldAutorotate
{
return YES;
}
You may also need to go into your Project Settings and make sure your plist supports landscape orientations too.
回答3:
Solved Add following code to
SDWebImageRootViewController.m
LocalImageRootViewController.m
FlickrRootViewController.m
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
来源:https://stackoverflow.com/questions/14626633/orientation-issue-with-photo-browser