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

icon based navigation menu and memory management

$
0
0

hello,

i make an icon based menu for ioS (Alloy): the first screen contains six icons that open new windows (e.g. profile, FAQs, Login). Navigation to 2nd and 3rd level windows are done with navigationWindows.

What does one need to take into account memorywise? in particular, how do i properly close the profile window when someone clicks the back button (LeftNavButton) in the profile? do i need to add an eventlistener that first removes ALL Views, labels, switches and nullifies them like this?

$.profile.remove();
$.profile = null;
i noticed that ViewProxy are still showing up in instruments while the VIEW is being deleted. Basically, i have the same problem like the excellent (unanswered) question here: http://stackoverflow.com/questions/23359545/appcelerator-titanium-view-proxy-memory-management

here is some good information on multi-level navigation that helped quite a bit: http://blog.foolprooflabs.com/2013/10/ios-multi-level-navigation-with-titanium-and-navigationwindow-appcelerator/

index.js

function openProfile(){
    var win = Alloy.createController("profile").getView();
$.navMenu.openWindow(win,{animated:false});
}
 
function openFAQs(){
    var faqNid = "6"; //editor FAQS
    var win = Alloy.createController("faqs", faqNid).getView();
$.navMenu.openWindow(win,{animated:true});
}
 
 
Alloy.Globals.navMenu = $.navMenu; //set a global reference to the navmenu that we will use in child windows    
 
$.navMenu.open();
profile.xml
<Window id="profileWin" class="container" backgroundColor="green">
        <RightNavButton><Button id="saveButton" onClick="updateProfile"></Button></RightNavButton>
        <View id="not_logged_in_message"><Label class="title" text="Please login"/></View>
        <View id="profile_container">   
             <View id="profile">
                <View id="left_column">
                    <Label icon="fa-user" class="profileIcons"/>
                    <Label icon="fa-comment" class="profileIcons"/>
                </View>
 
                <View id="middle_column">
                    <Label class="profileText" id="userSmilies"/>
                    <Label class="profileText" id="userPublishedComments"/>
                </View>
 
                <View id="right_column">
                    <View class="profile_row"><Switch id="user_hihi_channel"/><Label icon="fa-user" class="profileIcons"/></View>
                </View>
            </View> 
        </View>
        </View> 
 
    </Window>

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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