TiMVC and window open with FLIP animation

You must Login before you can answer or comment on any questions.

Hi, somebody is using TiMVC to develop apps ??

I use this, but I try to open windows with flip method, but... when I want to open a new window with the simple way (navigation group) not works... the flip window open over the navigation group... and the request executed... but behind this flip window... somebody knows how I can fix it please ??

I made some changes to the TiMVC... I want to share this...

Thanks.

7 Answers

Here is the example of the code and the modifications to TiMVC, https://www.dropbox.com/s/crkie3de8ee4mg6/TiMVC_modified.zip

create a empty project en titanium and replace the resources directory with the content of the zip file, run on iphone simulator, and see the problem... the window open with flip animation... but... when I try open as normal window with navigationgroup not works... the window is open (i see the log in titanium) but in the simulator nothing happends... see please...

thanks.

In the /core/timvc.js file locate the this.openWindow function:

/* warning: this is sample code that is ruffed out, not tested, use at own risk! */
 
this.openWindow = function(window){
    window._parent = self.window;
 
    if(self.iPhone){
        var tmpView = Ti.UI.createView({});
        self.window.animate({transition:Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT,view:tmpView},function(e){
            self.window.navGroup.open(window,{animated:false});
            logoView.hide();
        });
        return;
    }
 
    //else android
    window.open();
}
Cheers!

— answered 12 months ago by Dan Boorn
answer permalink
2 Comments
  • swap logoVIew.hide() with tmpView.hide(); -- sorry about the typo

    — commented 12 months ago by Dan Boorn

  • Uhum.... I see... but... how I can use two both open types... FLIP and the normal ??

    — commented 12 months ago by Javier Rubio

If you want to specify the animation you could always update the TiMVC.loadRoute function with an optional animation parameter.

this.loadRoute = function(title,route,data,animation){
        var window = Titanium.UI.createWindow({
            "title":title,url: 'app.js',
            "route":route,
            request:JSON.stringify(data),
            navBarHidden:false
        });
 
        self.openWindow(window,animation);
    }
Then update the TiMVC.openWindow to accept an optional parameter.
this.openWindow = function(window,animation){
    window._parent = self.window;
 
    if(self.iPhone){
        var tmpView = Ti.UI.createView({});
 
    if(!animation){//open iphone with no special animation
        self.window.navGroup.open(window,{animated:true});
        return;
    }
    //animation was supplied, open iphone with animation constant
        self.window.animate({transition:animation,view:tmpView},function(e){
            self.window.navGroup.open(window,{animated:false});
            tmpView.hide();
        });
        return;
    }
 
    //else android
    window.open();
}
Now the TiMVC.loadRoute function can take an optional animate parameter
//without animation
self.App.loadRoute('Window Title','controller/action',{data:'hi'});
 
//with animation
self.App.loadRoute('Window Title','controller/action',{data:'hi'},Ti.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT);
That's all for now on this question. If you found this reply to answer your question please remember to select the response as the answer to better the community search results.

— answered 12 months ago by Dan Boorn
answer permalink
1 Comment
  • Hi, thanks for your reply... but not works correctly... because when the FLIP end... show the same windows for a few second... and later show the new window... the effect is not correctly :(

    I try diferent ways but not works :(

    — commented 12 months ago by Javier Rubio

Hi, thanks for your reply... but not works correctly... because when the FLIP end... show the same window for a few second... and after animation flip end show the new window... the effect is not correctly :( I try diferent ways but not works :(

— answered 12 months ago by Javier Rubio
answer permalink
2 Comments
  • Please add a background color or background image to the "tmpView".

    — commented 12 months ago by Dan Boorn

  • Sorry... I dont see your comment... I go to check this nigth, thank you :)

    — commented 11 months ago by Javier Rubio

Hi again... I try the to add the background to tmpView, but is not the expected result... because... if you see the original FLIP animation to open windows you can see a preview of next window during the flip... in this case... I see only a background color of tmpView and later the content of next window... and the result are not good.

I try to get a screenshot of next window with window.toImage(), but not works... maybe because the controls are not render :(

Your Answer

Think you can help? Login to answer this question!