标签: uideviceorientation

动画UIViews使交叉淡化效果不能很好地工作

我已经成功创建了一个从tabBar选择中显示的图标菜单.您可以在纵向或横向中查看此菜单.

由于屏幕上的空间,我已经制作了它,所以在纵向中你可以查看4x4图标..但是由于在横向观看时的尺寸这个剂量效果不好...所以我做了它,这样你就可以看到2行由于这个原因,我决定为菜单创建两个UIViews,当设备旋转时我在两个视图之间切换.

即如果纵向电流和设备旋转负载横向和卸载纵向,反之亦然.

这是我用来更改设备旋转视图的代码,这非常好用(可能不是最好的代码,但它是我能做的最好的代码)

if  ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait)
        {
            if([jumpBarContainerLandscape superview])
            {
            // Device is changing from landscape to protrait change views to fit
            // load landscape view
            jumpBarContainerPortrait = [[UIView alloc] initWithFrame:CGRectMake(0.0, (367 - jumpBarHeightPortrait), 320.0, (jumpBarHeightPortrait + 49.0))];
            jumpBarContainerPortrait.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
            jumpBarContainerPortrait.alpha = 0.0;

            // add jumpbar container to view
            [self.view insertSubview:jumpBarContainerPortrait belowSubview:actionTabBar];

            [UIView animateWithDuration:0.2
                                  delay:0.0f
                                options:UIViewAnimationCurveEaseIn 
                             animations:^{

                                 jumpBarContainerLandscape.alpha = 0.0;


                             } completion:^(BOOL finished) {
                                 if (finished) {


                                 }
                             }];


            [UIView animateWithDuration:0.2
                                  delay:0.0f
                                options:UIViewAnimationCurveEaseIn 
                             animations:^{ …
Run Code Online (Sandbox Code Playgroud)

iphone animation uiview ios uideviceorientation

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

iphone中的UIDeviceOrientationFaceDown

我想检测UIDeviceOrientationFaceDown.我怎样才能做到这一点???实际上我想在我的iphone面朝下平面时执行一些操作.这怎么可能???请帮助我这样做.

我有这个代码,但不知道在何处以及如何应用此代码

 [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

 BOOL getOrientationUpdates = [[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications];
   NSLog(@"will receive orientation notifications: %@", getOrientationUpdates?@"YES":@"NO");

  [[NSNotificationCenter defaultCenter] addObserver:self
                                     selector:@selector(orientationChanged:)
                                         name:UIDeviceOrientationDidChangeNotification
                                       object:nil];
Run Code Online (Sandbox Code Playgroud)

如果有任何教程,请建议我

在此先感谢,非常欢迎您的宝贵帮助和建议.

iphone objective-c ios5 uideviceorientation

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

如何从后台检测iOS设备方向?

我正在为在后台运行的客户端开发应用程序.

它不是应用程序商店应用程序,因此它与通常适用于应用程序商店应用程序的规则不完全相同.甚至私有API也是这个应用程序的一个选项,但它必须在非越狱设备上运行.(该应用程序将是一个企业应用程序.)

该应用需要知道当前的设备方向.看似简单,但事实并非如此.我正在使用您期望的普通代码:

UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
BOOL inLandscape = UIDeviceOrientationIsLandscape(deviceOrientation);
Run Code Online (Sandbox Code Playgroud)

但是,似乎这会返回应用程序从前台移动到背景时生效的方向.

我需要方向来跟踪实际的设备方向.实际上我真正想要的是当前前台应用程序的用户界面方向,但Apple很难推断.如果必须,我会满足于设备方向.

这个应用程序是用Objective-C编写的,但我也说"Swift",所以用任何一种语言表达的答案都很好.

ios uideviceorientation

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

iPhone - 屏幕旋转?

UIDeviceOrientation&之间有什么区别UIInterfaceOrientation

我应该使用哪一个来检测UIView上的旋转?

iphone uiinterfaceorientation ios uideviceorientation

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

从枚举类型"UIInterfaceOrientation"到不同枚举类型"UIDeviceOrientation"的隐式转换

我收到以下代码的上述编译器警告.我理解接口和设备方向之间的区别,但不确定如何修改以删除警告.有人可以帮忙吗?

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (ViewController != NULL) {
    [ViewController configureForDeviceOrientation:toInterfaceOrientation];
}
if (Controller != NULL) {
    [Controller configureForDeviceOrientation:toInterfaceOrientation];
}
currentOrientation = toInterfaceOrientation;
}
Run Code Online (Sandbox Code Playgroud)

iphone sdk xcode objective-c uideviceorientation

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

接收方向更改通知时StatusBar方向错误

我有2个视图控制器注册,以接收设备方向更改通知.`

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(repositionView)name:UIDeviceOrientationDidChangeNotification object:nil];

`

在重新定位视图方法中,我有:

   UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;

    if (UIInterfaceOrientationIsLandscape(orientation)) {
        NSLog(@"view (%@) will set orientation landscape",self);
// do smt
    } else {
          NSLog(@"view (%@) will set orientation portrait",self);
//do smt else 
    }
Run Code Online (Sandbox Code Playgroud)

当方向改变时,它们都在记忆中

2013-11-27 17:37:54.277 App[13782:70b] view (<ViewController: 0xbf09950>) will set orientation landscape
2013-11-27 17:37:54.286 App[13782:70b] view (<ViewController: 0xc095e40>) will set orientation portrait
2013-11-27 17:38:17.318 App[13782:70b] view (<ViewController: 0xbf09950>) will set orientation portrait
2013-11-27 17:38:20.123 App[13782:70b] view (<ViewController: 0xc095e40>) will set orientation landscape
Run Code Online (Sandbox Code Playgroud)

只有一个接收正确的方向.为什么是这样 …

objective-c ios uideviceorientation

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

在iOS swift中转换不正常?

功能覆盖

func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) { } 
Run Code Online (Sandbox Code Playgroud)

我在iPad设备上构建和运行时没有触发,但它在移动设备上工作正常(iphone 5,6,7 ......).怎么解决这个?

提前致谢!!

ios uideviceorientation swift

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

在UIDevice Orientation更改时停止自动调整

我对iOS 6.0有一个非常讨厌的问题.每当IUDevice方向更改某些子视图时,即使不需要也会自动调整大小.在我的特殊情况下,唯一自动化的是UIButton,所以我可以做什么来阻止这种自动调整,如果可能的话,禁用所有自动调整大小?

干杯.

iphone cocoa-touch orientation uideviceorientation ios6

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