NSNotificationCenter1 NSNotification 예제 (자식창 닫을때 부모창도 같이 닫기) NSNotification 예제 최상위뷰가 있다. 최상위 뷰에서 부모뷰를 띄웠다. 부모뷰에서 자식 뷰를 띄웠다. 이때, 자식뷰를 닫을때 부모뷰까지 같이 닫아 줘야하는 요구사항이 있다. 이럴때는 NSNotification 을 사용한다. 먼저 부모뷰에 NSNotification 설정과 콜백메소드(편의상 이렇게 부르겠다)를 작성해준다. viewdidload{ //노티피케이션 등록 - 자식창을 닫을때 이곳(부모)도 닫히게 노티 등록 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeViewControllerBySelf:) name:@"close" object:nil]; } 이렇게 셋팅을 해주고 호출될 메소드를 작성해준다... 2019. 10. 24. 이전 1 다음