UI 自动旋转仅适用于某些设备?
我在(不仅仅是)UI 自动旋转方面遇到了非常有趣(但非常烦人)的问题。我正在开发一个应用程序,其中包含选项卡栏控制器和几个导航控制器作为选项卡项。这些控制器之一允许自动旋转到横向模式。
有趣的是,它在模拟器和我自己的设备上都能完美运行,但在其他测试设备上却不起作用。所有设备均相同 - iPhone 3G 16 GB,操作系统版本 3.1.3。
当我在控制台中查找报告方向更改事件的日志消息时,我只能在我的设备上再次找到它,而不能在其他设备上找到它,因此其他设备似乎根本不报告方向更改。另一方面,这是不太可能的,因为其他应用程序正常工作......此外,在我的手机上运行的其他一些功能也无法在其他设备上运行(例如在桌面视图中处理触摸事件)。
我从来没有见过这样的东西,也找不到任何理由为什么它不应该在所有设备上以同样的方式工作!所以问题是——我是疯了还是怎么的?
我使用 UITabBarViewController 的子类和重写方法
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation {
BOOL shouldRotate = (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
NSLog(@"Should rotate: %d", shouldRotate);
return shouldRotate;
}
然后我在相应的方法中处理方向更改动画(willRotate ...,willAnimateRotation ...)。但正如我所说 - 它在我的设备上工作正常,但在其他设备上,shouldAutorotateToInterfaceOrientation:方法永远不会被调用。诡异的!
在我陷入疯人院之前,请给我一些提示。感谢您的任何提示。
I'm having quite interesting (but very annoying) problem with (not only) UI autorotation. I'm working on the app which contains tabbar controller with couple of navigation controllers as tab items. One of those controllers allows for autorotation to landscape mode.
Interesting is that it perfectly works in Simulator as well as on my own device, but it's not working on other testing devices. All devices are the same - iPhone 3G 16 GB, OS version 3.1.3.
When I'm looking for a log messages which report orientation change events in console, I can find it again only on my device, but not on other devices, so it seems that other devices do not report orientation change at all. Which is very unlikely on the other hand, because other apps are working normally... Also some other features which are working on my phone are not working on other devices too (touch events handling in tableview for instance).
I've never seen something like this and cannot find any reason why the hell it should not work on all devices the same way! So the question is - am I mad or what?
I use subclass of UITabBarViewController with overriden method
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation {
BOOL shouldRotate = (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
NSLog(@"Should rotate: %d", shouldRotate);
return shouldRotate;
}
Then I handle orientation change animation in respective methods (willRotate..., willAnimateRotation...). But as I said - it works fine on my device, but on other devices the shouldAutorotateToInterfaceOrientation: method gets never called. Weird!
Please give me some hint before I'll end in a madhouse. Thanks for any tip.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论