Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (freezes)
Viewing all articles
Browse latest Browse all 6

Windows freeze in iPhone

$
0
0

I have very simple code. First login window is Displayed

app.js is ok. Displays the windows

//Login window
var login = Titanium.UI.createWindow({  
    title:"Banking application",   
    url:'second_time.js'  
});  
login.open();

Here is the problem. If I close the win (in the loginBtn event listener in the middle), the tab_view is displayed but the windows (or labels or any kind of view) inside the tabs in tab_view are automatically closed in iPhone, in Android is OK.

If I don't close the win (win.close()) the windows freezes. Once again in Android It's ok.

second_time.js -- If password matches display ../tab_view.js

//
//@author Dimov Daniel
//@content First Time Login process
//
 
//Include required login functions
Ti.include("functions.js");
 
//
// create base login UI
//
var win = Titanium.UI.currentWindow;
 
 
//
//Login interface
//
 
//Password field
var password = Titanium.UI.createTextField({
    color:'#336699',
    top:10,  
    left:10,  
    width:300,  
    height:40, 
    hintText:'Password',
    passwordMask:true,
    keyboardType:Titanium.UI.KEYBOARD_DEFAULT,
    returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(password);
 
 
var loginBtn = Titanium.UI.createButton({  
    title:'Login',  
    top:60,  
    width:90,  
    height:35,  
    borderRadius:1,  
    font:{fontFamily:'Arial',fontWeight:'bold',fontSize:14}  
});  
win.add(loginBtn); 
 
 
//Functions for first login
 
//When login button is pressed
loginBtn.addEventListener('click',function(e)  
{  
    //We have bouth password and retype
    if (password.value != '' )  
    {  
         if(check_password(password.value))
         {
 
            //Everythink is ok, continue to the app
                var windows = Titanium.UI.createWindow(
                    {  
                        title:'Bank Application',  
                        tabBarHidden:false,  
                        url:'../tab_view.js' 
                }); 
                //win.close();
                windows.open();
 
 
         }
         else//Password mismatch
         {
            alert("Password mistake");
         }
    }  
    else  
    {  
        alert("Password is required");  
    }  
});

tab_view.js

// create tab group
var tabGroup = Titanium.UI.createTabGroup();
 
 
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({  
    title:'Account',
    backgroundColor:'#fff',
    url:'login/second_time.js'
});
 
 
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:"Account",
    window:win1
});
 
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff',
    url:'login/first_time.js'
});
var tab2 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Tab 2',
    window:win2
});
 
//
//  add tabs
//
tabGroup.addTab(tab1);  
tabGroup.addTab(tab2);  
 
 
// open tab group
tabGroup.open();

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>