Simple enhancements to the Apps

If you have tried the tutorial below you will find that there are a couple of things missing in terms of what you would expect from a normal iPhone App.  Actually there is quite a bit missing but the two main things are the ability to use the pinch gesture to scale a page and  the rotate to landscape feature.

To get the pinch to work it is actually quite simple.  In the ViewController.xib file set the WebView as below so that the Scales page to fit  check box is ticked.

screen-shot-2010-01-18-at-195456

To get rotation working you need to go to your ViewController.m file and then scroll down to the commented out section that looks like this:

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

and edit it so that it looks like this:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
return YES;
}

Sorry that this adds another line of code but it is worth it.

Leave a comment

Your comment