News for hackers. Stuff that matters.
Re:Development with the iPhone SDK - Initial Observations by InkweaverReview on Thursday June 25, 2009 @08:59AM (#673566)
You are correct.

Safari does indeed rotate, but other applications such as Photo Album, etc don't. And it doesn't work on other Apple sample code programs either. Safari and Contacts seem to be the only two apps that rotate.

Perhaps I just need to add the right code to my apps to make them rotate, but even the sample code applications from Apple don't rotate.

I'm still looking into this issue. There has to be something that I'm missing.

Re:Development with the iPhone SDK - Initial Observations by allenbrunson on Thursday June 25, 2009 @09:15AM (#673575)
as for "photo album:" are you sure that app rotates? My guess is that it doesn't, so obviously it won't on the simulator. Not every app rotates, remember. Until very recently, the only one of Apple's apps that did is Safari.

I have gotten my own apps to rotate in the simulator just fine. You have to make that decision at the view controller level. Investigate the UIViewController method shouldAutorotateToInterfaceOrientation:

Re:Development with the iPhone SDK - Initial Observations by ROFISH on Thursday June 25, 2009 @09:37AM (#673596)
In addition, there's a Info.plist key/value, UIInterfaceOrientation with the value UIInterfaceOrientationLandscapeRight or UIInterfaceOrientationLandscapeLeft, that lets you set the default rotation level and the simulator will start the app in the correct rotation.

EDIT: Also the autorotation only works on ViewControllers. If you only have Views without ViewControllers, (such as the default OpenGL app from the wizard) they will not rotate.

Re:Development with the iPhone SDK - Initial Observations by InkweaverReview on Thursday June 25, 2009 @11:09AM (#673765)
Would I have to set up two views within Interface Builder, one for landscape and one for portrait, or do I use the one single view and rotate it using code?
Re:Development with the iPhone SDK - Initial Observations by allenbrunson on Thursday June 25, 2009 @11:26AM (#673806)
you just use one view. implement that view controller method i mentioned, and always return TRUE. you must do this for every view in your app, if you want them to all work in landscape modes.

that's all you have to do, as far as the iphone is concerned. of course you'll have to draw the view contents differently, when you're in landscape mode.

Re:Development with the iPhone SDK - Initial Observations by InkweaverReview on Thursday June 25, 2009 @11:11AM (#673769)
I'm going to look through the Apple sample code and see if I can find an example that changes orientation properly.

So far none of the sample code apps that I have found rotate. Once I find one that does I'll be able to check the code and see how it is done.

Re:Development with the iPhone SDK - Initial Observations by gcheong on Thursday June 25, 2009 @10:54AM (#673731)
The Photo Album app does indeed rotate in the simulator, but only when you are viewing photos. The list of photo albums does not re-orient when rotated. This is how it works on actual hardware as well. Are you seeing something different?

As an aside,in the 3.0 version of the simulator there is now an option for sending a shake gesture but in the one app I have that responds to shakes it didn't work no matter how low I set the threshold.

Edit:looking at the shake gesture it seems that the method accelerometer:accelerometer didAccelerate does not get called (which is the method my app is using to detect shakes) when you send a shake gesture to the simulator so I'm not sure what the shake gesture actually does in 3.0.

Re:Development with the iPhone SDK - Initial Observations by rob_rasmussen on Thursday June 25, 2009 @12:12PM (#673906)
There's a new api for shake gestures in 3.0, your firstResponder needs to implement motion[Began|Cancelled|Ended]:withEvent. Works fine in the simulator.
Re:Development with the iPhone SDK - Initial Observations by hboon on Thursday June 25, 2009 @11:37AM (#673829)
Apps don't just rotate. You need to configure and most importantly code it so that they rotate. For example, notice that when Safari rotates, the navigation bar and toolbar height shrinks by half. That is done programmatically. It's not as easy as just setting a flag and the contents will rotate magically.