Wednesday, June 24, 2009

Nitty Gritties - (iPhone issues)

Well this part of the blog is dedicated to my fellow iPhone developers.
As the name nitty gritties suggests I'd be blogging about the small issues that are often not discussed elsewhere or very simply the problems faced by newbies.
This section is also the brainchild of a colleague. I'm just trying to implement and help.

Lets talk about Interface orientation in iphone.

I was bored with the plain tall look of my apps in the simulator.
I wanted to introduce my app in a horizontal way, like if you have an email app for example. It would make sense to open the view in a way that is easy for the user too especially with iPhone 3.0 OS that introduced a landscape keyboard.

I thought of trying it through code. Trust me IB is very good but if you wanna learn there are better ways.

What I did was:

1) I opened my info.plist which sits in the resources folder nice and pretty, there at the end of the properties click on the '+' button found at the right sde of every field.

2) Click on it to get a new property, and start typing Initial Interface Orientation, trust me the code sense will take charge you wont have to type the whole thing.

3) Now in the values for this new field type in right Interface orientation.
Go to the build and go. It wont work as of now because your app really wants to be shown in a landscape mode but is being prevented by the method Interface orientation in your view controller.

4) Un comment the method and type in Landscape right home only for the proper display.

Now hit build and go.
You will see your app coming out in a landscape mode.

That's it for now.
Keep the code neat and bug free. It helps ;-)


No comments:

Post a Comment