Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Hide tabgroup on scroll

$
0
0

I am trying to implement the new iOS 7 feature you see on Safari, Facebook or even pinterest. When the user scrolls, the bottom tabgroup (or header) hides away seamlessly. This makes for a very pleasing content consumption experience. Once the user scrolls back up the tab comes back.

I am trying to implement that in appcelerator and facing some performance problems. I have the logic working to hide the tabgroup when the scroll occurs. However the experience is jerky. When the tabgroup hides away or shows up the actual scrolling speed is impacted. As if the animation operations momentarily pause the scroll operations. Wondering if anyone has a better way of doing this. Here is my code on this:

var startY = 0;
var endY = 0;
var tabHidden = false;
 
//collections is a tableview
$.collections.addEventListener("scroll", function(e){
    //Ti.API.info("SCROLL BEGIN");
    //Ti.API.info(e);
 
    if(e.contentOffset.y > startY)
    {
        // User scrolling down, hide the tab
        if(!tabHidden)
        {
            // My global alloy variable for the tabs, which can be accessed anywhere
            Alloy.Globals.homeTab.animate({bottom:-49,duration:250});
                tabHidden = true;           
        }
    }
    else
    {
        // User going up. show the tab
        if(tabHidden)
        {
            Alloy.Globals.homeTab.animate({bottom:0,duration:250});
            tabHidden = false;          
        }
    }
    // set the new Y
    endY = e.contentOffset.y;
});
 
$.collections.addEventListener("scrollend", function(e){
    //Ti.API.info("SCROLL END");
    //Ti.API.info(e);   
    endY = e.contentOffset.y;
    startY = endY;
});

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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