Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 672 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
681 | Develop |
[js] Javascript로 만든 포트리스 (2010)
5 ![]() |
hooni | 2017.03.03 | 2649 |
680 | Develop | [js] IE에서 인쇄 설정 팁 | hooni | 2013.04.23 | 10904 |
679 | Develop | [js] get방식, url이후 모두 그대로 읽어오기.. | hooni | 2013.04.23 | 6842 |
678 | Develop |
[js] e.stopPropagation() VS e.preventDefault ()
![]() |
hooni | 2015.04.14 | 824 |
677 | Develop | [js] Closure를 이용해 캡슐화.. | hooni | 2013.12.16 | 9598 |
676 | Develop | [js] Click button copy to clipboard | hooni | 2018.04.05 | 1192 |
675 | Develop | [js] Array.splice() 설명 | hooni | 2014.04.24 | 3013 |
674 | Develop |
[js] AngularJS를 소개합니다.
![]() |
hooni | 2014.01.06 | 13019 |
673 | Develop |
[js] AngularJS 란?
![]() |
hooni | 2015.11.26 | 907 |
672 | Develop | [js] ajax를 이용해 외부문서 불러오기.. | hooni | 2013.04.23 | 6802 |
671 | Develop |
[js] 2차 잉여.. (Quadratic reciprocity) 계산..
![]() |
hooni | 2013.04.23 | 7078 |
670 | Develop |
[js] 2048 예쁘게 만들고 있는거.. ㅋㄷ
![]() |
hooni | 2015.01.30 | 0 |