2010-08-05 6 views
3

presentModalViewController를 사용하려면 나는 allocinitWithNibName:bundle:이어야합니다. 내 질문은 : 어디에서 놓을까요? dismissModalViewController:animated:이 출시를 처리합니까?PresentModalViewController : 릴리스 위치?

답변

5

아니요. 할당하고 초기화 한 경우 해제해야합니다. 다음과 같이하십시오.

YourViewController *controller = [[YourViewController alloc] initWithNibName:@"YourView" bundle:nil]; 
[self presentModalViewController:controller animated:YES]; 
[controller release]; 

PresentModalViewController : animated : retainCount가 자동으로 증가합니다. 컨트롤러가보기에서 사라지 자마자 컨트롤러가 해제됩니다. 컨트롤러가 할당 해제됩니다. ;-)

5

컨트롤러를 발표 한 후에 해제 할 수 있습니다. 프리젠 테이션 컨트롤러 (부모)는 모달 컨트롤러를 유지합니다.

관련 문제