iPad3 HD Black Screen in Portrait Orientation - ipad

I'm currently updating my game using XCode 4.3.1 and an iPad3. WHen iPAD HD mode is selected, I get a black screen when I change the scene from the AppDelegate.
I'm using COCOS2d v1.0.1
My Game is portrait only mode, and I think I've tracked the problem down.
If you create a new project with the default HelloWorld Layer, it works on the iPad3 and it's simulator in HD.
However if you change the following code :-
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
...
#elif GAME_AUTOROTATION == kGameAutorotationUIViewController
//
// EAGLView will be rotated by the UIViewController
//
// Sample: Autorotate only in landscpe mode
//
// return YES for the supported orientations
//return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );
return ( UIInterfaceOrientationIsPortrait ( interfaceOrientation ) );
//return NO;
...
}
In RootViewController.m
You see a black screen for the iPad3 real device and simulator. It works as expected on all devices, iPhone/iPod Touch, and iPad 1 and 2.
If I change the statement back to
return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );
I get the Hello World rendered to the screen, but it is in landscape only on iPad3.
Has anyone else encountered this and have any suggestions for a fix?
The project is quite large to upgrade to the latest V1 Beta code.

since it too late to respond. It can help others
try this line of code at
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
[director setProjection:kCCDirectorProjection2D];
hope this will fix your issue.

i think the problem to this is in the new xcode, when u upgrade to the XCODE 4.5 with the new
IOS 6.0 sdk, the project "supported interface orientation" feature gets unselected,
try to select them all if u want all of them to be available,
this will solve the issue,
no need to change in the app-delegate or to use
[director setProjection:kCCDirectorProjection2D]; since it might mess up the display.
hope this helps, based on what i faced personally.

Just disable Retina for iPad3
[director enableRetinaDisplay:YES];
Later, you can upgrade you app for iPad3 by adding XXXXXx-ipadhd.png (ipad retina version of images) to your project.

Related

ViewController orientation on external monitor

I have an iPad kiosk app that displays video on an external monitor connected via an HDMI cable. The device orientation is set to Landscape Left or Landscape Right in the apps general settings. I want the app to be displayed in landscape on the iPad and on the external monitor. When I run the app in iOS7 the external monitors view controller is displayed correctly in landscape orientation, but when run under iOS 8 the external monitor's view controller is rotated 90 degrees counterclockwise, into portrait orientation.
How do I force the external monitor to the correct landscape orientation? What has changed between iOS 7 and 8 to cause this behavior?
I've had a similar issue with a landscape-only iPad app that supports airplay. On the iPad screen, everything was working fine, but on the external display, starting # iOS 8.0, orientation issues started happening. I tried many things, what ended up helping was these two fixes:
On the shouldAutorotate method of your ViewController, return NO.
Implement the application:supportedInterfaceOrientationsForWindow: method:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)_window
{
if ([UIScreen mainScreen] == _window.screen || !_window)
{
return UIInterfaceOrientationMaskAll;
}
else
{
return UIInterfaceOrientationMaskPortrait;
}
}
The second part of the fix may require some changes on your side, since you're not using AirPlay, but I hope it can help lead you to the right solution. Good Luck!

Universal app orientation issue

