Tag: uiinterfaceorientation

多个UIInterfaceOrientations应用程序与iOS 6

我正在尝试从iOS 6设置新的UIInterfaceOrientations。 恢复我的应用程序: 我的应用程序有一堆意见; 几乎每个视图都应该在纵向上显示; 我的2个视图(用MPMoviePlayerViewController播放video的MPMoviePlayerViewController )应该旋转到左,右和纵向。 我最初的想法是将应用程序支持的方向设置为肖像,而不是从video播放器视图中更改(不知道如何)支持的方向。 什么是处理这个问题的最好方法? 先谢谢你!

如何在iPhone上启动后设置方向

我会想知道如何在启动后自动旋转iphone。 我的发布图像是在肖像,但应用程序本身在风景。 发射后的方向仍然在人像,而不是自动旋转到风景。 这是我的info.plist 在我的根视图控制器 – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)); }

问题pushViewController从风景到肖像

我试图从支持横向(而在横向模式)的视图控制器,到明确不支持(而不应该)横向的视图控制器。 我这样做如下: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return (toInterfaceOrientation == UIInterfaceOrientationPortrait); } 理想情况下,我想要新的viewController,我推到堆栈上开始在肖像,而不是风景。 奇怪的是,即使这个方法实施,它开始景观。 我唯一的猜测是,苹果公司不希望用户从风景转换到肖像(尽pipe允许我们从风景转移到前面的肖像控制器)。 任何见解和/或帮助将不胜感激。

UISegmentedControl中的两行文本

尝试我可能,我无法解决iOS7 iPhone应用程序的UISegmentedControl错误。 当我创build分段控件时,我使用下面的代码: NSArray *segmentedControlItemArray = [NSArray arrayWithObjects: @"Nominal:\n27 inch", @"Actual:\n700c x 23mm", @"Actual:\n700c x 20mm", nil]; _wheelDiameterSegmentedControl = [[UISegmentedControl alloc] initWithItems:segmentedControlItemArray]; _wheelDiameterSegmentedControl.frame = CGRectMake(0, 102, 290, 50); _wheelDiameterSegmentedControl.selectedSegmentIndex = 0; _wheelDiameterSegmentedControl.tintColor = [UIColor colorWithRed:0.35 green:0.4 blue:0.9 alpha:1.0]; for (id segment in [_wheelDiameterSegmentedControl subviews]) { for (id label in [segment subviews]) { if ([label isKindOfClass:[UILabel […]

我可以在没有黑条的情况下旋转UIView吗?

我有一个UIView,占用iPhone上的整个窗口。 当它旋转到风景,边缘得到小黑条,直到它卡入到位,我所期望的。 我想使uiview比屏幕更大,所以旋转它不会显示那些黑条,而是显示视图中通常不在屏幕上的部分。 我试图增加视图的框架和边界,但是这似乎并没有做到这一点。 有没有人做到这一点成功?

iPad iOS7 – UIPopoverController中的UIImagePickerController有错误的预览图像

我正在UIPopoverController内使用UIImagePickerController,这是与iOS6完美工作。 使用iOS 7时,显示捕捉图像的“预览”图像会旋转,但是如果我拍摄照片,则会正确保存。 这是我如何得到我的select器: UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeImage, nil]; imagePicker.allowsEditing = NO; 并将其添加到popover控制器: self.imagePickerPopOver = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; [self.imagePickerPopOver presentPopoverFromRect:CGRectMake(aPosViewA.x, cameraButton_y, 100.0, 30.0) inView:self.detailViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 这些是在UIScrollView的button位置的计算,以显示在正确的位置popover: presentPopoverFromRect:CGRectMake(aPosViewA.x, cameraButton_y, 100.0, 30.0) 我不认为这个问题在那里,因为我已经尝试了几种组合。 我也尝试在全屏模式下捕捉图像,但应用程序只允许使用横向模式。 如果图像是以纵向模式拍摄的,而模式视图则被解散,那么应用程序也会保持纵向模式。 我无法find一种方法来防止UIImagePickerController切换到肖像模式或强制应用程序回到横向模式,如果模态视图被解散。 UPDATE 我已经从这里得到了答案,并进一步。 在创buildselect器之后,在显示popup窗口之前,我转换视图: switch ([UIApplication […]

强制整个屏幕上的横向方向MPMoviePlayerController在退出全屏时阻止正确的旋转

我有一个支持所有接口方向的iPhone应用程序(iOS6 +)。 但是,当MPMoviePlayerController正在全屏播放video时,只应支持横向。 我发现堆栈溢出下面的解决scheme,它的工作原理。 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillEnterFullscreenNotification:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillExitFullscreenNotification:) name:MPMoviePlayerWillExitFullscreenNotification object:nil]; … -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { if (self.landscapeOnlyOrientation) { return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight; } return UIInterfaceOrientationMaskAll; } – (void)moviePlayerWillEnterFullscreenNotification:(NSNotification*)notification { self.landscapeOnlyOrientation = YES; } – (void)moviePlayerWillExitFullscreenNotification:(NSNotification*)notification { self.landscapeOnlyOrientation = NO; } 然而,一个恼人的问题仍然存在,即如果video以纵向方式退出全屏(在强制横向播放之后),则底层视图不会旋转回来。 我必须手动将设备旋转到横向,然后回到纵向触发更新方向。 有什么办法可以触发这种更新程序? 下面的一组截图应该说明我的意思: 注意:由于各种原因,使用MPMoviePlayerViewController是不可能的。

为什么使用UINavigationController时无法强制横向?

我发现很多问题强制UIViewController风景作为默认值: 如何强制UIViewController纵向在iOS 6中试试这个: – (BOOL)shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } – (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; } 但是当我在UINavigationController里面使用UIViewController的时候,我不能强迫使用landscape.Please help! *工作不好 – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; UINavigationController *navControl = [[UINavigationController alloc] initWithRootViewController:self.viewController]; [navControl setNavigationBarHidden:YES]; self.window.rootViewController = navControl; [self.window makeKeyAndVisible]; […]

iOS7 iPad只使用UIImagePickerController横向应用程序

我相信这是一个常见的问题,许多答案不再工作,许多只是部分,如果你是在iOS7下,你的iPad应用程序只是横向,但你想使用UIImagePickerController与源UIImagePickerControllerSourceTypePhotoLibrary或UIImagePickerControllerSourceTypeCamera 。 如何设置正确,所以它工作100%? 而且你没有得到混合的方向,并避免错误“支持的方向与应用程序没有共同的方向,并且应该返回YES ”。