Tag: 肖像

使用objective-c以编程方式颠倒iOS应用程序

我想在ViewController中使用下面的代码来颠倒我的应用程序: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { //return NO; // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationMaskPortraitUpsideDown); } – (UIInterfaceOrientationMask) supportedInterfaceOrientations { return [super supportedInterfaceOrientations] | UIInterfaceOrientationMaskPortraitUpsideDown | UIInterfaceOrientationMaskPortrait; } 在AppDelegate中: – (UIInterfaceOrientationMask) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationMaskPortraitUpsideDown | UIInterfaceOrientationMaskPortrait; } 当用户按下一个button NSNumber * value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown]; [[UIDevice currentDevice] setValue:value forKey:@"orientation"]; 该应用程序不知何故不旋转,我不知道为什么。 有人可以提供一个提示? […]

为什么CSS background-size:cover在iOS的纵向模式下不工作?

我试图在各种设备上设置一个手动的splash-image 。 我这样做是通过检查orientation (触摸设备)或screen width vs. screen height (无触摸)并相应地设置一个URL。 然后我通过Javascript添加这个CSS规则: document.styleSheets[3].insertRule('.initHandler:before { background: url('+x+') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }', 0) x是根据方向和屏幕大小加载的图像。 我的问题是这在landscape模式下工作正常,但在portrait模式下我的iPad,加载正确的图像(根据不同的肖像/风景),但它没有扩大到全屏尺寸。 问题 : 我不能在纵向模式下的iOS上使用CSS background-size吗? 感谢帮助! 编辑: 刚试过我的Android智能手机。 在那里工作很好。 没有意义,为什么它不适用于iPad。