我添加了"viewport"元标记"width=device-width,initial-scale=1.0",在iPad上,页面在横向模式下加载很好,它可以很好地切换到纵向,当我将其旋转回横向时,它会缩放页面,我必须将其缩放回到1比例.
我可以通过添加来修复此问题"maximum-scale=1.0, user-scalable=no",但我想知道是否有一种方法可以解决这个问题,而不会让用户放弃页面.
如果您有任何建议我很乐意听到,
谢谢!
我一直在试图让我的头发试图让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];
}
}];
Run Code Online (Sandbox Code Playgroud)
(processImage使用与WWDC代码相同的writeImage ...方法)
并且WWDC应用程序的代码是......
AVCaptureConnection *videoConnection = [AVCamDemoCaptureManager connectionWithMediaType:AVMediaTypeVideo fromConnections:[[self stillImageOutput] connections]];
if ([videoConnection isVideoOrientationSupported]) {
[videoConnection setVideoOrientation:AVCaptureVideoOrientationPortrait];
}
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:videoConnection
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if …Run Code Online (Sandbox Code Playgroud) 我有一个登录屏幕,其中包含2个用于用户名和密码的EditTexts.我的要求是,在方向更改时,EditText中的输入数据(如果有)应保持原样,并且还应绘制新布局.我有2个布局xml文件 - 一个在布局文件夹中,另一个在layout-land文件夹中.我正在尝试实现以下两种方法,但它们都不是完美的:
(1)configChanges:keyboardHidden -在这种方法中,我没有在清单文件中的configChanges中提供"orientation".所以我在onCreate()和onConfigurationChanged()方法中都调用了setContentView()方法.它符合我的要求.布局已更改,EditTexts中的输入数据也保持不变.但它有一个很大的问题:
当用户单击"登录"按钮时,将显示ProgressDialog,直到收到服务器响应.现在,如果用户在ProgressDialog运行时旋转设备,则应用程序崩溃.它显示一个异常,说"视图无法附加到窗口".我试图使用onSaveInstanceState处理它(它会在方向更改时被调用)但应用程序仍然崩溃.
(2)configChanges:orientation | keyboardHidden -在这种方法中,我在清单中提供"方向".所以现在我有两个场景:
(a)如果我在onCreate()和onConfigurationChanged()中调用setContentView()方法,则相应地更改Layout,但EditText数据会丢失.
(b)如果我在onCreate()中调用setContentView()方法,而不是onConfigurationChanged(),则EditText数据不会丢失,但布局也不会相应地更改.
在这种方法中,甚至没有调用onSaveInstanceState().
所以我处在一个非常令人生畏的境地.有没有解决这个问题的方法?请帮忙.Thanx提前.
我需要禁用方向更改时播放的动画.这可能吗?如果没有,是否可以加快速度?
只是为了澄清,我不想停止方向改变,只是动画.我希望立即改变方向.
我在探索tvOS,我发现,苹果提供了很好的一套模板使用写入TVML.我想知道tvOS使用TVML模板的应用程序是否也可以使用UIKit.
我可以在一个应用程序中混合使用UIKit和TVMLKit吗?
我在Apple开发者论坛上发现了一个帖子,但它没有完全回答这个问题,我正在通过文档找到答案.
我正在尝试使用XCode 8上传现有应用程序的更新.上传后我收到了这封电子邮件:
"此应用程序尝试在没有使用说明的情况下访问隐私敏感数据.应用程序的Info.plist必须包含一个NSCalendarsUsageDescription键,其中包含一个字符串值,向用户解释应用程序如何使用此数据."
我知道iOS 10的新隐私政策以及如何添加所需的描述.我的问题是:我没有在我的应用程序中使用日历.
有没有办法找出为什么Apple认为我使用日历?也许它是由谷歌的AdMobSDK使用的?
我将n avplayer放在视图控制器中以自定义视图控制器的其他一些元素,但我仍然想要AVPlayerViewController中使用的播放和清理控件.当我不使用AvPlayerViewcontroller时,有没有办法为Avplayer启用这些控件?
这是我用来呈现navigationViewController的代码:
-(IBAction)showFilterView:(id)sender {
FilterViewController *vc=[self.storyboard instantiateViewControllerWithIdentifier:@"FilterViewController"];
UINavigationController *nvc=[[UINavigationController alloc] initWithRootViewController:vc];
CATransition *transition = [CATransition animation];
transition.duration = 0.35;
transition.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromLeft;
UIView *containerView = self.view.window;
[containerView.layer addAnimation:transition forKey:nil];
[self.tabBarController presentViewController:nvc animated:NO completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码解雇
-(IBAction)back:(id)sender {
CATransition *transition = [CATransition animation];
transition.duration = 0.35;
transition.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromRight;
UIView *containerView = self.view.window;
[containerView.layer addAnimation:transition forKey:nil];
[[self.navigationController presentingViewController] dismissViewControllerAnimated:NO completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
情况1 ---在景观模式下运作良好
情况2 ---在纵向模式下运行良好
情况3 ---以纵向模式呈现并在横向模式下解除不正常工作(在显示正确视图之前的额外动画)
情况4 …
我在一个应用程序中运行了一个SKView和一个MTKView,到目前为止一切运行良好.
唯一的问题是,这两种观点在视觉上都很差.他们只是并排.但我想让SKView内部的纯金属渲染与内部的一些SKNode一起移动.它是SKView内部的一种快速显示.
在金属方面运行了相当多的计算和渲染的东西.SKView应该为重型计算提供了一个很好的用户界面,并且为纯金属部件提供了极小但非常快速的渲染.
我已经考虑过将SceneKit与SpriteKit场景叠加使用,因为SCNRenderer提供了使用renderAtTime渲染自己的MTLCommandBuffer和MTLRenderPassDescriptor的可能性.
我实现了以下SCNSceneRendererDelegate方法并调用了我自己的render函数,它正在准备commandBuffer.
func renderer(renderer: SCNSceneRenderer, didRenderScene scene: SCNScene, atTime time: NSTimeInterval) {
nodeArray.render()
}
Run Code Online (Sandbox Code Playgroud)
在commandBuffer准备好之后,我调用了我的SCNRenderer的renderAtTime方法.试验和错误向我显示命令缓冲区必须在调用renderAtTime后提交.如果我在它崩溃应用之前这样做.如果我不这样做,它将冻结应用程序.
func bufferFinished(renderer:SCNRenderer, commandBuffer: MTLCommandBuffer, renderPassDescriptor: MTLRenderPassDescriptor){
let current=CFAbsoluteTimeGetCurrent()
renderer.renderAtTime(current, viewport: gameView.bounds, commandBuffer: commandBuffer, passDescriptor: renderPassDescriptor)
commandBuffer.commit()
}
Run Code Online (Sandbox Code Playgroud)
如果我这样做,应用程序正在运行,但没有显示其他金属上下文.我认为因为金属部分所以整个事情都很复杂.
是否有任何简单的示例,其中纯金属在SceneKit视图中呈现或更好地在SpriteKit视图中呈现?
我在Virtual Box上运行android 3.2 RC2 eeepc.操作系统将其视为平板电脑,并通过delfault将方向设置为横向.如何手动更改横向和纵向之间的方向?
有没有办法通过Android操作系统中的命令行执行此操作?是否有像AVD Manager的模拟器那样的快捷键?我尝试了Numlock 7和Ctrl F11.没用 请帮助
我使用VM来运行我正在构建的应用程序.我的应用程序有很多视图,大多数都设置为纵向和横向.一个视图严格设置为纵向.当我启动它时,整个操作系统变成了肖像.如何恢复横向模式?
ios ×4
orientation ×4
iphone ×3
android ×2
apple-tv ×2
objective-c ×2
swift ×2
tvos ×2
animation ×1
avfoundation ×1
camera ×1
eeepc ×1
html ×1
ios10 ×1
ipad ×1
meta-tags ×1
metal ×1
scenekit ×1
sdk ×1
sprite-kit ×1
tvml ×1
uikit ×1
viewport ×1
virtualbox ×1