Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 757 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
45 | System/OS | [linux] ProFTPD 타임아웃 설정 | hooni | 2003.04.23 | 12911 |
44 | System/OS | [unix] SUN Solaris 싱글모드.. ㅡ,.ㅡ; | hooni | 2003.04.23 | 12055 |
43 | System/OS | [bios] 시스템 부팅 도중 발생하는 비프음 | hooni | 2003.04.23 | 18252 |
42 | System/OS | [windows] 패스워드를 잊어먹었을때.. | hooni | 2003.04.23 | 17363 |
41 | Database | [mysql] DB->Text, Text->DB 변환 | hooni | 2003.04.23 | 12216 |
40 | System/OS | HTTP 프로토콜 (브라우저와 웹서버 간의 통신) | hooni | 2003.04.23 | 48357 |
39 | System/OS | [linux] 센드메일 동적릴레이 설치 | hooni | 2003.04.23 | 15301 |
38 | System/OS | [linux] 데스크탑환경(GNOME/KDE) 바꾸기.. | hooni | 2003.04.23 | 12209 |
37 | System/OS | [linux] 웹로그분석기(webalizer) 설치 & 팁 | hooni | 2003.04.23 | 14947 |
36 | System/OS | [linux] 메일서버 세팅정보(sendmail) | hooni | 2003.04.23 | 17483 |
35 | System/OS | [linux] APM(apache, php, mysql) + gd 설치순서.. | hooni | 2003.04.23 | 18946 |
34 | System/OS | [linux] 쉘 환경변수 PS1(프롬프트) | hooni | 2003.04.23 | 13563 |