iOS5 および XCode4.2 で開発しているアプリケーションで UIImagePickerController を使用していますが、メモリ リークが発生しています。このリークが発生する理由がわかりません。これに対する答えを教えてください。
と私のコード:
-(void)createImagePicker
{
_picker = [[UIImagePickerController alloc] init];
_picker.sourceType = UIImagePickerControllerSourceTypeCamera;
_picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
_picker.allowsEditing = YES;
_picker.showsCameraControls = NO;
_picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
_picker.delegate = self;
_picker.wantsFullScreenLayout = YES;
}
そしてviewWillApperメソッド:
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeCameraButton:) name:@"ShowMainView" object:nil];
[self createImagePicker];
[m_cameraOverlayView setBackgroundColor:[UIColor clearColor]];
[self presentModalViewController:_picker animated:NO];
_picker.cameraOverlayView = m_cameraOverlayView;
[cameraImgView setHidden:YES];
[filterView setHidden:YES];
m_cameraOverlayView.hidden = NO;
cameraSelectedButton.hidden = NO;
cancelButton.hidden = YES;
selectButton.hidden = YES;
for (id Object in [scrollview subviews])
{
if([Object isKindOfClass:[UIButton class]])
{
[Object removeFromSuperview];
}
}
[m_toolbarImage setFrame:CGRectMake(0, 427, 320, 55)];
[cameraSelectedButton setFrame:CGRectMake(128, 432, 86, 44)];
[m_cancelButton setFrame:CGRectMake(10, 434, 82, 40)];
[m_cancelButton setTitle:@"Close" forState:UIControlStateNormal];
[m_cancelButton setBackgroundImage:[UIImage imageNamed:@"menu-bar-button.png"] forState:UIControlStateNormal];
[m_cancelButton setTitleColor:[UIColor colorWithRed:110/256.0 green:52/256.0 blue:28/256.0 alpha:1.0] forState:UIControlStateNormal];
[cancelButton setFrame:CGRectMake(120, 434, 35, 35)];
[selectButton setFrame:CGRectMake(184, 434, 35, 35)];
}