My app was originally created for iPad, in Landscape orientation. Now I've to make it compatible with iPhone.
Converting Storyboard from iPhone to iPad
I followed this thread to copy my storyboard and define it for iPhone. In the project settings, I defined the new story board for iPhone, in Portrait mode. In the new storyboard, I changed every viewController to set in Portrait mode.
When I launch the App on iPhone (simulator or device) It's still in landscape mode but with the changes (moved fields, for exemple) I made in the new storyboard.
Did I forget something?
Thanks :)
This started happening with the new xCode for universal projects... go to your .plist file for the project and you will find a field for orientation for iPad (1 item) and orientation for iPhone (4 items), expand the iphone one and remove the rows containing orientation you don't want. Save, clean, and build.
Don't search anymore, i found the solution.
In the app I've to access to the Camera Roll.
On the iPad, if I access it in landscape mode, the Camera Roll opens in Portrait, and it's ugly and annoying for the user.
Then someone on Stack suggested to use a Category UIViewController+OrientationFix.h
Here is the code...
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
I had to modify it
NSString *deviceType = [UIDevice currentDevice].model;
NSLog(#"Device Type : %#", deviceType);
if([deviceType hasPrefix:#"iPad"])
{
return UIInterfaceOrientationMaskLandscape;
}
else
return UIInterfaceOrientationMaskAll;
The strange thing it that I didn't found it by searching "landscape" in all the projet, even by ignoring case.

How to make cocos2d v1.0.1 support Retina?

I have to work with a project made by another developer. This project uses cocos2d v1.0.1. And the problem is it doesn't support Retina display. When i go into [director enableRetinaDisplay:YES]; method i see that it returns NO on the line:
if (! [openGLView_ respondsToSelector:#selector(setContentScaleFactor:)])
return NO;
So the question is - is it possible somehow to make this version of cocos2d support Retina?
EDIT: I'm running it in iOS 6.1 simulator. Retina simulator.
! is negation operator. !condition evaluates to true if and only if condition is false.
return NO; line will only be executed if openGLView_ does not respond to setContentScaleFactor:.
UIView's contentScaleFactor property is available in iOS 4.0 and later. Checking for availability of the setter of this property is a way to check if device itself is capable of retina. If openGLView_ does not respond to setContentScaleFactor:, then this device doesn't have retina, and this is why CCDirector's enableRetinaDisplay returns NO.
If you are running your code on device and getting NO here, then this device doesn't have retina. If you are running it on simulator, make sure that it's simulating at least iOS 4.0. To get retina device simulator, select any of retina configurations in Hardware->Device menu.
Edit:
Is openGLView_ nil? In Objective C you can call any method on nil, and it will do nothing and return nil (zero, NULL, NO). You have to create an EAGLView and set it as CCDirector's OpenGL view before enabling retina display.

Launching app in landscape only mode

I've written an app that supports only landscape mode. For some reason, it is being very stubborn. It launches and runs great on the simulator, but when I go to launch it on my device, it will not launch or rotate to landscape mode at all. I'm running 5.1 on my iPad, and using Xcode 4.6.2. Here is everything I've tried after searching on this site for a solution:
Edited my -info.plist and deleted support for portrait mode in the supported orientation interface options
In the projects target, in the supported interface orientations I highlighted only landscape left and right
3 Added:
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
To my only ViewController file. It runs in landscape only on the simulator, but is being very difficult on my device. Does anyone have any ideas?
Check this tech note, it describes the opposite of your problem but the resolution is the same.

Universal app not rotating on iPad but does on iPhone

I have just completed building a universal app which rotates perfectly on my iPhone, but on the iPad it just stands still.
Similar to this question, but that does not solve my issue.
The supported interface orientations are all set to allow rotation and I have even set this in my app delegate:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
Still the iPhone rotates fine, but the iPad won't move from portrait.
What could cause this, or rather how can I fix it?
[UPDATE]
The switch on the side is not on lock.
The orientations in the PList are set correctly.
The Project settings (where you select it via buttons) are set correctly.
#adam-s was right, except with Xcode 7.x there is no button below the "devices" selector.
With Xcode 7, you need to change "Universal" to "iPad" whereby the orientation selectors change to reflect iPad-only settings. Then you can change the selector back to "Universal".
Confusing!
Don't forget to change the rotation settings for the target for both iPhone and iPad - note that there's an iPad button to the right of the iPhone one (which some people, such as myself, might miss at first glance):
I fixed this by adding this piece of code to every ViewController of mine:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
It seems like this question's answer was correct after all. I just thought it wasn't since I checked through all the ViewControllers and found nothing restricting it from turning.

Resources