Change origin in iPad landscape - ios

In my iPad app I set the supported interface orientations only to both landscape modes.
I have a UIView with the background color set to red and I initialise it with frame x:0 y:706 w:1024 h:60.
The red UIView doesn't appear where I want. The origin will be in the TOP-RIGHT corner (as if the iPad is still in portrait orientation mode), even if the iPad simulator starts in landscape mode. I want the origin to change to the TOP-LEFT corner when in landscape mode.
How can I do this? I have to mention that I'm new to working with different landscape modes.

Line #iPhoneDeveloper has already said It starts in Portait mode and then rotate to Landscape.
you can set coordinates like it is portrait and set autoresizingMask of your view, so your view will be resized and placed for landscape
or
you can override the following method in your view controller
- (void)viewDidLayoutSubviews
and set the frames of your subviews.
The method get called after all rotations.

Whenever iOS app starts, it default orientation stays portrait if you have setup both landscape orientations. You can show your UIView in top-right corner by transforming it.
see here Rotate UIView iPhone

A good way to know the device orientation is to check the statusbar orientation:
if (UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation))...
this way you can put your button in the right spot.

Related

iOS Autolayout - How to have one sticky subview when rotating (like Native Camera App)?

I am creating a custom camera and want to lock the camera controls to the bottom of the phone at all orientations
i.e. Portrait Orientation has control toolbar at bottom, Landscape Orientation has control toolbar on the left
I have been playing around with constraints and setting them for certain width/height aspects but it always rotates.
Any suggestions?
Portrait:
Landscape:
So I ended up locking the view to portrait orientation, then just transforming the text (I think this is how apple does it).
See this answer for transforming text: Objective C: How can you rotate text for UIButton and UILabel?

animated UIView in portrait mode is not consistent in landscape on ios

i am developing an application using autolayout in ios 7. i am moving a label from the top to the middle of the view controller using [UIView commitAnimation] in the portrait mode. the label moves to the middle of the screen.
When i change the device orientation to landscape after animation is over, the label again moves back to the top instead of in the middle of the screen.
how to maintain the animation in both portrait and landscape mode ?
When using autolayout viewDidLayoutSubviews gets called everytime when UI changes. This gets called when your device is rotated from portrait to landscape and sets the position of the label again to the previous. Assuming you have designed your layout with IB. You have to change the position of the label accordingly in viewDidLayoutSubviews than it will work perfectly as expected.

iPad Camera OverlayView Orientation issue

My application is always run in Landscape mode only. I have add four custom buttons on overlay view dynamically. I want to change the position of buttons when orientation change in landscape and portrait mode.How to position my Camera Overlay View buttons in a different location when my device orientation will changing?
Please help me to fix my problem. Thanks.
I have the same problem. It's not that we're not receiving the notifications. The problem is that the camera overlay view doesn't resize itself to fit the new orientation. For example, the view will rotate when going from landscape to portrait but the view still has a landscape aspect ratio, i.e., the view is wider than it is high.

Changing from landscape right directly to landscape left

When I change directly from landscape right to landscape left there is a bug.
I have a web view and image view. In each state I have declared specific width height and position. When I am in portrait mode I have specific coordinates for the views. I also have set them for the landscape modes. When I change quickly from landscape left to landscape right all the proportions gets messed up!
I need to have access to the state when my application is in landscape right mode and directly i rotate to landscape left. i need to access it to do modifications, and if i can't how can i then force my application to pass through the portrait mode before going to the other landscape mode, Ex:
Landscape right -> landscape left will take place as follows Landscape right -> Portrait -> landscape left.
Because if i rotate it directly from right to left i will have a bug in my software so i need to fix it.
Note that i am using a tab bar controller and i have successfully subclassed it and everything is ok.
The problem here was with my handling of the orientation change, i should have from the beginning used :
if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
This handed me the option to control each state. Hope this helps a future person

Automatically detect image when orientation change

When I change mode of view then uiview don't show same image in portrait mode which is landscape mode. so how implement it? I required same image view in both mode. if image1.jpg is in portrait mode then same image will shown in landscape mode when orientation change.
Example;
NOte: here i have done with View but u have to do with UIImageview;
select ur UIImageview in IB then see autoresizing
then set like below in the autoresizing arrow marks.note dim arrow and dark arrow marks

Resources