I am using Cocos2d and Xcode 4. My app currently displays the launch image in portrait mode, then switches to landscape so the image is on its side, then launches the app. How can I:
1. Make it run the launch image for a certain duration.
2. Make it display it in Landscape mode, not portrait.
Any Help is appreciated. Thanks!
Can't you just make your image in landscape and use that? Basically like what zeiteisen said.
Just open up gimp or photoshop and make a new image: 480w X 320h.
To make your launch image display in landscape mode, simply append -Landscape to its filename (e.g. change LaunchImage.png to LaunchImage-Landscape.png).
As for showing your launch image for a certain duration, you have two options: display a "launch image" view controller initially and dismiss it after the desired duration (allows you to fade the image out, etc.), or simply call sleep() in your app delegate's application:didFinishLaunchingWithOptions:. It's important to note that you have no control over how long the OS displays your launch image before control is passed to your app delegate—you need to take this into consideration.
Just rotate the Default.png in your favourite image editor like Photoshop.
I had a similar problem and fixed it by changing the view to landscape in Interface Builder. Mine is still animating though from the initial portrait orientation of the Window (not settable to landscape in IB).
In AppDelegate applicatio:didFinishLaunchingWithOptions there is a call to
[director_ pushScene: [IntroLayer scene]]. In there, it shamelessly loads the splash screen again and displays it rotated by 90 degrees:
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) {
background = [CCSprite spriteWithFile:#"Default.png"];
background.rotation = 90;
}
Removing this fixes the rotating splash screen problem.
Related
I created a custom camera overlay for the live screen camera view and have imported my own custom icons for the camera, flash and flip buttons. Everything looks good in portrait mode, but when I switch the live camera screen to landscape mode, the orientation of the camera stays in portrait mode and shows this in console,
"Error: CGAffineTransformInvert: singular matrix"
I tried using the auto resizing mask, also have tried setting two different frames for the icons in both portrait and landscape mode in didRotateFromInterfaceOrientation method. But none of these are working.
My question is, will the landscape orientation support only the default iPhone camera overlay view or will it also support the custom overlayview.
Here are the screenshots indicating the behaviour of the icons repositioning each other when switched from portrait to landscape mode. I want exactly like this in my custom overlay view.
Edit:
I've made the live screen of my custom camera overlay to change by using the UIDevice Orientation method. But right now, the frame is not resizing when i try to switch from the portrait to landscape mode. So, i just want the entire frame to resize in landscape mode. Also, in this piece of code, if i try to change the value of CAMERA_TRANSFORM_Y,
#define CAMERA_TRANSFORM_X 1
#define CAMERA_TRANSFORM_Y 1.234
self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
the size of the overlay view reduces both from the top and bottom margin. But, more size gets reduced from the bottom than from the top margin. I want the overlay size to change uniformly both from the top and from the bottom margin.
This is my sample code,
Sample project
Let me start off with saying that I am no expert in iOS Development or Objective-C.
I am making a app for a local charity(its a church) and they want it to support rotation.
The app work as expected if started in portrait mode, I can choose my new subview and the rotate it works perfectly.
However I need it to work so they can rotate at any time. The Main view(the one loaded on startup) already does this out of the box; but my subviews do not.
I have attached 3 screenshots below to try and explain what I mean.
This is how it looks in portrait mode:
In landscape:
and back to portrait it I started the app rotated:
If it helps I add the subview like this:
dailyPrayerView = [[DailyPrayerView alloc] initWithNibName:#"DailyPrayerView" bundle:nil];
[self.view addSubview:dailyPrayerView.view];
Does anybody have any ideas why this is?
Check the autoresizing mask in Interface Builder. It's on the sizes pane of the Utilities pane. You should be able to make it stretch to fit the screen, rather than staying at a constant size.
This is related to my previous thread, but opened a new one here as it involves Apple's own sample code.
Open the sample code and modify the app so it will display in landscape and add a textfield to the view.
Run the app and open the image picker, select an image and you will be returned to the previous screen in landscape as you would expect.
Now tap the text field and see the keyboard scroll into view....in portrait mode?
This happens on the iPad not the iPhone, what gives????
link text
I have found the answer on this forum :-)
"The keyboard will show up in the orientation of the statusbar, which doesn't always change with rotations for some reason. So if you want to display that view only in landscape set [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft; or whichever orientation you want to prefer in your viewWillAppear method."
Although why it does not do this on the iPhone ????
I have an app designed for iPhone that makes use of the UIImagePickerController.
The app run in landscape only up until the image picker comes into view in its default portrait.
Problem 1:
On the iPhone when I rotate the device to portrait to view the image library the image picker view seems to do a flip as if rotating from landscape to portrait?
Problem 2:
I get the dreaded warning Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations.
Problem 3.
on the iPad when selecting an image the image picker is dismissed and the view is back in landscape but ...... if I then do anything that requires alert view or the keyboard they appear as if the device is in portrait? This does not happen on the iPhone???
I know problem 2 is a long running issue but please can anyone help with problems 1 & 3?
Thanks
number 3 resolved :-)
"The keyboard will show up in the orientation of the statusbar, which doesn't always change with rotations for some reason. So if you want to display that view only in landscape set [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft; or whichever orientation you want to prefer in your viewWillAppear method."
When I open any form in my app in Portrait mode and tap on any textfield (keyboard pops up) and then change the device orientation to landscape, page is no longer scrollable to bottom most UI widgets. But if you open the same page directly in Landscape mode, it works fine
I think idea should be like:
1. Capture the change in device orientation
2. Change the frames of UI components as required
3. Redraw the screen
Please suggest.
You simply set adjust your frame for landscape mode.. U did not allocate memory just adjust frame only...