Dilemma Apps wrote:Sorry it doesn't do anything for native controls.
Doh, I was so hoping I was just missing something and it did work.
Dilemma Apps wrote:Sorry it doesn't do anything for native controls.
HughJohnson wrote:rue wrote:... the innerWidth doesn't seem to get updated until after the 1st pageDidRotate() function execution.
Yeah I had the same problem but it fires the page did rotate function when the app starts in landscape, so it fixes it correctly. Is this not the case for you? I only tried on iPad2 so could be different for you.
function pageDidRotate()
{
setTimeout("modifyElements()",100);
}
function pageWillRotate(degree) {
webView.init(0,0,window.innerWidth,window.innerHeight);
}
function pageDidRotate(degree) {
setTimeout(modifyElements,100);
webView.init(0,0,window.innerWidth,window.innerHeight);
}
function modifyElements()
{
// Do something...
}
setTimeout("modifyElements()",100);
function pageWillRotate(degree) {
setTimeout("initWeb()",500);
}
function pageDidRotate(degree) {
setTimeout("initWeb()",500);
}
function initWeb()
{
webView.init(0,0,window.innerWidth,window.innerHeight);
}
<script type="text/javascript">
function NKIsPageSupportsAutoOrientation()
{
return "yes";
}
var w = new NKWebView();
w.init(0,20,window.innerWidth,window.innerHeight);
w.loadURL("http://nimblekit.com/");
w.setScalesToFit("yes");
w.show();
function reInitWeb()
{
NKLog ("WIDTH: " + window.innerWidth);
w.init(0,20,window.innerWidth,window.innerHeight);
}
function onPageShown()
{
reInitWeb();
}
function pageDidRotate(degree) {
NKLog ("!");
setTimeout("reInitWeb()",500);
}
var navController = new NKNavigationController();
navController.setTitle("NavCon");
var nkb = new NKButton();
nkb.init(0,0,100,20,"pageTwo()");
nkb.setTitle("Page 2");
nkb.show();
modal = new NKModalWindow();
var nkt = new NKTextField();
function pageTwo()
{
navController.gotoPage("page2.html");
}
</script>
function pageWillRotate(degree) {
webView.init(0,0,window.innerWidth,window.innerHeight);
}
function pageDidRotate(degree) {
webView.init(0,0,window.innerWidth,window.innerHeight);
}
function reInitWeb() {
webView.init(0,0,window.innerWidth,window.innerHeight);
}
function onPageShown() {
reInitWeb();
}
Users browsing this forum: No registered users and 2 guests