Forum Xamarin Xamarin.iOS

About cleaning the Memory

RudaRuda BRUniversity ✭✭


I have a question about cleaning the memory. Come on.

I'm doing a menu style to facebook where the left is the menu.
And this menu is loaded for the first time with information from the web.
And I put this information in RootElement (as is private in the Controller class), already creating StyledStringElement of each item.
Then I seto list (Table) with this RootElement.
So far so perfect.
Ai do a search (which is also done on the web) and seto the Table with a new RootElement with the survey data. Only after the person cancels the search, ie have to go back to the previous RootElement (the first).
So I seto again RootElement Table with private variable in ViewController.

Except that there is error, saying it has something void.

From what I understand, it looks like it is clearing RootElement that this is private because it is no longer on the table.

Is that right? How do I work? What is the best practice here?


  • RudaRuda BRUniversity ✭✭
    public class MenuController : DialogViewController
        private RootElement rootBase;
        public MenuController() 
            : base(UITableViewStyle.Plain, new RootElement(""))
        public override void ViewDidLoad()
            searchBar.SearchButtonClicked += (object sender, EventArgs e) => {
                String search = searchBar.Text.ToLower();
                RootElement root = new RootElement("");
                Section sec2 = new Section();
        // Here is the web search and returns the data and create a list of StyledStringElement
                Root = root;
            searchBar.ShowsCancelButton = true;
            searchBar.CancelButtonClicked += (object sender, EventArgs e) => {
                Root = rootBase;
            rootBase = new RootElement("");
            Section sec = new Section("Default");
            // Here is the first web search with the information standards and also created the StyledStringElement and adding the list.
            Root = rootBase;
Sign In or Register to comment.