App Rotation with Tab Bar

1364
4
07-15-2010 12:12 PM
JeffPapirtis
New Contributor III
has anyone been able to get a tab bar based application to rotate to the device orientation. 

I have returned YES to rotate but nothing happens.

-(BOOL) shouldAutoRotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}

I have tried this in both iPhone & iPad within the simulator, and iPhone on device.  Regular apple templates react as expected, but ESRI templates do not. 

Any Ideas?
0 Kudos
4 Replies
HarikantJammi
New Contributor
IN case of a tab bar app, all the view controllers of the tab bar should override -

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES ;
}

once all view controllers are allowed to autorotate , then only tab bar will rotate.

One more way is subclass UITabBarController and then override its shouldAutoRotate function to YES.

Tell me if it works or not.

Regards,
Harikant Jammi
0 Kudos
FaisalSabri
New Contributor
It didn't work with me 😞 😞

I tried to rotate the device orientation

I have returned YES to rotate but nothing happens.

I have tried this in both iPhone & iPad within the simulator

and all view controllers are allowed to autorotate

when i show a view using the Following code  after clicking on the map (which is not rotated):

[self presentModalViewController:MySubView animated:YES];
 
[ShowDataView release];

and rotate the simulator , it rotate !! and when i go back to the tabBar the map show up unrotated

see attached image

Any Ideas ??
0 Kudos
JeffPapirtis
New Contributor III
I have found that it is easier to start with the apple template and then add dependencies for ArcGIS for iOS. 

I went through this exercise of trying to use the ESRI template and enable AutoRotate without any success.  I ended up comparing the apple template and ESRI template against eachother, and even after mimicking the apple template I was not able to produce the results that I needed (AutoRotate).

It was much easier and less frustrating to just build it using the apple template as a starting point. 

ESRI has a very good help section on adding dependencies to your project to allow for the use of ArcGIS for iOS SDK.
0 Kudos
MuratDzhusupov
New Contributor II
Try modify ...-Info.plist file in your Xcode project.

If you will modify it as source file, it can be like in my project

 <key>UISupportedInterfaceOrientations</key>
 <array>
  <string>UIInterfaceOrientationPortrait</string>
  <string>UIInterfaceOrientationPortraitUpsideDown</string>
  <string>UIInterfaceOrientationLandscapeLeft</string>
  <string>UIInterfaceOrientationLandscapeRight</string>
 </array>


If you will modify this plist file as XML property list (default variant), it can be like this screenshot
0 Kudos