Tag: 方向

如何只旋转subclassed mpmovieplayer控制器,并保持其他视图固定到肖像

我正在使用从MPMoviePlayerController分类的xcdYoutubeVideoViewController。 我的申请是肖像。 要启动电影播放器​​,我正在这样做: UINavigationController *navBarController = (UINavigationController*)[[[UIApplication sharedApplication] keyWindow] rootViewController] ; [navBarController presentMoviePlayerViewControllerAnimated:vc]; 其中vc是XCDYouTubeVideoPlayerViewController的实例。 我怎样才能让旋转只在这个视图和按下完成button在movieplayer把应用程序回肖像?

iPad应用程序界面方向在启动应用程序后已更改

我正在应用程序。 应用程序的方向是风景,但应用程序运行后,应用程序的界面方向改变界面和旋转。 启动屏幕以正确的方式显示(横向)。 我使用ios7的应用程序是代码为ios5我认为有一些不赞成的API问题,例如shouldAutorotateToInterfaceOrientation机器人调用,因为这是没有更多的最新ios

iPad在肖像上显示,但认为它是风景

我的故事build筑师devise了一个肖像布局。 当我开始使用iPad的应用程序已经转向水平时,它能够正确地检测到它处于水平位置。 但是当我用iPad以纵向位置启动应用程序时,它认为它是水平的。 但是,每次旋转它时,代码都能够正确检测到正确的方向。 – (void) viewDidLoad { [self updateForOrientation]; } – (void)updateForOrientation { if (UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])) // became portrait { NSLog(@"is portrait"); //code for changing layout to portrait position } else //became horiztontal { NSLog(@"is horizontal"); //code for changing layout to horizontal position } } Output: is horizontal (this is the output whether […]

查看方向更改

更新:我发现为什么它一直加载相同的观点。 我现在修好了 这是一个错字 ControllerForSplitViews.m – (id)init { self = [super initWithNibName:@"ControllerForSplitViews" bundle:nil]; if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation)){ self.view = landscapeView; } if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation)){ self.view = portraintView; } [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; return self; } 这工作。 现在的问题。 当视图被加载并运行时,我改变了方向,并从相同的nib文件Fixed加载了一个不同的视图。但是一旦我这样做,其他的UI元素就消失了,只有我的横向视图的UI元素被保留,当我再次旋转设备它不再加载我的肖像视图? 任何build议为什么会发生这种情况 -(void) orientationChanged:(id)object { if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) { self.view = portraintView; } if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) { self.view = landscapeView; } } 新问题,每当我改变方向,它加载相反的方向的观点 […]

启动模式视图控制器来解决标签栏和导航VC的方向“locking”?

我有一个iPhone应用程序与根视图控制器(VC)的UITabBarController(设置为纵向)与几个选项卡,其中之一是一个简单的UIViewController。 在这个UIViewController是一个单一的button – “播放video”,当点击打开video模式视图(并自动开始播放video)。 video视图是UIViewController中的一个UIWebView。 我一直在试图让Web视图的VC改变方向为风景,但没有任何运气。 我环顾四周,明白如果你有一个标签栏或一个导航控制器,所有儿童风险投资将与父母一样的方向 – 是有道理的。 这就是为什么我做了networking视图的VC模式,希望这是一个方向问题的方式。 我的问题是:这是否准确 – 使用模态不需要Web视图VC是肖像,并可以响应shouldAutorotateToInterfaceOrientation方法(即使我还没有能够得到它的工作)? 顺便说一下,使用iOS 6。 提前致谢。

方向不适用于ios6?

我在ios6的定位问题。 相同的代码工作正常的ios5或5.1。 我用- (BOOL) shouldAutorotate and -(NSInteger)supportedInterfaceOrientations按照ios6标准。 但是仍然会“ willRotateToInterfaceOrientation ”和“ didRotateToInterfaceOrientation ”不被调用。 这是我的代码: – (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if (!UIInterfaceOrientationIsPortrait(lastOrientation) || !UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) if (!UIInterfaceOrientationIsLandscape(lastOrientation) || !UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) { CGRect frame; int viewAlpha; lastOrientation = toInterfaceOrientation; if (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; viewAlpha = 1; [MovieControlContainerLandscape setHidden:YES]; if (isDauntless) { [self.navigationController […]

关于使用MTLabel的设备旋转的麻烦

我必须使用MTLabel类的线间距的UILabel。 (引用的示例代码: https : //github.com/Tuszy/MTLabel ) 但存在一些问题。 我正在制作一个iPad应用程序。 这个应用程序可以旋转 – 风景或肖像。 我把UILabel和MTLable对象放在视图中而没有IB。 每当设备的方向改变时,文本的宽度也改变了。 这个结果不是我想要的。 我的代码: #import "MTLabel.h" 。 – (void)viewDidLoad { [super viewDidLoad]; MTLabel *TitleFont = [[MTLabel alloc] initWithFrame:CGRectMake(255, 60, 270, 60)]; [TitleFont setFont:[UIFont fontWithName:@"Arial" size:30.0]]; TitleFont.backgroundColor = [UIColor greenColor]; TitleFont.text = @"Happy! – 1"; TitleFont.autoresizingMask = UIViewAutoresizingFlexibleTopMargin& UIViewAutoresizingFlexibleLeftMargin&UIViewAutoresizingFlexibleRightMargin; TitleFont.autoresizingMask= UIViewAutoresizingFlexibleWidth; [self.view addSubview:TitleFont]; //———————- UILabel […]

当键盘显示工作,除了当ipad转身时,移动对话框

模式对话框在键盘出现时向上移动,在键盘消失时向下移动。 一切都很好,直到我旋转iPad。 除了标准以外的其他任何方向都行不通。 当iPad被翻转时,当键盘出现时,模式对话框向下移动,而不是在键盘消失而不是向下时向上和向上。 这是我用来定位模式对话框时,键盘出现/消失的代码。 – (void)textFieldDidBeginEditing:(UITextField *)textField { self.view.superview.frame = CGRectMake(self.view.superview.frame.origin.x, 140, self.view.superview.frame.size.width, self.view.superview.frame.size.height); } }]; } -(void)textFieldDidEndEditing:(UITextField *)textField { [UIView animateWithDuration:0.4 animations:^ { self.view.superview.frame = CGRectMake(self.view.superview.frame.origin.x, 212, self.view.superview.frame.size.width, self.view.superview.frame.size.height); } }]; }

iOS方向问题

我有一个简单的networking应用程序,即时通讯使用本机构build。 MainWindow.xlb与我的应用程序consic充满了本机视图控制器。 在本地视图Controller.mi中有以下代码: http://pastebin.com/xXFc0JCW 看着凌乱的复制和粘贴在这里。 我似乎无法理解我要去哪里错了,为什么我的应用程序/ UIWebView始终保持肖像。 我新开发的iOS。 完整的源代码: https : //www.dropbox.com/s/i9woti5ptecr9n4/Native.zip

将iPad状态栏方向修正为纵向

我有一个简单的标签栏的iPad应用程序。 我需要修改方向为肖像。 我通过在plist文件的“支持的界面方向”字段中设置“肖像(底部主页button)”来实现。 问题是,在旋转iPad时状态栏仍然移动…我该如何解决? 谢谢阅读。