Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iphone中从纵向启动横向视图?_Iphone - Fatal编程技术网

如何在iphone中从纵向启动横向视图?

如何在iphone中从纵向启动横向视图?,iphone,Iphone,我是iPhone开发者的新手,我在iPhone上有一个登录屏幕,当我运行时,它只显示半个屏幕,然后我改变方向,它以横向模式显示登录屏幕,但我想当我启动应用程序时,它以纵向横向模式显示,并导航到另一个屏幕,也以纵向横向模式显示,如何?请任何人帮助我 - (BOOL)shouldAutorotateToInterfaceOrientation:() { UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]

我是iPhone开发者的新手,我在iPhone上有一个登录屏幕,当我运行时,它只显示半个屏幕,然后我改变方向,它以横向模式显示登录屏幕,但我想当我启动应用程序时,它以纵向横向模式显示,并导航到另一个屏幕,也以纵向横向模式显示,如何?请任何人帮助我

 - (BOOL)shouldAutorotateToInterfaceOrientation:()
 {
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIDeviceOrientationLandscapeLeft ||
         orientation == UIDeviceOrientationLandscapeRight )
{
    return YES;
}  
else if (orientation == UIDeviceOrientationPortrait ||orientation ==    UIDeviceOrientationPortraitUpsideDown)
{ 
    return NO;
}
 }
使用这些代码在纵向模式下不工作,但我更改了方向,它将工作

-(void) viewWillAppear:(BOOL)animated{
    UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];

    [self willAnimateRotationToInterfaceOrientation:orientation duration:0];


}

-(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    if(toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown )
    {
    set the view for potrait
    }
    else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight )
    {
    set the view for landscape
    }


}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    return YES;
} 
希望这对你有所帮助。

这是什么意思:“肖像中的风景”???你有这个或那个,不能同时拥有两者(除非你必须拥有iPhone;P)

在plist文件中,您可以确定启动应用程序时将启动的模式:)“初始界面方向”,四个方向各有一个值。最快的方式来设置这个东西。虽然稍后要在应用程序中管理何时旋转或不旋转,您应该使用

-(BOOL)应自动旋转指针面方向:


希望这有帮助:)

嗨,我的问题是如何启动纵向横向视图?谢谢你的回复。