Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 746 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
769 | Develop | [c++] 기초강좌 #01(입출력,영역지정) | hooni | 2003.04.23 | 11455 |
768 | Develop | [c++] 기초강좌 #02(레퍼런스,메모리할당) | hooni | 2003.04.23 | 11470 |
767 | Develop | [c++] 기초강좌 #03(함수의 매개변수 전달) | hooni | 2003.04.23 | 12126 |
766 | Develop | [c++] 기초강좌 #04(클래스) | hooni | 2003.04.23 | 11858 |
765 | Develop |
[c] C로 구현한 CGI - 방명록
![]() |
hooni | 2003.04.23 | 33495 |
764 | Develop |
[c] C로 구현한 CGI - 계산기 (링크리스트, 스택, 이진트리)
![]() |
hooni | 2003.04.23 | 28140 |
763 | Develop |
[c] C로 구현한 CGI - 달력과 날짜계산기
![]() |
hooni | 2003.04.23 | 32410 |
762 | Develop |
[jsp] 유효성체크(Client, Server 에서)
![]() |
hooni | 2003.04.23 | 7452 |
761 | Develop | [js] 키보드 아스키 코드 확인하는 간단한 소스 | hooni | 2003.04.23 | 7782 |
760 | Develop | [js] 핫키(단축키) 구현방법 | hooni | 2003.04.23 | 7648 |
759 | Develop | [js] 이미지 미리 로딩하기 | hooni | 2003.04.23 | 7031 |
758 | Develop | [html] 캐쉬된 웹페이지 사용하지 않도록 하는 방법 | hooni | 2003.04.23 | 13060 |