Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-11-2011, 07:08 PM   #1 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 2
Ctak is on a distinguished road
Default Orientation change help

Hi, I'm pretty new to ipad/iphone development so bear with me.

I have a webView that I want to rotate and resize itself to take up the whole screen when I flip the ipad. I have the WebView's Size settings set appropriately in IB, however when I flip the Ipad the formatting gets thrown off. Right now I'm trying to resize the webView by this code:

Code:
- (BOOL)shoudlAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{

if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
   webView1.frame = CGRectMake(0, 0, 1024, 768);
}

Return YES;
}
This causes the sizing of the webView to be even worse than it was originally. Any ideas as to why this is?

Thanks in advance!!
Ctak is offline   Reply With Quote
Old 05-11-2011, 07:43 PM   #2 (permalink)
.38 special tucked
 
Join Date: Apr 2009
Location: Brooklyn, NY
Posts: 133
mr-sk is on a distinguished road
Default

If the UIWebView is a subview of a View Controller, the view controller will support auto-rotation so you should be able to tell the UIWebView (and all subviews) to auto-rotate.

Make sure you have that option selected for the parent view in IB (checkbox in Attributes -> Autoresize subviews), also I think your method can be just:

Code:
- (BOOL)shoudlAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{

if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{ return YES; }
}
I really don't think you need to work with the frame. The problem if you start messing with the frame is you probably need to manually rotate as well, something like

Code:
 CGAffineTransform transform = CGAffineTransformMakeRotation(90 / 180.0 * M_PI);
webView1.view.transform = transform;
mr-sk is offline   Reply With Quote
Old 05-12-2011, 12:52 PM   #3 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 2
Ctak is on a distinguished road
Default

The UIWebView is a subView of a scrollView which is the subView of the View Controller. Does that change anything? both the scrollView and the main ViewController have the autosize subViews option selected
Ctak is offline   Reply With Quote
Reply

Bookmarks

Tags
frame, interface, ipad, orientation, webview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 364
7 members and 357 guests
doffing81, dre, iOS.Lover, Kirkout, MikaelBartlett, oztemel, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:02 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0