Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 742 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
669 | Develop |
[js] 자바스크립트(Javascript) 코드를 동적으로 삽입하는 방법..
![]() |
hooni | 2013.04.23 | 22921 |
668 | Develop |
밸런싱 로봇.. 최종.. (관련 논문도 첨부) ㅋㅋ
![]() |
hooni | 2013.04.23 | 22861 |
667 | Develop |
레고 마인드스톰 NXT 수도쿠, 큐브 소스코드..
20 ![]() |
hooni | 2013.04.23 | 81512 |
666 | Etc | 아두이노 관련 정보.. | hooni | 2013.04.23 | 21803 |
665 | Develop |
레고 NXT 마인드스톰 밸런싱 로봇 ㅎㅎ
![]() |
hooni | 2013.04.23 | 57750 |
664 | Develop |
모터에 대한 pid 제어.. ㅎㅎ
![]() |
hooni | 2013.04.23 | 18926 |
663 | Develop | [doc] UI개발시 유용한 소프트웨어 (개발 및 디버깅 툴) | hooni | 2013.04.23 | 12922 |
662 | Etc |
[flash] 자동차 엔진의 원리 (4행정 사이클 그림)
![]() |
hooni | 2013.04.23 | 21252 |
661 | Develop |
[pdf] GPS의 동작 원리 ㅎㅎ
![]() |
hooni | 2013.04.23 | 23898 |
660 | Develop |
[android]개발 가이드 및 한글화 문서
![]() |
hooni | 2013.04.23 | 47554 |
659 | Etc | [ios] 아이폰 개발 따라하기 ㅋㅋㅋ | hooni | 2013.04.23 | 23334 |
658 | Develop | [android] 해상도 관련 팁 (dip -> pixel 변환) | hooni | 2013.04.23 | 15358 |