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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
457 | Develop | [js] 이미지 사이즈를 동적으로 조절.. | hooni | 2013.04.23 | 7499 |
456 | Develop |
[chm] 비주얼 C++ 팁 모음 문서
![]() |
hooni | 2013.04.23 | 7519 |
455 | Develop | [php] 데이터를 엑셀,워드 형태로 변환할 때 헤더(ms-office) | hooni | 2013.04.23 | 7520 |
454 | Develop | [c] 시어핀스키 가스킷..(p.582, A.2 - 두번째) | hooni | 2003.04.23 | 7533 |
453 | Develop |
[chm] 윈도우즈에서 디버깅 기법(Debugging Applications)
![]() |
hooni | 2013.04.23 | 7553 |
452 | Develop |
[php] 웹 응용프로그램(engines) 모음
![]() |
hooni | 2013.04.23 | 7570 |
451 | Develop |
[c] IP 스푸핑(ip spoof) 소스 - 정리해야 함
![]() |
hooni | 2003.04.23 | 7576 |
450 | Develop |
[c] 정수를 2진수로 변환 (재귀,비트연산)
![]() |
hooni | 2003.04.23 | 7607 |
449 | Develop |
[c] 소켓 스트림 서버/클라이언트 (UDP)
![]() |
hooni | 2013.04.23 | 7615 |
448 | Develop |
[c++] 윈도우 API 정복 예제
![]() |
hooni | 2013.04.23 | 7634 |
447 | Develop |
[c++] 초간단 스택 두 가지 방식(class, struct)
![]() |
hooni | 2013.04.23 | 7636 |
446 | Develop |
[js] 비만 지수 측정(BMI) ㅎㅎ
![]() |
hooni | 2013.04.23 | 7637 |