Tag: 方向

iPhone上的响应网站 – 不需要的白色空间上从风景旋转到肖像

我正在创build一个响应式网站,刚刚在iPhone上查看时,我的内容页面中发现了一个奇怪的行为。 在纵向模式下加载时可以正确缩放,也可以在旋转到横向时缩放。 但是,当旋转回肖像时,页面似乎向左移动,或者不能正确缩放,而右侧则有一段白色空白。 因为用户可以向左滑动页面,所以这个空白区域似乎也是在第一次加载时呈现的 更进一步,而不是复杂的解释,这里是一个示例页面的链接发生此行为 。 看看iPhone,然后看看没有这个问题的主页 。 如果你需要进一步了解,只要我知道:)

确定iPad上的UIInterfaceOrientation

我不需要在这种情况下指定方向,我只需要检测它,但我遇到了麻烦。 我有条件代码,只能在肖像工作,如果设备在横向我需要做别的。 由于deviceOrientation不一定与interfaceOrientation相同,所以我不能想出一种testing纵向模式的方法。 我在Google上find的大多数教程都是强制执行景观或进行某种旋转的方法。 我唯一想做的就是确定方向是什么。 这是我的代码,这是不工作的: -(void)viewDidLoad { [super viewDidLoad]; //currentOrientation is declared as UIInterfaceOrientation currentOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation]; NSLog(@"%@",currentOrientation); // == NULL } 我需要有条件地确定interfaceOrientation和program的值。 谢谢你的帮助!

在iOS8上,以横向模式显示我的应用程序将隐藏状态栏,但在iOS 7上,状态栏将显示在两个方向上

我想要在iOS 8中以两种方向显示状态栏; 它在iOS 7中正常显示。 navigationController.isNavigationBarHidden返回NO。 为什么iOS 8这样做?

AVCaptureVideoPreviewLayer方向 – 需要景观

我的应用程序只是风景。 我正在像这样呈现AVCaptureVideoPreviewLayer: self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; [self.previewLayer setBackgroundColor:[[UIColor blackColor] CGColor]]; [self.previewLayer setVideoGravity:AVLayerVideoGravityResizeAspect]; NSLog(@"previewView: %@", self.previewView); CALayer *rootLayer = [self.previewView layer]; [rootLayer setMasksToBounds:YES]; [self.previewLayer setFrame:[rootLayer bounds]]; NSLog(@"previewlayer: %f, %f, %f, %f", self.previewLayer.frame.origin.x, self.previewLayer.frame.origin.y, self.previewLayer.frame.size.width, self.previewLayer.frame.size.height); [rootLayer addSublayer:self.previewLayer]; [session startRunning]; self.previewView有一个(0,0,568,320)的框架,这是正确的。 self.previewLayerlogging一个(0,0,568,320)的框架,这在理论上是正确的。 但是,相机显示在横屏中间显示为纵向矩形,相机预览图像的方向错误90度。 我究竟做错了什么? 我需要将相机预览图层以横向模式显示在全屏幕中,并且图像应该正确定位。

iPhone AVFoundation摄像头方向

我一直在撕掉我的头发,试图让AVFoundation相机以正确的方向(即设备方向)捕捉图片,但我无法使其工作。 我看了教程,我看了WWDC演示文稿,并且下载了WWDC示例程序,但即使这样做也不行。 我的应用程序的代码是… AVCaptureConnection *videoConnection = [CameraVC connectionWithMediaType:AVMediaTypeVideo fromConnections:[imageCaptureOutput connections]]; if ([videoConnection isVideoOrientationSupported]) { [videoConnection setVideoOrientation:[UIApplication sharedApplication].statusBarOrientation]; } [imageCaptureOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) { if (imageDataSampleBuffer != NULL) { //NSLog(@"%d", screenOrientation); //CMSetAttachment(imageDataSampleBuffer, kCGImagePropertyOrientation, [NSString stringWithFormat:@"%d", screenOrientation], 0); NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; UIImage *image = [[UIImage alloc] initWithData:imageData]; [self processImage:image]; } }]; (processImage使用与WWDC代码相同的writeImage …方法) […]

立即检测iOS方向变化

我有一个游戏,其中设备的方向影响游戏的状态。 用户必须快速在风景,人像和逆向风景方向之间切换。 到目前为止,我一直在通过以下方式注册游戏定位通知: [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 但是速度太慢了 – 在旋转电话和实际被触发的通知之间似乎还有第二次延迟。 我需要一种方法来即时检测设备方向的变化。 我尝试过用陀螺仪进行试验,但还不够熟悉,不知道它是否是我正在寻找的解决scheme。

如何检测滚动方向

我想在某个元素上滚动时运行一个函数。 像这样的东西: $('div').scrollDown(function(){ alert('down') }); $('div').scrollUp(function(){ alert('up') }); 但是这些function不存在。 有没有解决这个问题? 他们似乎能够做到这一点。 不幸的是,源代码是压缩的,所以没有运气… 谢谢!!

shouldAutorotateToInterfaceOrientation不在iOS 6中调用

我正在使用MGSplitViewController,我正在使用shouldAutorotateToInterfaceOrientation来控制旋转的主视图控制器的大小。 这一切都在iOS 5上工作正常,但在iOS 6(模拟器和iPad) shouldAutorotateToInterfaceOrientation永远不会被调用。 这是一个错误,我应该期望与iOS 6的最终版本或我不知道已经改变的东西解决?

iOS – UIImageView – 如何处理UIImage图像的方向

是否有可能设置UIImageView来处理图像的方向? 当我将UIImageView设置为方向为RIGHT的图像(这是来自相机胶卷的照片)时,图像被旋转到正确的位置,但是我想按正确的方向显示它,因为它已经拍摄了。 我知道我可以旋转图像数据,但它可以做到更优雅? 谢谢

代码中的布局方向

我在我的应用程序中有这个代码: LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); 我只想将LinearLayout的方向设置为垂直。 XML中的等价物是: android:orientation="vertical" 如何在代码中执行此操作,而不使用XML?