I want to design an application by using Interface Builder, in Landscape mode. I don't know how to put the controls suitable to the Landscape mode. All I know I m rotating my UIView by using self.transform. I am new in it. So can anyone help me.
Not sure if this is answering your question but you can rotate the views in IB to show in landscape mode by click on the arrow in the top right corner
See the image
IB landscape
I realize this is a bit old, but in Xcode4+ I can't see any rotation arrows. So instead, open your .xib > go to Simulated Metrics > Orientation > Landscape. Like this:
If you can't see the Simulated Metrics option, make sure your view is selected in the object hierarchy:
Short answer is (as far as I know) that there is no easy way to do it currently:
What's the best way to handle landscape/portrait differences in IB?
Related
I have a problem with my iOS application ...
This is what it looks like in portrait mode, pretty normal, nothing bad I could say.
This is what it looks like in landscape mode.
The view beneath the segmented control overgrows, covering the segmented control.
I tried to change the settings in the size inspector and the best thing I could do is this:
Still not what I wanted (now white stripe beneath the segmented control covers the view, and I still don't know where it came from).
I would really appreciate if someone could help me make the landscape view similar to the portrait one, regarding the segmented control - > view thing.
you will have to use autosizing ...
tutorial for autosizing can be found here :
http://www.edumobile.org/iphone/iphone-beginner-tutorials/how-to-use-autorotation-and-autosizing-in-iphone/
I would like to know what is the best way to do what iPhone calculator does as far as switching view from portrait to landscape. To me it looks that the portrait UI is in a view that goes directly (with resizing) into a subview on the right side of the landscape view. And on the left side of the landscape subview there are more calculator buttons added. If this is a reasonable assumption of what is going on, I would like to know how to rotate the portrait xib file to become the right side of a subview in the landscape and furthermore add more stuff to the left side subview of landscape UI? Do I need a second xib file? Or do I rotate one xib file and add stuff in the code to the left subview?
Before going to tell you in detail, i think this answer may help you, if not feel free to give the comment.
I am writing a game in the landscape mode. In *.plist I've set the "Initial interface orientation" option to "Landscape (left home button)". In Interface Builder my form seems good, with 2 labels are on the left and bottom.
But when I launch the app in simulator or in iphone that looks like the following
http://www.glowfoto.com/static_image/07-102041L/8907/png/09/2010/img4/glowfoto
Labels are on the top and rotated. Anyone knows what I am doing wrong and how to solve this?
I think your view controller's shouldAutorotateToOrientation method is not returning YES to landscape but to portrait orientations. But without code it's a guess in the wild.
there are already some questions on this topic. Unfortunately none of them helped me in anyway. So here is the thing. I am working on an app atm and it has one tabcontroller with two tabs, which contain multiple navigationcontroller on top of each other. Now in one tab at the top level navigation controller, I want to draw some graphics in landscape orientation.
Unfortunately using the shouldAutorotateToInterfaceOrientation method returning YES does not help in anyway.
Now I was wondering whether I could just hide the statusBar and the navigationBar and then draw my graphics so that it looks like it is landscape orientation. But then I also would like to add some labels. I am quite sure I also could turn those around 90 degrees. But this is probably not the right approach here. And I want to submit my app someday...
So now I was hoping someone knows whats the best approach here and how to realize it.
Thanks.
I found a solution somewhere else. The idea is to use the CGAffineTransform method. It allows you to transform the complete coordinate system of a uiview. The piece of code underneath rotatets it to landscape. Now when you draw, the drawing relates to the rotated coordinate systems and everything is drawn in landscape orientation.
CGAffineTransform transform=CGAffineTransformIdentity;
transform=CGAffineTransformRotate(transform, (90.0f*22.0f)/(180.0f*7.0f));
transform=CGAffineTransformTranslate(transform, 80, 80);
This does what I want. But anyway, if there are any other suggestions, please post them!
I have a view that supports landscape and portrait viewing, with the controls all moving around when you switch from one to the other. I'm currently doing this by setting the .center of each one of my controls when the user rotates the phone. The problem is that this is tedious, and requires a lot of code, and seems to defeat the purpose of using Interface Builder in the first place.
My question is: is there a way in Interface Builder for one view to support multiple looks (one for landscape one for portrait)? If not how do other people do this with IB? Do you set up 2 views?
Edit: Just to clarify my landscape and portrait views look different, I don't want a straight transform, I actually display the data differently in landscape mode
When necessary, I add UIView objects to the view in IB which I make hidden. Give it a nice background color so you can see it, and send it all the way to the background. Then use that view's frame when you need to set the frame of an object. If you have a lot of them, you might consider using UILabel instead, so you can give it a visible name in IB.
If you're worried about memory issues, just remove all these extra UIViews in ViewDidLoad and just store their frame values in member CGRects. This only works of course if you don't have any of the views auto-resize or reposition on rotate, which you probably shouldn't anyway, in this case. I do this for resizing/repositioning for any reason, not just when the screen rotates.
I'm not 100% sure if it's possible, but have you considered using different view controllers for landscape and portrait?
The AutoSize attributes of IBOutlet objects in the Size Inspector of IB (command 3) give some pretty nice options for auto-stretching and positioning of items. You can control L/R and T/B screen positions and relative width and height. You can't get full control of the layout, but most of the basic operations are there.
The only way one view can support multiple orientations in IB is to set the autosizing mask of components to either scale and/or anchor to edges. To design a totally different layout for each orientation you need to design a portrait and landscape view separately (each in its own XIB) and switch between them programatically.