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.
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).
Related
I'm developing an hybrid app for iOS using ionic/cordova. This app implements some typical webrtc features such as video calls and file transfers between two peers.
For this purpose I'm using cordova-plugin-iosrtc which exposes all W3C WebRTC APIs.
While RTCPeerConnection, getUserMedia and other Javascript WebRTC APIs implementations are pretty good, otherwise the video element to which streams are attached is substituted by a native UIView layer (see Usage).
This way you can't completely control via JS the pseudo-video element (that is UIView). For example it's not possible to resize the video, position it, change all its CSS properties and so on. UIView size and position are set at initial value of HTML video element.
Is there a workaround or an alternative to this limitation (opened as an issue) of iosrtc cordova plugin?
Yes, the video element is not an actual HTML DOM element displays the video, however the library mimics the CSS of the video element to the best of its ability (for dimensions and positioning).
You can still manipulate the video element using JavaScript, but you must call an iosrtc method to update the UIView afterwards Using:
iosrtc.refreshVideos()
More information can be found here: https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/docs/iosrtc.md#iosrtcrefreshvideos
cordova plugin iosrtc is updated and fixed the issue according to https://github.com/eface2face/cordova-plugin-iosrtc/pull/179.
Update the plugin and it will solve the issue.
I'm moderately experienced with iOS, but I'm using UIWebView for the first time on this project.
I'm wondering, is there a way to monitor the line-by-line, internal operations of a UIWebView in Xcode? Maybe drop some NSLogs in there, or some breakpoints? The delegate methods cover the pre- and post-load stuff, but there doesn't seem to be any interface to actually track what the WebView itself does when it loads a page.
Specifically, I'd like to be able to track the app's behavior as each image from a webpage is downloaded and stored. I'm getting some weird errors around an image being unusable on iOS 7, but my PHP/JavaScript swears that everything is fine on its end, and the image seems fine on desktops and on iOS 6. I'm increasingly certain that the problem has to do with the WebView itself, (an answer to a related question seems to suggest it could be about WebKit calls on different threads), and I'd love to breakpoint my way through, or NSLog some key points or something, just to rule some stuff out.
Is anything like this possible? Or is UIWebView a private party that you can only hear about once it's over?
Does it break in Mobile Safari or only in your app?
You can point Safari's web inspector on OS X at Mobile Safari running in the iOS simulator or even on an iOS device (it has to be enabled in settings).
This will allow you to view all the HTTP headers and so on.
Another option is to use something like wireshark to monitor TCP traffic, but that's a lot more complicated.
http://webdesign.tutsplus.com/tutorials/workflow-tutorials/quick-tip-using-web-inspector-to-debug-mobile-safari/
Does video.js support Android WebView?
We use an Android app to put a tablet in Kiosk Mode in which our web app runs. However, webview video tag does not give us a image of the first frame, only the ugly widgets background.
A better question might be whether your WebView supports video.js. You need to configure the WebView to behave equivalently to a proper browser – HTML5 video definitely won't work without some tweaking. I've found this custom web view to work well (including with video.js):
https://code.google.com/p/html5webview/
i wanna to embed an animated logo in the application startup screen, this logo is already done in 2 formats of files SWF and Flash, my question is about how to embed these files directly in the application startup screen, such that the animated logo appears directly on the startup screen.
Appreciate your concern,
Thanks in advance
This is not possible. iOS does not support Flash.
Update: to follow up with a possible solution, since your Flash is just an animation, perhaps you can just render it to a video and use that instead?
First off, your start-up screen is a static image ("Default.png")... so you can't do animated stuff there.
Once your app fully starts up and the static image disappears, then you could have something animated.
In a practical sense, it can not be Flash or a SWF though (Flash files are SWF files, by the way). One can build Flash-based apps for iOS using Adobe AIR, but that's a full blown environment and IDE separate from Xcode.
It'd be smarter to do your start-up animation using CoreAnimation, HTML5 or some other fine animating framework (Unity, Cocos2d or whatever).
Or a separate video file (in which case the user has minimal interaction possibilities). But +1 to Darren for suggesting this answer faster than I could think of it.
If you are planning to publish your app on the AppStore, then what you are trying to do is Impossible !
Your best option is to create the animation you want using Core animation or you can simply convert that animation to a video and play it once your app is loaded.
While creating a website for iPad Mobile Safari, I have a few questions;
Does the orientation happen automatically or do we have to write code for that ?
What is the best approach in terms of CSS/JS..I mean create separate copy of the web CSS for iPad and just update for iPad specific. Also what about JS?
What is the best way to detect for iPad (CSS/JS) and how?
Any online references which specifically covers iPad Mobile Safari development will also be great.
Thank you.
The orientation happens automatically, but you can write code to intercept the event and do things.
I highly recommend using an existing JS library such as Sencha Touch to handle the UI for you; they automatically detect the client and will display the appropriate scale of the app.
I just added a few meta tags to my current project, based on this page - http://www.nczonline.net/blog/2010/04/06/ipad-web-development-tips/
It made a huge difference. The orientation media queries work great. I madea simple example by setting the body background colour different based on orientation.