1

뷰 관리자에서 전역 변수를 선언하는 xamarin에서 작업 한 것은 매우 중요합니다. 그렇지 않으면 Binding과 관련된 모든 것에 대해 가비지 수집이 가능합니다.xamarin.ios의 메모리 관리 문제

마찬가지로 nsnotification을 위해 우리는 nsobject 유형의 전역 참조가 있어야하고 nsnotification이 필요하지 않을 때 nsobject를 제거해야합니다.

이 개발자 xamarin.ios되고있는 IOS 개발자를위한 좋은 도움이 될 것 같은 몇 가지 제안 xamarin.ios

와 좌절 할 수 네이티브 아이폰 OS 개발자를 만드는 실제적인 문서가없는

답변

0

모든 ViewControllers에서 코드 다음 쓰기 :의 ViewController가 탐색 또는 스택에서 제거 될 때

public override void ViewDidDisappear (bool animated) 
{ 
    //Executed when we navigate to other view, moving this ViewController in Navigation stack 

    //1. UnSubscribe All Events Here (Note: These must be SubScribed back in ViewWillAppear) 
    btnLogin.TouchupInside -= OnLoginClicked 
    //2. Remove Any TapGuestures (Note: These must be added back in ViewWillAppear) 
    if (singleTapGuesture != null) 
    { 
     scrollView.RemoveGestureRecognizer(singleTapGuesture); 
     singleTapGuesture.Dispose(); 
     singleTapGuesture = null; 
    } 
    //3. Remove any NSNotifications (Note: These must be added back in ViewWillAppear) 
    //4. Clear anything here, which again initializes in ViewWillAppear 


    if (ParentViewController == null) { 
     //This section will be executed when ViewController is Removed From Stack 
     //1. Clear everything here 
     //2. Clear all Lists or other such objects 
     //3. Call Following Method which will clear all UI Components 
     ReleaseDesignerOutlets(); 
    } 
    base.ViewDidDisappear (animated); 
} 

이 모든 원치 않는 개체를 삭제합니다.

UITableViews의 경우 WeakDataSource & WeakDelegate를 사용하십시오.

가 더 많은 다음 링크를 기반으로 할 수 있습니다 :

Ref 1

Ref 2