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-14-2010, 05:38 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Alaska
Posts: 63
mriphoneman is on a distinguished road
Default iPad UIWebView not responding in an area

Hey all,

I've got a really weird problem that I need some help with.

The setup:
I have an iPad app with a UITabBar with multiple tabs. Each tab has one giant UIWebView.

My app adapts to all device orientations. I'm using the ViewWillAppear method to get the orientation before opening a tab, and then making sure all my elements fit well.

All of this works just fine.

The Procedure:
1. We start by opening the app in Portrait mode. The UITabBar automatically selects the first tab. Our UIWebView loads. Perfect.

2. Next we tilt the iPad into landscape mode. Our UIWebView rotates around, and everything looks right, but if I initiate a scroll gesture in the right 1/3rd section of the screen, it doesn't recognize the gesture. The screen is working fine--I can initiate the gesture on the left, and keep scrolling up and down while moving over to the right, and the scroll is still locked in. So the screen is fine.

To boil it down: The gesture recognition on the right 1/3rd portion of the screen doesn't work once the device is rotated into landscape mode.

Here is my code that I use when the device rotates:

Code:
//Detected a rotate into landscape. Move elements appropriately.
mainwebview.frame = CGRectMake(0, 44, 1024, 655);
navbar.frame = CGRectMake(0, 0, 1024, 44);
Any ideas? Thanks for the help!
mriphoneman is offline   Reply With Quote
Old 05-15-2010, 05:33 AM   #2 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
mr tickle is on a distinguished road
Default

1 thing

when you change to landscape, are the dimensions and orientation of the view that the webview exists in correctly

ie

is the view dimension being changed so it resizes to landscape, if not, thats your problem, no objects such as buttons, touch enabled views, and UIWEBVIEWS rect to touches if they are outside the view.

the view defines not only the holding object for all elements, but the constraints to which the objects are interactive

inside view > object is interactive and you can use it

outside view bounds > not interactive

1 way to do this, is set the background color of the view that holds the uiwebview to redColor

set the uiwebview so that it is semi transparent (it wont be interactive, but all you want to do is check the size of the view background)

you will notice that the view is still in portrait mode

this should help, i had this problem also, until i realised that it doesnt AUTO resize everything for you

Quote:
Originally Posted by mriphoneman View Post
Hey all,

I've got a really weird problem that I need some help with.

The setup:
I have an iPad app with a UITabBar with multiple tabs. Each tab has one giant UIWebView.

My app adapts to all device orientations. I'm using the ViewWillAppear method to get the orientation before opening a tab, and then making sure all my elements fit well.

All of this works just fine.

The Procedure:
1. We start by opening the app in Portrait mode. The UITabBar automatically selects the first tab. Our UIWebView loads. Perfect.

2. Next we tilt the iPad into landscape mode. Our UIWebView rotates around, and everything looks right, but if I initiate a scroll gesture in the right 1/3rd section of the screen, it doesn't recognize the gesture. The screen is working fine--I can initiate the gesture on the left, and keep scrolling up and down while moving over to the right, and the scroll is still locked in. So the screen is fine.

To boil it down: The gesture recognition on the right 1/3rd portion of the screen doesn't work once the device is rotated into landscape mode.

Here is my code that I use when the device rotates:

Code:
//Detected a rotate into landscape. Move elements appropriately.
mainwebview.frame = CGRectMake(0, 44, 1024, 655);
navbar.frame = CGRectMake(0, 0, 1024, 44);
Any ideas? Thanks for the help!
mr tickle is offline   Reply With Quote
Old 05-15-2010, 01:57 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2009
Location: Alaska
Posts: 63
mriphoneman is on a distinguished road
Default

Hey,

I made the view red, and it looks like that's the problem.

I've worked out some code, but it's not turning the view.

Code:
self.view.bounds = CGRectMake(0, 0, 1024, 768);
self.view.frame = CGRectMake(0, 0, 1024, 768);
Any thoughts?
mriphoneman is offline   Reply With Quote
Old 05-15-2010, 02:07 PM   #4 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
mr tickle is on a distinguished road
Default

where are you detecting the rotation, im thinking that you are doing it in the uiviewController, or, in a parent uiviewcontroller

say for example, the first uiviewcontroller you initialize and add its view to the main window, in there, you detect rotation, call a method, for example

[self.theWebViewController callLandscapeMode];

self.theWebViewController was initialized in the main UIViewController (the one which is added to the window

callLandscapeMode is inside theWebViewController, that method should do the following

-(void)callLandscapeMode
{
CGRect landscapeViewRect = CGRectMake(0,0,1024,768);
[self.view setFrame:landscapeViewRect];
// you can also change the webviews frame in here, keep it all toghether
// so things are not messy
}

generally, what i have found is, any controller that is initialized inside another UIViewController will not respond to rotation calls, the inbuilt methods, so i do it myself.

see if that works

track it with an NSLog

you can also track your current call to change the bounds with NSLog, and i bet it is not getting called.

window
> mainViewController (webviewcontroller is initialized here)
> mainView
>> theWebView (i cant detect rotation)


Quote:
Originally Posted by mriphoneman View Post
Hey,

I made the view red, and it looks like that's the problem.

I've worked out some code, but it's not turning the view.

Code:
self.view.bounds = CGRectMake(0, 0, 1024, 768);
self.view.frame = CGRectMake(0, 0, 1024, 768);
Any thoughts?
mr tickle is offline   Reply With Quote
Old 05-16-2010, 12:42 PM   #5 (permalink)
Tutorial Author
 
Join Date: Feb 2009
Posts: 223
mr tickle is on a distinguished road
Default

any luck on your problem
mr tickle is offline   Reply With Quote
Old 07-04-2010, 09:57 AM   #6 (permalink)
Luc
Registered Member
 
Join Date: Jul 2010
Posts: 4
Luc is on a distinguished road
Default

Quote:
Originally Posted by mr tickle View Post
1 thing

when you change to landscape, are the dimensions and orientation of the view that the webview exists in correctly

ie

is the view dimension being changed so it resizes to landscape, if not, thats your problem, no objects such as buttons, touch enabled views, and UIWEBVIEWS rect to touches if they are outside the view.

the view defines not only the holding object for all elements, but the constraints to which the objects are interactive

inside view > object is interactive and you can use it

outside view bounds > not interactive

1 way to do this, is set the background color of the view that holds the uiwebview to redColor

set the uiwebview so that it is semi transparent (it wont be interactive, but all you want to do is check the size of the view background)

you will notice that the view is still in portrait mode

this should help, i had this problem also, until i realised that it doesnt AUTO resize everything for you
Hello,

Do you think this is the same problem I'm facing (detailed in this thread: http://www.iphonedevsdk.com/forum/ip...rait-view.html) ?
In the tabbarcontroller I am using, in the willRotate method I remove the view from the superView and add another view instead (landscape view). But once the landscape view has "taken the control" I cannot move back to the protrait view (it seems that the methods are not triggered).
Thanks a lot,
Luc
Luc is offline   Reply With Quote
Reply

Bookmarks

Tags
ipad, uitabbar, uiwebview

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: 308
11 members and 297 guests
Abidullah, ajay123123, Fstuff, guusleijsten, HemiMG, jbro, n00b, newDev, pkIDSF, Sami Gh, Steven.C
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,113
Posts: 402,877
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

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