Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 756 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
829 | Develop | [c] home env stack overflow | hooni | 2003.04.23 | 11553 |
828 | Develop | [c] scanf(), printf() 포맷의 형변환 | hooni | 2003.04.23 | 10898 |
827 | Develop | [c] CGI Library to C^^ | hooni | 2003.04.23 | 8439 |
826 | Develop | [c] 간단한 링크드 리스트(linked list) 자료형 예제.. | hooni | 2003.04.23 | 9864 |
825 | Develop | [php] whois정보 조회 프로그램 | hooni | 2003.04.23 | 11773 |
824 | Develop | [c] 최대공약수 알고리즘 (유클릿) | hooni | 2003.04.23 | 8909 |
823 | Develop | [c] 소수점 반올림^^ | hooni | 2003.04.23 | 8501 |
822 | Develop | [c] 하노이탑 - 재귀함수 | hooni | 2003.04.23 | 9178 |
821 | Develop | [c] 팩토리얼.. - 재귀함수 | hooni | 2003.04.23 | 9529 |
820 | Develop |
[c] 간단한 채팅(클라이언트/서버) 프로그램 소스
![]() |
hooni | 2003.04.23 | 9098 |
819 | Develop |
[c] 그래픽스 자료(OpenGL 라이브러리) 샘플 소스
![]() |
hooni | 2003.04.23 | 10211 |
818 | Develop |
[opengl] 컴퓨터 그래픽스 강의 자료(수업자료)
![]() |
hooni | 2003.04.23 | 20524 |