Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 659 댓글 0
Notification 날릴 때,
//Dictionary 만들어서 사용할 경우.. NSDictionary *infoData = [NSDictionary dictionaryWithObjectsAndKeys:missionIdString, @"missionId", winYNString, @"winYNString", str1String, @"str1String", str2String, @"str2String", callbackString, @"callbackString", nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"NotificationLoadedBenefitView" object:nil userInfo:infoData]; // 또는 한번에.. ㅋㄷ [[NSNotificationCenter defaultCenter] postNotificationName:@"NotificationLoadedBenefitView" object:nil userInfo:@{@"missionId":missionIdString, @"winYNString": winYNString, @"str1String": str1String, @"str2String": str2String, @"callbackString": callbackString}];
Notification 받는 방법과 처리하는 메소드(selector)
// Notification 처리 메소드 - (void)updateBenefitView:(NSNotification *)notification { self.isWithCallback = YES; [self viewMissionResult:notification]; NSDictionary *dict = [notification userInfo]; NSString *callbackString = [dict objectForKey:@"callbackString"]; [self performSelector:@selector(execCallback:) withObject:callbackString afterDelay:1.0]; } // Notification 옵저버 - (void)viewDidLoad { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateBenefitView:) name:@"NotificationLoadedBenefitView" object:nil]; } // Notification 제거 - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
745 | Develop | [c++] mfc 기반 멀티수납(wall)시스템 소스와 실행파일 | hooni | 2013.04.23 | 7056 |
744 | Develop | [c++] MFC 모든 헤더와 라이브러리 설명 | [교류]Programming | hooni | 2013.04.23 | 7427 |
743 | Develop | [c++] mfc 윈도우에서 ODBC 사용하여 MDB파일 읽기.. ㅋㅋ | hooni | 2013.04.23 | 9122 |
742 | Develop | [c++] mfc 이용한 기본적인 형변환 예제 | hooni | 2013.04.23 | 11465 |
741 | Develop | [c++] mfc 이용한 트레이아이콘(TrayIcon) 클래스 예제 프로젝트 | hooni | 2013.04.23 | 8797 |
740 | Develop | [c++] mfc 조건별 파일 검색 프로그램 소스 ㅋㅋ 19 | hooni | 2013.04.23 | 11408 |
739 | Develop | [c++] mfc 파일 한줄씩 읽기.. ㅋㅋ | hooni | 2013.04.23 | 28535 |
738 | Develop | [c++] MFC로 만든 디렉토리/파일 파인더 | hooni | 2013.04.23 | 9330 |
737 | Develop | [c++] mfc로 만든 부엌 수납 시스템(2D기반 설계) | hooni | 2013.04.23 | 7270 |
736 | Develop | [c++] mfc로 만든 사용자 계정 리스트 출력(EnumUser) 프로그램 예제 | hooni | 2013.04.23 | 7292 |
735 | Develop | [c++] mfc로 만든 월플렉스 멀티 수납 시스템(2D기반 설계) | hooni | 2013.04.23 | 7404 |
734 | Develop | [c++] mfc로 만든 인테리어 수납 시스템(2D기반 설계) | hooni | 2013.04.23 | 7239 |