Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 752 댓글 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 | [c] 간단한 순위 루틴.. (질문에 대한 답변) | hooni | 2003.04.23 | 7493 |
456 | Develop | [php] 데이터를 엑셀,워드 형태로 변환할 때 헤더(ms-office) | hooni | 2013.04.23 | 7512 |
455 | Develop |
[chm] 비주얼 C++ 팁 모음 문서
![]() |
hooni | 2013.04.23 | 7517 |
454 | Develop | [c] 시어핀스키 가스킷..(p.582, A.2 - 두번째) | hooni | 2003.04.23 | 7526 |
453 | Develop |
[chm] 윈도우즈에서 디버깅 기법(Debugging Applications)
![]() |
hooni | 2013.04.23 | 7544 |
452 | Develop |
[php] 웹 응용프로그램(engines) 모음
![]() |
hooni | 2013.04.23 | 7558 |
451 | Develop |
[c] IP 스푸핑(ip spoof) 소스 - 정리해야 함
![]() |
hooni | 2003.04.23 | 7571 |
450 | Develop |
[c] 정수를 2진수로 변환 (재귀,비트연산)
![]() |
hooni | 2003.04.23 | 7603 |
449 | Develop |
[c] 소켓 스트림 서버/클라이언트 (UDP)
![]() |
hooni | 2013.04.23 | 7609 |
448 | Develop |
[c++] 초간단 스택 두 가지 방식(class, struct)
![]() |
hooni | 2013.04.23 | 7622 |
447 | Develop |
[ios] How To Use UIScrollView to Scroll and Zoom Content (Using Swift)
![]() |
hooni | 2016.03.23 | 7624 |
446 | Develop |
[js] 비만 지수 측정(BMI) ㅎㅎ
![]() |
hooni | 2013.04.23 | 7630 |