Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 750 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
669 | Develop |
[c++] 레지스트리 편집하는 부분..ㅡㅡ;
![]() |
hooni | 2013.04.23 | 8290 |
668 | Develop |
[c++] 윈도우 프로세스뷰어 분석.. ㅋㅋ
![]() |
hooni | 2013.04.23 | 8854 |
667 | Develop |
[c++] 트리컨트롤 예제1 ㅋㅋ
![]() |
hooni | 2013.04.23 | 7187 |
666 | Develop |
[c++] 트리컨트롤 스텝 2 예제..
![]() |
hooni | 2013.04.23 | 6970 |
665 | Develop |
[c++] 트리컨트롤 스텝 3 예제..
![]() |
hooni | 2013.04.23 | 7957 |
664 | Develop |
[c++] 바탕화면 테두리에 자석처럼 붙는 스냅효과..
![]() |
hooni | 2013.04.23 | 8921 |
663 | Develop |
[c++] SetWindowPos함수를 이용한 크기조절 예제
1 ![]() |
hooni | 2013.04.23 | 11101 |
662 | Develop |
[c++] 레지스트리 등록 예제
1 ![]() |
hooni | 2013.04.23 | 8803 |
661 | Develop | [c] 소수 구하기 #2 (입력한 숫자가 소수인지 판별하기..) | hooni | 2013.04.23 | 10995 |
660 | Develop | 다양한 방법으로 아주 큰 수(Big Number) 계산.. ㅋㅋ | hooni | 2013.04.23 | 8392 |
659 | Develop | [c] 기본 자료형(int)이 표현할 수 없는 큰 수(Big number)를 덧셈하는 코드. 1 | hooni | 2013.04.23 | 13473 |
658 | Develop | [c++] MFC 모든 헤더와 라이브러리 설명 | [교류]Programming | hooni | 2013.04.23 | 7450 |