Using JQTouch inside Split View Controller - jqtouch

I have a split view controller-based iPad app that uses a Web View to load a jqTouch web app.
In portrait mode it looks fine, but in landscape mode (regardless of which orientation the app was launched in), the jqTouch page is wider than the viewport.
Is there a setting I can tweak (preferably via a call to stringByEvaluatingJavascriptFromString:) in the jqTouch view to get it to resize properly?

The problem boils down the fact that a UIWebView is not enough of a web browser for all of JQTouch's features to work as intended.
I ended up setting the height and width of the body to the height and width of the UIWebView thusly:
[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:#"$('body').width(%f);$('body').children('div').not('.floaty').height(%f)", self.webView.frame.size.width, self.webView.frame.size.height]];
This is basically due to the fact that onresize doesn't get triggered, nor does onorientationchange. There may be cleaner ways of handling this by directly triggering those events.

You might consider BeeDesk's fork:
http://labnote.beedesk.com/ipad-split-view-supports-on-an-jqtouchs-fork

Related

iOS transition between two html files on a uiwebview

I have one webview that fits fullscreen and loads an html file. Then another html file is loaded and I would like to apply transition between those files. Possible? Switch between two views that contains another webview is not an option due to any other reasons. Thank you.
You may insert a UIWebView inside a UIScrollView. Then when you have to load the new page, you create another UIWebView and its x will be the width of the current UIWebView, then addSubview the new UIWebView to the scrollview, and update the scrollview contentSize. Then call the method scrollRectToVisible:animated of scrollview to the frame of the new web view, this do the transition.
In addition, if you don't want to back to the previous page, you may destroy the previous UIWebview and reset the contentSize of the scrollview as it was initially.
How "another html file is loaded"? By events in the first webpage?
If you are writing the html pages you could use jQuery mobile transition?
See here
Even if you are not writing the html pages you might be able to inject javascript for this.

iOS - Force a UIWebView to load content?

I set the content of a UIWebView using loadHtmlString:. I don't add them to the UIView until they are need, but I need to know the max scroll height of each of them.
The problem is that UIWebView doesn't start loading it's data until it's added to a superView, and It's the delay of loading content that is causing this problem.
Question: Is it possible to force a UIWebView to load its content, without being added to a view?
You can add it to the view and set it's opacity to 0.01 to force the load. I've had to do this with MKMapView before.
I'd use hidden property of UIWebView - setting it to YES before view is added and clearing it to NO in webViewDidFinishLoad: should do the trick.
However, you comment to #logancautrell's answer is a bit unsettling - do you ever plan to get that many web views added to your views? I assume you know that, but just in case: depending on your possible HTML(5)/JavaScript/CSS code, you may observe severe performance hit even with a small number of web views for which iOS needs to allocate lots of resources.
If you plan to update your web views often, maybe you could benefit from UIWebView's stringByEvaluatingJavaScriptFromString: method? To some extent, the performance hit can be bearable, I think.
I suggest either pre-calculating the scroll heights somehow (not during web view load), or finding a way to display your UIViews without waiting for the scroll heights initially, and correct them later.

Can you make your entire application pinch-zoomable?

Is it possible/safe to make an UIKit based app zoomable globally? (The entire app view is pinch zoomable).
I think it similar with web page (html based app) zoom functionality inside UIWebview.
Yes, it is possible.
To achieve this, just add your UIView to a UIScrollView that covers the whole window.

displaying a smaller UIWebView as a form sheet

I'm trying to pop up a UIWebView on iPad with a web site that is specifically sized for the iPhone (320x480). I want the web view to be centered, and transition in using a zooming animation. Other apps have this functionality, but I can't seem to find out how to do it. I've tried various combinations of presentation & transition style, but no matter what I do, the web view takes up the entire screen and slides vertically to cover the screen. I've made the web view 320x480 in IB, and am using UIModalPresentationStyleFormSheet, which should make it at least slide up into the center of the screen using a small window, but that is not occurring.
anyone know what's wrong?
Are you setting the property of the parent UIViewController or the modal UIViewController? Because you should be setting the properties of the modal UIViewController before presenting the controller instead of the parent.
This might be no help at all because you're doing the right thing, but it was the first error I made when starting to use MVCs.
maybe any of the autosize property is set. just do one thing bind your webview with the code and through code try to set the frame. Hope it will work as it worked many times to me when i faced similar types of problem.
hAPPY cODING...

iPhone Drawing in Browser

Can I develop an application on web to draw something on iPhone? I guess not because when I draw in the browser it will be treated as "dragging" but I just want to double check for a solution out there.
Thanks.
Marcelo
I presume you mean to ask if is possible to draw into a UIWebView?
I don't think so. In UIWebView the page display view is embedded in a scroll view and scroll views trap all touches to determine if they can scroll. It's pretty much configured as read only.
You could in theory put a transparent view over the web view to trap the touches then send those to the the actual browser view. I haven't done it but it might possible.