0

I have several modals in my application , here is extentions method what I use for every of them:

public static void CloseAndDismissViewController (this NSViewController vc)
        {
            vc.View.Window.Close ();    
            vc.DismissController (vc);
            vc.RemoveFromParentViewController ();
        }

But I doesn't deallocate memory, here is screen shot from profiler :

enter image description here

finally , such cases cause application crashes....

I'm using PrepareForSegue method to pass data from source to destination vc, like this one :

public override void PrepareForSegue (NSStoryboardSegue segue, NSObject sender)
        {
if (segue.Identifier.Equals ("ImageInfo")) {
                var vc = segue.DestinationController as InfoViewController;
                vc.SetData (item);

            } 
}
Nininea
  • 2,671
  • 6
  • 31
  • 57
  • How are you creating the viewcontroller, and how are you showing the view? – svn Nov 09 '16 at 12:17
  • I'm using segue – Nininea Nov 09 '16 at 12:19
  • Hmm, I don't use storyboards or segues so I'm not familiar with that. Is there any C# code involved in creating or showing the viewcontroller? – svn Nov 09 '16 at 12:23
  • You can just pass data from source to destination, I use PrepareForSegue method, like this one : if (segue.Identifier.Equals ("ImageInfo")) { var vc = segue.DestinationController as InfoViewController; vc.SetData (item);} – Nininea Nov 09 '16 at 12:26
  • I have updated question – Nininea Nov 09 '16 at 12:29
  • Is there anything in SetData that could cause it not being cleaned up (like subscribing to events)? – svn Nov 09 '16 at 12:34
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/127713/discussion-between-svn-and-nininea). – svn Nov 09 '16 at 12:35

0 Answers0