ルートコントローラーがviewControllerであり、mapViewを含む新しいmapViewControlerを指すボタンが1つだけあるNAvigationコントローラーを使用して、非常に単純なプロジェクトを作成します。
NavigatioController --> viewController - ボタン --push--> mapView を使用した mapViewController。
これはmapViewController.hの私のコードです:
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface mapViewController : UIViewController
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@end
これはmapViewController.mの私のコードです:
#import "mapViewController.h"
@implementation mapViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
-(void) viewWillDisappear:(BOOL)animated {
//trigered when Back button pressed
if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
[self setMapView:nil];
self.mapView.delegate = nil;
}
[super viewWillDisappear:animated];
}
@end
したがって、ボタンをクリックすると(セグエ - プッシュ)、mapViewController が表示され、Live Bytes が 40MB 増加します。したがって、1MB はどこかにとどまります。これを 100 回繰り返すと、これは 100MB になります。Leaks ツールは、リークを示しません。
戻るをクリックするたびにこの1MBが残る理由と、それを取り除く方法を誰かが説明できますか?