相关疑难解决方法(0)

如何以编程方式确定iPhone界面方向?

UIDevice.orientationinclude UIDeviceOrientationFaceUp和 的可能值UIDeviceOrientationFaceDown.虽然知道设备是扁平的可能是有用的,但这并不能告诉我们它是否是平面显示面向纵向或横向模式的界面.有没有办法在设备返回模糊信息的情况下找到GUI的当前方向?我想我可以跟踪方向变化事件以记住最后的纵向/横向方向或检查主要UIView的边界高度和宽度,但这似乎是kludgey.设备或UIView上有一个我失踪的财产吗?

iphone cocoa-touch

53
推荐指数
5
解决办法
5万
查看次数

如何在iPhone中以编程方式检查设备的方向?

可能重复:
iPhone方向

如何在iPhone中以编程方式在任何时间点检查设备的方向?

谢谢.

iphone objective-c ipad ios

26
推荐指数
4
解决办法
5万
查看次数

如何在appdelegate上查看横向和纵向模式?

我想在横向和纵向模式下运行应用程序,

如何在Appdelegate上查看横向和纵向模式?

我试着打电话

- (BOOL) isPad{ 
#ifdef UI_USER_INTERFACE_IDIOM
    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#else
    return NO;
#endif
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    if ([self isPad]) {
        NSLog(@"is pad method call");
        return YES;
    }
    else 
    {
        return UIInterfaceOrientationIsPortrait(interfaceOrientation);
    }

}



- (BOOL)isPadPortrait
{

    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
            && (self.interfaceOrientation == UIInterfaceOrientationPortrait
                || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown));
}


- (BOOL)isPadLandscape
{

    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
            && (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight
                || self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft));

}
Run Code Online (Sandbox Code Playgroud)

但是在appdelegate类型的对象上找不到错误属性界面方向.

我怎样才能做到这一点?

iphone cocoa-touch objective-c ios4

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

标签 统计

iphone ×3

cocoa-touch ×2

objective-c ×2

ios ×1

ios4 ×1

ipad ×1