Reputation: 765
i finished this tutorial: http://dblog.com.au/iphone-development/iphone-sdk-tutorial-build-your-very-own-web-browser/
and now i want to add a function for rotating the window but I cant find a solution which helps me...
hope someone can help me here... I was searching for hours and found some codes, but they all wont work for me.. maybe I make something wrong... would be nice if someone can tell me where to place the code in which file (please look at the tutorial)
thank you very much
Upvotes: 0
Views: 398
Reputation: 11145
In this tutorial the tutor is using a web view in main window, so in app delegate we don't have shouldAutorotateToInterfaceOrientation
function. What you have to do is create a new window base project and in the new project add new class of UIViewController type. In this new class add a web view from IB and in you app delegate import the new class, initialize it as
For example your new class name is FirstViewController then in app delegate.m
#import "FirstViewController"
then in applicationDidFinishLaunching
FirstViewController *fvc = [[FirstViewController alloc] init];
[window addSubView:fvc.view];
then in your FirstViewController remove comment from method shouldAutorotateToInterfaceOrientation
, because it is already there but just commented and also make sure that in shouldAutorotateToInterfaceOrientation
function there is return YES;
then you will be able to rotate a view.
Upvotes: 1
Reputation: 11713
Did you override the method shouldAutorotateToInterfaceOrientation
?
Example code for your controller:
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
// return (interfaceOrientation == UIInterfaceOrientationPortrait);
retrun YES; // to support all rotation
}
Upvotes: 0