Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 654 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
57 | Develop | 사이버보안실무 발표자료 (2017.06.08) | hooni | 2017.06.05 | 1197 |
56 | Etc | 사이버보안실무 수업 메모 | hooni | 2017.03.30 | 805 |
55 | Develop | 사이버보안실무 수업 메모 | hooni | 2017.03.23 | 0 |
54 | Etc | 사이버보안실무 시험. | hooni | 2017.04.20 | 0 |
53 | PPT | 삼성페이(Samsung Pay) 구조 | hooni | 2016.09.09 | 921 |
52 | Develop | 서기의 PHP 동영상 강의(싱싱해) | hooni | 2013.05.15 | 30980 |
51 | System/OS | 서버 확장을 위한 두 가지 방법 | hooni | 2018.08.29 | 2096 |
50 | Etc | 선과 악에 대한 영어논술문항(지킬앤하이드 독서 후 이어지는 심화 수행평가) | hooni | 2013.12.04 | 12744 |
49 | Etc | 성문 종합 영어 정리된 pdf 파일 | hooni | 2013.06.25 | 30948 |
48 | Etc | 수리통계학 : 표본공간과 사상-1 | hooni | 2015.04.20 | 900 |
47 | Etc | 스마트폰 보안 해외 발생 사례~ | hooni | 2013.04.23 | 24934 |
46 | Algorithm | 스터디 자료, 암호화에 대해서.. 나중에 볼 ppt.. | hooni | 2013.04.23 | 13370 |