반응형
presentModalViewController : Animated는 ios6에서 더 이상 사용되지 않습니다.
이미지 선택기에 다음 코드를 사용하고 있습니다. 그러나 시뮬레이터에서 실행하면 메모리 누수가 발생하고 presentModalViewcontroller:animated
iOS6에서 더 이상 사용되지 않는다는 경고가 표시 됩니다. 나는 또한 dismissModalViewController:animated
더 이상 사용되지 않습니다. SDK 6.1을 사용하고 있습니다.
ImagePicker 용 코드 :
- (void)showAlbum:(id)sender {
imagePicker=[[UIImagePickerController alloc]init];
imagePicker.delegate = self;
imagePicker.allowsEditing =NO;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagePicker animated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
//release picker
[picker dismissModalViewControllerAnimated:YES];
}
이 줄을 사용하고 확인하십시오.
[self presentViewController:imagePicker animated:YES completion:nil];
[[Picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
대신에
[[Picker parentViewControl] dismissModalViewControllerAnimated:YES];
과
[self presentViewController:picker animated:YES completion:nil];
대신에
[self presentModalViewController:picker animated:YES];
Vishal이 언급했듯이
[self presentViewController:imagePicker animated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
"completion : nil"도 추가했는지 확인하십시오.
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
{
[self presentViewController:objSignupViewController animated:^{} completion:nil];
}
else
{
[self presentModalViewController:objSignupViewController animated:YES];
}
사용하다:
[self presentViewController:imagePicker animated:YES completion:nil];
그리고 해고 모달 사용을 위해 :
[self dismissViewControllerAnimated:controller completion:nil];
또는
[self dismissViewControllerAnimated:YES completion:nil];
반응형
'program story' 카테고리의 다른 글
.NET 프로젝트 용 Elastic Beanstalk와 CloudFormation의 차이점은 무엇입니까? (0) | 2020.08.20 |
---|---|
JSON 문자열에서 C # 클래스 파일을 자동 생성하는 방법 (0) | 2020.08.20 |
Laravel에서 이것을 수행하는 방법, 하위 쿼리 (0) | 2020.08.20 |
정의에 변수를 포함하는 GNU make의 목표 / 타겟 나열 (0) | 2020.08.20 |
영업일 계산 (0) | 2020.08.20 |