Orientation Issue with photo browser

最后都变了- 提交于 2019-12-11 06:28:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!