Hi Sean,
Can you share the code to make the webview rotate or provide some pointers?
I'm having some issues getting it to work.
Following is my code. However, here the didRotateFromInterfaceOrientation
method is not even being called when I rotate the phone in the iPhone
Simulator.
===================================================
#import "WebViewTestAppDelegate.h"
@implementation WebViewTestAppDelegate
@synthesize window;
@synthesize webView;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
webView.scalesPageToFit = YES;
webView.autoresizesSubviews = YES;
webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleWidth);
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[
NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO
]]];
[window makeKeyAndVisible];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation
)fromInterfaceOrientation
{
if(fromInterfaceOrientation == UIInterfaceOrientationPortrait){
NSString* result = [webView stringByEvaluatingJavaScriptFromString:
@"rotate(0)"];
//NSString a = *result;
NSLog(result);
}
else{
[webView stringByEvaluatingJavaScriptFromString:@"rotate(1)"];
}
//[self.webView sizeToFit];
//CGRect curBounds = [[UIScreen mainScreen] bounds];
//[self.webView setBounds:self.origViewRectangle];
//[[UIScreen mainScreen] bounds]]
//NSLog(@"orienting");
}
-
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end
===================================================
Thanks
Srinivas
On Tue, Oct 7, 2008 at 2:53 PM, Sean Gilligan <[EMAIL PROTECTED]> wrote:
>
> Srinivas wrote:
> > Have you tried using the UIWebView instead?
>
> Yes.
>
> > Also, have you figured out
> > how to make the UIWebView rotate in landscape mode?
>
>
> Yes.
>
> > Finally, does the
> > UIWebView fire the onorientationchange event when the orientation is
> > changed?
> >
>
> I don't think so, because the orientation never changes. But I haven't
> explicitly checked to see if the event fires.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---