Quantcast
Viewing all articles
Browse latest Browse all 8068

Window is not well displayed after closing it and reopening it

Hello guys,

When I create a window and then opens it for the first time, it is well displayed. But when I close it and then open it for the second time (without recreating it with new), the window's not well displayed. It is like the view inside was shifted to the left top corner.

Here is how I create my window:

var containerWindow = Ti.UI.createWindow({
    title: 'Log in'
});
 
var view = Ti.UI.createView({
    backgroundColor: '#fff'
});
 
//Create the field for email login
var loginField = Ti.UI.createTextField({
    color: '#000',
    font: {
        fontSize: 20
    },
    width: Ti.UI.FILL,
    height: 50,
    top: 0,
    paddingLeft: 5,
    paddingRight: 5,
    autocorrect: false,
    hintText: 'Email'
    returnKeyType: Ti.UI.RETURNKEY_DONE,   
    autocapitalization: Ti.UI.TEXT_AUTOCAPITALIZATION_NONE,
    keyboardType: Ti.UI.KEYBOARD_EMAIL
});
 
var separator = Ti.UI.createView({
    width: Ti.UI.FILL,
    height: 1,
    backgroundColor: '#ccc',
    top: 50
});
 
var separator2 = Ti.UI.createView({
    width: Ti.UI.FILL,
    height: 1,
    backgroundColor: '#ccc',
    top: 101
});
 
//Create the field for password
var passwordField = Ti.UI.createTextField({
    color: '#000',
    font: {
        fontSize: 20
    },
    width: Ti.UI.FILL,
    height: 50,
    top: 51,
    paddingLeft: 5,
    paddingRight: 5,
    autocorrect: false,
    hintText: 'Password',
    returnKeyType: Ti.UI.RETURNKEY_DONE,   
    autocapitalization: Ti.UI.TEXT_AUTOCAPITALIZATION_NONE,
    passwordMask: true
});
 
//Create the login button
var loginButton = Ti.UI.createButton({
    title: 'Log in',
    font: {
        fontSize: 20
    },
    color: '#eee',
    top: 120,
    left: 10,
    right: 10,
    height: 50,
    backgroundColor: '#333',
    borderRadius: 5,
    backgroundDisabledColor: '#999'
});
 
//Add login event to the login button
loginButton.addEventListener("click", function() {
    loginController.login(loginField.value, passwordField.value);
});
 
view.add(loginField);
view.add(separator);
view.add(passwordField);
view.add(separator2);
view.add(loginButton);
 
containerWindow.add(view);
 
var navGroup = Ti.UI.iOS.createNavigationWindow({
    window: containerWindow
});
 
navGroup.setLoginButtonEnabled = function(enable) {
    if(enable)
        loginButton.setBackgroundColor('#333');
    else
        loginButton.setBackgroundColor('#999');
    loginButton.enabled = enable;
};
 
return navGroup;
As you can see, it is a basic login window with two fields (email and password) and a submit button. You can find here a screenshot of what happens after closing and reopening this navigation group: http://s22.postimg.org/qu9wd1hvl/Capture_d_cran_du_Simulateur_i_OS_12_juin_2014_0.png

This code was executed on iPhone.

Any ideas ?

Thanks

Titanium version: 3.2.3, Device: iOS simulator, Platform: iOS 7.1


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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