0

I am working on an iPad app, which has a UIWebview, which in turn hosts an html5 document that is saved locally and is not downloaded from the internet. I am handling the rotation changed event in obj c and doing the relevant UI changes for native iOS, I have another guy working on the html5 and he says that he is handling that event in CSS, my question is: can an html5 document loading within a UIWebview in an iOS app know that a rotation occurred? or is the iOS layer supposed to alert ( or notify ) the HTML5 layer of that?

How do people handle this situation?

Thanks.

Huang
  • 1,355
  • 2
  • 11
  • 28

1 Answers1

0

One possibility, is to execute javascript functions from iOS.

So for instance, on your view controller's didRotateFromInterfaceOrientation method, you could in turn call stringByEvaluatingJavaScriptFromString on the UIWebView. This question talks about how to do that (Calling Javascript using UIWebView).

As far as the rotation and handling in CSS, here is a blog entry describing @media queries (https://mislav.net/2010/04/targeted-css/). I haven't tried the orientation queries, but I have used the other queries to target specific devices and screen types (i.e. retina).

Dave Powers
  • 2,051
  • 2
  • 30
  • 34
abellina
  • 1,016
  • 1
  • 11
  • 27