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.
Related
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?
I have 2 views. A portrait detail view that when rotated to landscape, does a manual segue to a full screen photo viewer. The portrait detail view returns NO for shouldAutorotate and prefersStatusBarHidden.
When I rotate from portrait to landscape, just before the landscape view fades in, I can see the portrait view resize slightly as the status bar gets hidden and then the status bar moves from the top to the side.
The transition looks a bit ugly. I'd rather the status bar remains visible as the device is rotated to portrait, since it will get covered over by the landscape view anyway. Is it possible to do this?
I don't think this is possible.
The only way I see it working is if you do the rotation yourself and not with the device ability
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.
I created a split view controller application. I want to display my buttons and controls in landscape and portrait view differently(only the position).
When I change the orientation to landscape it shows the controls in portrait only. When I click on the cell in the tableview then it will show in correct position. What is the reason for that? Help me please.
I am a little confused about your question, but what I think you are trying to ask is how to change your view if the screen is in landscape or portrait orientation. Without seeing your code it is hard to tell you exactly how to do it, but the general idea (at least how I do it in my code) is that you want to split your code into two parts one that is in landscape orientation, and one that is in portrait orientation. You can tell the difference by seeing if the screen height is greater than the screen width.
I am developing an iPad GUI with 2 uitableview top and bottom, both occupying half the screen with a navigational controller. when i rotate the view, the table does up and hide behind the navigational controller. when launch it doesn't. it only happens when it rotates. Image 1 shows the table when launch. image 2 shows the columns missing when rotating to landscape. image 3 shows the column missing when shifted back to portrait. is it possible to code a fix position on the screen when portrait and landscape? meaning i set the position when detecting the iPad is in portrait, and landscape.
Override willAnimateRotationToInterfaceOrientation:duration: method in your main view controller, and resize your UITableViews by setting their frames.
See also:
http://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/frame
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/willRotateToInterfaceOrientation:duration: