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...
Related
I applied SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]); to my second page of application when I click on button to go new screen where I set portrait orientation my application firstly show in portrait orientation and change its orientation for 1 second to landscape and after 1 second it set back to portrait. I am calling SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown]); in build function for each class.
Do not change orientation on different screen. where you need to change the orientation just put your screen into rotated box and rotate it to change orientation by quarterTurns: 2,. Rotatedbox
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
I've been working on this for days and can't crack it. The sequence of events is:
In landscape (let's just say right), the user hits an "edit" button.
A portrait only modal interface slides in. Its shouldAutorotateToInterfaceOrientation returns yes only for portrait.
The device becomes convinced it is in portrait mode.
Problem 1: If the user dismisses the interface without having actually rotated to portrait mode, the device reports that is in landscape right orientation (which it is), but the interface is laid out in portrait orientation.
Problem 2: If the user rotates to portrait, the interface does not get laid out again.
Problem 3: (And this one is weird) Rotating back to the same landscape orientation (right) where the edit button was pressed causes the status bar to return to landscape, but nothing else changes. All my stuff remains laid out in portrait mode. Rotating to the other (left) landscape orientation works perfect.
I need some way to force the layout engine to redo the layout for the orientation the device is actually in.
UIView - layoutSubviews, - setNeedsLayout, and -layoutIfNeeded don't have any effect.
Thanks for any help.
Do what iBooks (2.x) does and force the interface orientation to portrait with
+ (void)attemptRotationToDeviceOrientation. This way, you nip the problem in the bud at step one.
I want to notify users to take photos only in landscape mode.
I got idea to put some overlay on camera view and if iPhone is in portrait mode to put some label with text "Use landscape mode instead of portrait".
Is it posible? Do you have some advice how to make this posible?
You can have Text (label) on your overlay form (with the note). In the UIImagePickerController delegate check for orientation using , UIInterfaceOrientationIsLandscape and unhide (hide) the text.
I prefer displaying the text through out (irrespective of orientation) to the user for better user experience.
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.