Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
Views 757 Comment 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]; }
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
201 | Develop | [php] 탐색기와 같은 다이나믹 트리(xml/xsl 이용) | hooni | 2013.04.23 | 7203 |
200 | PPT | [php] 프레임워크 발표자료 및 샘플 구현 소스 | hooni | 2013.04.23 | 17548 |
199 | Develop | [php] 피코맥스용 검색엔진 ㅋㅋ | hooni | 2013.04.23 | 6817 |
198 | Develop | [php] 하루 전 날짜 쉽게 구하기. | hooni | 2013.12.25 | 12323 |
197 | Develop | [php] 한글 문자열 자르기 (utf-8) | hooni | 2015.11.10 | 1466 |
196 | Develop | [php] 한샘 전자발주 시스템.. | hooni | 2013.04.23 | 12032 |
195 | Develop | [php] 현재에서 일정한 날짜 더하기.. | hooni | 2013.04.23 | 7165 |
194 | Develop | [php][laravel] 라라벨 개발환경 세팅하기 (Mac, Window) 2 | hooni | 2017.12.15 | 2786 |
193 | Develop | [php][laravel] 라라벨 프로젝트 생성 및 구조 | hooni | 2017.12.15 | 2561 |
192 | Develop | [php][laravel] 초간단 MacOS에서 Laravel 개발 환경 구축 | hooni | 2017.12.15 | 2127 |
191 | PPT | [ppt] Equation Solving 발표 자료 (@AjaxUI랩 밋업데이 2012.02.28) | hooni | 2015.07.22 | 1011 |
190 | PPT | [ppt] Equation Solving 발표 자료 (@PWE랩 톡데이 2011.07.26) | hooni | 2013.04.23 | 24734 |