小编Awe*_*ess的帖子

iOS 8 UIActionSheet忽略视图控制器supportedInterfaceOrientations和shouldAutorotate

我有一个通过plist文件配置的应用程序,以支持纵向,横向左和横向右方向(即UISupportedInterfaceOrientations设置为UIInterfaceOrientationPortrait,UIInterfaceOrientationLandscapeLeft和UIInterfaceOrientationLandscapeRight).但是我将支持的方向限制在视图控制器内部.如果我在视图控制器的视图上显示UIActionSheet然后旋转设备,则UIActionSheet将旋转到新方向.这仅发生在运行iOS 8(GM Seed)的设备上.

我希望UIActionSheet遵循包含视图控制器的规则而不是旋转.思考?

我不希望这种情况发生: 截图http://oi58.tinypic.com/20tgto2.jpg

UIViewController示例代码:

- (IBAction)onTouch:(id)sender
{
    UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:@"hi"
                                                       delegate:nil
                                              cancelButtonTitle:@"Cancel"
                                         destructiveButtonTitle:nil
                                              otherButtonTitles:@"Open", nil];

    [actionSheet showInView:self.view];
}

#pragma mark - Rotation methods

- (BOOL)shouldAutorotate
{
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)

rotation orientation uiactionsheet ios ios8

24
推荐指数
3
解决办法
9817
查看次数

ARKit - 为什么当设备旋转时相机的 viewMatrix 位置会发生变化?

当我围绕某个轴旋转测试设备时,相机的 viewMatrix 的 x 轴位置值(第 3 列,第 1 行)发生显着变化。当仅设备的旋转改变 180 度时,沿 x 轴平移大约一米。如果我旋转完整 360 度,x 位置将返回到起始 0 度值。我根本不翻译该设备(忽略轻微的人为错误)。

这是错误还是配置设置问题?有人可以解释为什么仅旋转设备时 x 轴位置就会改变吗?还有其他人看到这个吗?

这是基本的代码设置:

@property (nonatomic, strong) ARWorldTrackingConfiguration *arSessionConfiguration;
@property (nonatomic, strong) ARSession *arSession;

- (void)setup
{
  self.arSessionConfiguration = [ARWorldTrackingConfiguration new];
  self.arSessionConfiguration.worldAlignment = ARWorldAlignmentGravity;
  self.arSessionConfiguration.planeDetection = ARPlaneDetectionHorizontal;
  self.arSession = [ARSession new];
  self.arSession.delegate = self;
  [self.arSession runWithConfiguration:self.arSessionConfiguration];
}

- (void)session:(ARSession *)session didUpdateFrame:(ARFrame *)frame
{
  matrix_float4x4 viewMatrix = [frame.camera viewMatrixForOrientation:UIInterfaceOrientationPortrait];
  NSLog(@"%0.2f, %0.2f, %0.2f", viewMatrix.columns[3][0], viewMatrix.columns[3][1], viewMatrix.columns[3][2]);
}
Run Code Online (Sandbox Code Playgroud)

我正在运行最新 iOS 11 Beta 的 10.5 英寸 …

3d camera ios arkit

1
推荐指数
1
解决办法
2206
查看次数

标签 统计

ios ×2

3d ×1

arkit ×1

camera ×1

ios8 ×1

orientation ×1

rotation ×1

uiactionsheet ×1