Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 756 댓글 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 | 7339 |
456 | Develop |
[doc] C++언어 문법 설명서
![]() |
hooni | 2013.04.23 | 6194 |
455 | Develop |
[doc] C언어 문법 설명서
![]() |
hooni | 2013.04.23 | 6459 |
454 | Develop |
[doc] Equation Solving에 대한 발표자료..
![]() |
hooni | 2013.04.23 | 7996 |
453 | Develop |
[doc] Json Framework 설치와 사용
![]() |
hooni | 2013.04.23 | 21960 |
452 | Develop |
[doc] mfc 매뉴얼 다운 받아서 완성하기.. ㅋㄷ
![]() |
hooni | 2013.04.23 | 7715 |
451 | Develop | [doc] UI개발시 유용한 소프트웨어 (개발 및 디버깅 툴) | hooni | 2013.04.23 | 12934 |
450 | Develop |
[doc] 유료 방송 제어 시스템 (CAS) 발표자료
![]() |
hooni | 2013.04.23 | 8527 |
449 | Develop |
[doc] 테크니컬 레포트 (BHO 취약점을 이용한 공격)
2 ![]() |
hooni | 2013.04.23 | 27136 |
448 | Develop | [erp] SAP 모듈 요약 | hooni | 2013.04.23 | 15328 |
447 | Develop | [git] 쉬운 버전관리 Git 설명 | hooni | 2015.08.18 | 963 |
446 | Develop | [html] HTML5 튜토리얼 링크 ㅋㅋ | hooni | 2013.04.23 | 12826 |