Thursday, December 5, 2013

How to set horizontal screen?

Have this piece of code:
MyViewController * _main = [[[MyViewController alloc] init] autorelease];
_navController = [[UINavigationController alloc] initWithRootViewController: _main];

MyViewController the Class class which overrides the shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation not achieve the horizontal screen vertical screen,
MyViewController the xib file inside, orientation property is set to landscape.

The question now is, I put the above code by a UINavigationController, the results are UINavigationController is vertical screen, and MyViewController is horizontal screen, and the screen does not spin.

I MyViewController the xib file inside, orientation property is set to the default value, but also to shouldAutorotateToInterfaceOrientation commented, still appears that the situation is not rotating screen;

But if I'm right _navController = [[UINavigationController alloc] initWithRootViewController: _main]; sentence commented on it, but I did not like you UINavigationController up.

Seek solutions
Reply:
You do not want to run after and then began to appear only horizontal screen can spin the screen?
If so, in summary only ios sdk options supported Device Orientations There are four display options
It only retains the horizontal screen on the line

The Class class is not in MyViewController which overrides shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
Reply:
After entering only support horizontal screen, it is recommended to use the upstairs usage, convenient
Reply:
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
{
/ / Return YES for supported orientations
return YES;
}

LZ give points.
Reply:
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) | | (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
/ / Return YES;
}

No comments:

Post a Comment