照片浏览器的方向问题 [英] Orientation Issue with photo browser
问题描述
我正在使用 KTPhotoBrowser.谁能告诉我为什么当我在我的项目中使用此代码的 TabBarSample 时,我无法使照片适用于风景?照片总是以纵向模式显示,因为我的项目只以纵向模式运行.我该如何解决这个问题?我添加了以下内容
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;
}
在 SDWebImageRootViewController.m
中,但仍然没有运气.
in SDWebImageRootViewController.m
but still no luck.
请任何人都可以下载 this 并看看为什么 TabBarSample(项目)不适用于景观?
Please can anyone download this and see why the TabBarSample(project) not working for the landscape ?
推荐答案
我强烈向阅读本文的其他人推荐 Ryan 的回答.
I highly recommend Ryan's answer for anyone else who read this.
但在这种特殊情况下,发生的情况是 UITabBarController 没有被设置为应用程序窗口中的根视图控制器.我只能猜测这在 iOS 6 之前的工作方式有所不同(Github 项目已有 3 年历史).因此,您在日志中收到了此消息:
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];
为此:
[self.window setRootViewController:tabBarController];
然后正如 Anill 所说,我们需要确保标签栏中的所有视图控制器都同意旋转.
And then as Anill said, we need to make sure all of the view controllers in the tab bar agree to rotate.
这篇关于照片浏览器的方向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!