The running result screens of new projects created in cocos2d are both horizontal and control code.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{return UIInterfaceOrientationIsLandscape(interfaceOrientation); }
This code controls the default horizontal display of the screen view;
Another difference is that the direction of the hardware device (the gray-black background indicates that the device is selected and the supported direction)
When you rotate the device direction, you find that when the screen is vertical, the content in the view is not adjusted, and the tag helloword is not placed horizontally.
If you want to set the default portrait screen during running, modify the code return value (or return yes)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{//return UIInterfaceOrientationIsLandscape(interfaceOrientation); return UIInterfaceOrientationIsPortrait(interfaceOrientation);}
The device support is required for the first two items. The other two items can be selected if needed;
Uiinterfaceorientationisportrait and uiinterfaceorientationislandscape macro definition in uiapplication. h file
# Define uiinterfaceorientationisportrait (orientation) = uiinterfaceorientationportrait | (orientation) = uiinterfaceorientationportraitupsidedown)
# Define uiinterfaceorientationislandscape (orientation) = uiinterfaceorientationlandscapeleft | (orientation) = uiinterfaceorientationlandscaperight)