如何在iPhone上横向绘制UIViewController?
关于这个主题已经有一些问题。不幸的是,他们都没有帮助我。所以事情就是这样。我正在开发一款应用程序 atm,它有一个带有两个选项卡的 tabcontroller,其中包含彼此叠置的多个导航控制器。现在,在顶级导航控制器的一个选项卡中,我想以横向方向绘制一些图形。
不幸的是,使用返回 YES 的 shouldAutorotateToInterfaceOrientation 方法会导致无论如何都没有帮助。
现在我想知道是否可以隐藏状态栏和导航栏,然后绘制图形,使其看起来像横向。但后来我还想添加一些标签。我很确定我也可以将它们旋转 90 度。但这可能不是正确的方法。我想有一天提交我的应用程序......
所以现在我希望有人知道这里最好的方法是什么以及如何实现它。
谢谢。
there are already some questions on this topic. Unfortunately none of them helped me in anyway. So here is the thing. I am working on an app atm and it has one tabcontroller with two tabs, which contain multiple navigationcontroller on top of each other. Now in one tab at the top level navigation controller, I want to draw some graphics in landscape orientation.
Unfortunately using the shouldAutorotateToInterfaceOrientation method returning YES does not help in anyway.
Now I was wondering whether I could just hide the statusBar and the navigationBar and then draw my graphics so that it looks like it is landscape orientation. But then I also would like to add some labels. I am quite sure I also could turn those around 90 degrees. But this is probably not the right approach here. And I want to submit my app someday...
So now I was hoping someone knows whats the best approach here and how to realize it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在其他地方找到了解决方案。这个想法是使用 CGAffineTransform 方法。它允许您转换 uiview 的完整坐标系。下面的代码将其旋转为横向。现在,当您绘图时,绘图与旋转的坐标系相关,并且所有内容都是以横向方向绘制的。
这就是我想要的。但无论如何,如果还有其他建议,请留言!
I found a solution somewhere else. The idea is to use the CGAffineTransform method. It allows you to transform the complete coordinate system of a uiview. The piece of code underneath rotatets it to landscape. Now when you draw, the drawing relates to the rotated coordinate systems and everything is drawn in landscape orientation.
This does what I want. But anyway, if there are any other suggestions, please post them!