我有一个视图控制器和纵向和横向的单独的nib文件.在旋转时,我加载相应的笔尖.方法
shouldAutorotateToInterfaceOrientation and willRotateToInterfaceOrientation
Run Code Online (Sandbox Code Playgroud)
被调用,笔尖确实改变了.
问题:
the landscape nib does not appear as landscape, but portrait! The status bar is
correctly rotated and appears on the top:
(Sorry, couldn't paste the image, because my account is new. The screenshot is in
landscape, with a landscape status bar, but a landscape view shown as portrait.)
Run Code Online (Sandbox Code Playgroud)
人们会认为问题在于没有将方向设置为视图的IB模拟度量中的横向,但我已经这样做了,视图在IB中显示为横向.(如果视图是纵向的话,我认为甚至不可能创建旋转按钮.)除了这两个笔尖,我还有一个mainwindow.xib,它包含app委托,窗口和视图控制器对象.
编辑:当他们应该"熬夜"时,我意识到视图实际上在旋转.这就像有一个额外的转变.当我将手机向右旋转90°时,风景xib会向右旋转90°.当我将手机向右旋转90°时,纵向xib会上下颠倒显示.状态栏始终正确显示在顶部.
EDIT2:使用
self.view.transform = CGAffineTransformMakeRotation((M_PI * (90) / 180.0));
Run Code Online (Sandbox Code Playgroud)
在willRotateToInterfaceOrientation我可以将视图旋转到左侧的横向(以及我想要的任何方向),因此我可以将其用作变通方法.但是,我有其他项目,视图自动旋转,不需要使用CGAffineTransformMakeRotation.这就像防止自动旋转一样.
当我设置
self.navigationItem.prompt = @"";
Run Code Online (Sandbox Code Playgroud)
在viewDidLoad
,它动画navigationBar
更高.我想表现得更高,但没有动画.我怎么会丢失动画?