mee*_*tpd 0 iphone cocoa-touch objective-c panoramas ios
我指的是DMD Panorama应用程序.
如您所见,此图像的顶部有一个阴阳符号.

旋转设备后,两个符号会更接近,如下所示:

你能告诉我如何检测设备的旋转,这样当设备旋转时,这两个图像会更接近吗?
感谢您的回复.
在viewWillAppear函数中添加通知程序
-(void)viewWillAppear:(BOOL)animated{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];}
Run Code Online (Sandbox Code Playgroud)
方向改变通知此功能
- (void)orientationChanged:(NSNotification *)notification{
[self adjustViewsForOrientation:[[UIApplication sharedApplication] statusBarOrientation]];}
Run Code Online (Sandbox Code Playgroud)
进而调用此函数处理moviePlayerController框架的方向
- (void) adjustViewsForOrientation:(UIInterfaceOrientation) orientation {
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
{
//load the portrait view
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
//load the landscape view
}}
Run Code Online (Sandbox Code Playgroud)
在viewDidDisappear中删除通知
-(void)viewDidDisappear:(BOOL)animated{
[[NSNotificationCenter defaultCenter]removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
162 次 |
| 最近记录: |