3 ms·
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 eit
by InkweaverReview 17y ago
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.
- allenbrunson 17y agoas 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:
- ROFISH 17y agoIn 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.
- InkweaverReview 17y agoWould 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?
- allenbrunson 17y agoyou 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.
- InkweaverReview 17y agoI'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.
- gcheong 17y agoThe 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.
- rob_rasmussen 17y agoThere'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.
- hboon 17y agoApps 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.