标签: uiinterfaceorientation

接口方向和UITabBarController的问题

快速问题:

我有一个带2个导航控制器的UITabBarController [让我们称之为左右控制器]

在默认选择的左侧控制器上,我可以推送一个检测界面方向的新视图控制器.

在右侧控制器上我可以推送相同的视图控制器,但它不会检测接口方向,或者就此而言,它甚至都不会进入所有T__T的shouldAutoRotateInterface方法

Haaalp!

如果它有任何相关性,我推动的View Contoller使用hidesBottomBarWhenPushed属性.

iphone uitabbarcontroller uiinterfaceorientation

2
推荐指数
2
解决办法
5017
查看次数

旋转视图时,UIInterfaceOrientationIsLandscape不会触发

我试图使我的应用程序在横向和纵向工作.我在所有的viewcontrollers中安装了正确的方法,这个代码在ipad模拟器旋转时触发,但总是触发纵向.横向IF子句永远不会被触发.我能做错什么?

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)InterfaceOrientation {
NSLog(@"******* ROTATING ******");
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) {

        NSLog(@"ROTATING View Landscape ******");

    } else    if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {

        NSLog(@"ROTATING View Portrait ******");

    }
} 
Run Code Online (Sandbox Code Playgroud)

}

iphone rotation uiview ipad uiinterfaceorientation

2
推荐指数
1
解决办法
9026
查看次数

在景观模式下,搜索栏和表格视图不适合屏幕

我正在使用以下代码以编程方式创建搜索栏和表视图

UISearchBar* searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0,0,320,40)];
searchBar.delegate = self;
[self.view addSubview:searchBar];

UITableView* tblView = [[UITableView alloc]initWithFrame:CGRectMake(0, 41, 320, 400)];
tblView.delegate = self;
tblView.dataSource = self;
[self.view addSubview:tblView];
Run Code Online (Sandbox Code Playgroud)

现在我在下面的方法中使返回值为yes以旋转设备方向的屏幕

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{

    return YES;
}
Run Code Online (Sandbox Code Playgroud)

我使用下面的代码 loadView

self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Run Code Online (Sandbox Code Playgroud)

以下是我的输出

在此输入图像描述 但仍然搜索栏和表格视图不适合横向模式的屏幕,我应该做什么可以任何人帮助我,, thanx提前

iphone xcode landscape objective-c uiinterfaceorientation

2
推荐指数
1
解决办法
320
查看次数

iOS不会旋转

我正在尝试为我的应用添加自动旋转,但有困难.我可以调整所有内容(TableView和一些标签),但状态栏和我的窗口的其余部分(例如:标签栏和导航控制器)仍然是纵向.我有一个从窗口到顶部ViewController的三个视图heirarchy,我将所有内容shouldAutorotateToInterfaceOrientation设置为YES,除了Summary在目标属性的部分中选择了倒置,但它拒绝让步.这种情况发生在模拟器和iPhone 4上.在XCode 4上都是4.3.我已经在视图方向上搜索了苹果文档,但是我还需要设置其他地方吗?

在我Info.plist,我有以下内容:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
Run Code Online (Sandbox Code Playgroud)

iphone uiinterfaceorientation ios auto-rotation

2
推荐指数
1
解决办法
1205
查看次数

全屏模式后,MPMoviePlayerController使App的方向不正确

因此,我们构建了一个仅支持横向定位的iPad应用程序.通过在plist中设置Supported interface orientations (iPad)to来强制执行此操作Landscape (left/right home button).所有的UIViewControllers实现shouldAutorotateToInterfaceOrientation:如下:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
Run Code Online (Sandbox Code Playgroud)

这工作正常,应用程序被锁定在横向方向.现在我们已经MPMoviePlayerController嵌入了我们的一个观点.当用户使用此电影全屏时,他可以旋转到肖像.电影播放器​​似乎绕过了我们所有的景观设置.这对我来说很好,但是当用户done在纵向方向上点击按钮时,我们所有人UIViewControllers都在肖像中并且看起来很可怕!

用户必须旋转iPad以使自己风景自如,以使事物再次看起来很好,然后将无法按预期旋转回到肖像.

那么为什么我的视图轮换为纵向,即使所有人都shouldAutorotateToInterfaceOrientation告诉iOS不要旋转为肖像?我怎样才能确保电影播放器​​不会旋转我的观点?

如果您的解决方案还将电影播放器​​本身锁定在风景中,那对我来说没问题.只要我的意见没有轮换,我很高兴!:)

mpmovieplayercontroller ipad uiinterfaceorientation ios

2
推荐指数
1
解决办法
3519
查看次数

iOS 6.0限制导航控制器内的自动旋转?

我还该怎么办?

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation
{
    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

-(BOOL)shouldAutoRotate
{
    return NO;
}
Run Code Online (Sandbox Code Playgroud)

我的viewController仍在旋转.


它嵌入在导航堆栈中.如果我将UINavigationController子类化,并在那里实现相同的仅肖像模板,并将我的viewController嵌入到调整后的navigationController中,而不是它的工作原理,但我无意在UINavigationController出现的任何地方重写我的代码.

这里的最佳做法是什么?

uiviewcontroller uinavigationcontroller uiinterfaceorientation autorotate ios

2
推荐指数
1
解决办法
3290
查看次数

IO6不调用 - (BOOL)shouldAutorotate

我在我的应用程序中有一些观点,我不想支持方向.在didFinishLaunchingWithOptions我添加导航:

...
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:self.viewController];

    self.window.rootViewController = nav;
    [self.window makeKeyAndVisible];
...
Run Code Online (Sandbox Code Playgroud)

在每一个ViewControllerUITabBar(我不知道这是否重要).

在第一个视图控制器中我添加:

-(BOOL)shouldAutorotate {
        return NO;
    }

    - (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskPortrait;
    }
Run Code Online (Sandbox Code Playgroud)

supportedInterfaceOrientations在视图加载时shouldAutorotate调用,但在旋转设备时不调用.
我在这里错过了什么?

iphone objective-c uiinterfaceorientation ios ios6

2
推荐指数
1
解决办法
5705
查看次数

如何允许特定视图控制器支持横向和纵向方向

我的应用程序是支持iOS 6的基于导航的应用程序.除了视图控制器之外,所有其他应用程序仅支持纵向模式.仅特定视图控制器必须支持横向和纵向方向.

我搜索了很多问题,但没有一个答案适合我.如果有人知道,请指导我

我在Project - > Targets - > Summary - > Supported orientation 中将方向设置为Portait

iphone objective-c orientation uiinterfaceorientation ios

2
推荐指数
1
解决办法
2067
查看次数

当方向在ios 7中上下颠倒时,视图不会旋转

我想让应用程序支持所有方向.它的工作正常,但只有颠倒的方向不起作用.我正在使用ios7.对于倒置,视图不会旋转.我试过以下代码

-(BOOL)shouldAutorotate  
{
return yes;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll; // etc
}
Run Code Online (Sandbox Code Playgroud)

我唯一的第二种方法是调用但不是第一种方法.在infoPlist中,我启用了所有支持的方向.

iphone objective-c uiinterfaceorientation ios7

2
推荐指数
1
解决办法
1429
查看次数

IOS7/IOS8仅在视图控制器中允许纵向

我正在构建一个只有1个横向视图的iPhone应用程序,所以我想阻止所有其他的景观,我试过这个:

-(NSUInteger)supportedInterfaceOrientations
{
   return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)

但它仍然在旋转

objective-c uiviewcontroller uiinterfaceorientation ios

2
推荐指数
1
解决办法
2518
查看次数