开发者

Using JQTouch inside Split View Controller

开发者 https://www.devze.com 2023-01-10 23:55 出处:网络
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 launc

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
0

精彩评论

暂无评论...
验证码 换一张
取 消