相关疑难解决方法(0)

如何检查iPhone现在的位置(横向或纵向)?

我有一个带标签栏的应用程序,每个标签中都有导航控制器.当用户摇动设备时,UIImageView在导航控制器中显示为子视图.但UIImageView必须包含特殊图像,具体取决于设备的当前方向.

如果我写的只是

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)
   if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { 
   //Code
   }
   else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight||interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
   //Code
   }
}
Run Code Online (Sandbox Code Playgroud)

如果用户在摇动前旋转设备,视图就会变得疯狂.

有没有办法让iPhone出现当前定位?

objective-c ios

36
推荐指数
8
解决办法
6万
查看次数

标签 统计

ios ×1

objective-c ×1