Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 738 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
25 | Develop | 라이브러리에 대한 설명 (static & dynamic library) | hooni | 2013.04.23 | 6958 |
24 | Develop | 레고 NXT 마인드스톰 밸런싱 로봇 ㅎㅎ | hooni | 2013.04.23 | 57748 |
23 | Develop | 레고 마인드스톰 NXT 수도쿠, 큐브 소스코드.. 20 | hooni | 2013.04.23 | 81511 |
22 | Develop | 리팩토링 계획안 | hooni | 2017.05.15 | 837 |
21 | Develop | 링크들 보고 지울 내용 | hooni | 2019.11.21 | 0 |
20 | Develop | 모터에 대한 pid 제어.. ㅎㅎ | hooni | 2013.04.23 | 18924 |
19 | Develop | 밸런싱 로봇.. 최종.. (관련 논문도 첨부) ㅋㅋ | hooni | 2013.04.23 | 22860 |
18 | Develop | 베지어 곡선(Bézier curve) 알고리즘(spline 곡선) 3 | hooni | 2013.04.23 | 33348 |
17 | Develop | 사이버보안실무 발표자료 (2017.06.08) | hooni | 2017.06.05 | 1294 |
16 | Develop | 사이버보안실무 수업 메모 | hooni | 2017.03.23 | 0 |
15 | Develop | 서기의 PHP 동영상 강의(싱싱해) | hooni | 2013.05.15 | 31033 |
14 | Develop | 아이 훌레시 작업중 ㅋㅋ | hooni | 2013.08.09 | 0 |