Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 1860 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
61 | Develop |
[android] N-Puzzle 게임
![]() |
hooni | 2015.07.09 | 2126 |
60 | Develop | [ios] 최상위 ViewController 가져오기 | hooni | 2015.10.12 | 2125 |
59 | Develop | [ios] ViewController Push할 때 애니메이션 효과 | hooni | 2015.10.23 | 2119 |
58 | Develop |
XE Core 1.8.18 본문 작성시 태그(html) 사라지는 버그
![]() |
hooni | 2016.04.21 | 2110 |
57 | Develop |
정리할 자료.
![]() |
hooni | 2015.07.02 | 2099 |
56 | Develop |
[maven] Mac OS에 메이븐(maven) 설치하기
![]() |
hooni | 2015.01.21 | 2095 |
55 | Develop |
[c#] MS IE(Internet Explorer) 툴바 버튼 예제 2003/2005 두가지 버전
![]() |
hooni | 2013.04.23 | 2090 |
54 | Develop | [linux] CentOS Apache 웹서버에 HTTPS 적용 | hooni | 2015.10.23 | 2089 |
53 | Develop | [ios] Thread Loop 내에서 UI 업데이트 방법 | hooni | 2015.01.03 | 2075 |
52 | Develop | [js] 스크롤 이벤트 막기 | hooni | 2015.04.14 | 2074 |
51 | Develop |
[c#] mfc 기반의 웹서비스 서버/클라이언트 샘플과 예제 소스
![]() |
hooni | 2013.04.23 | 2073 |
50 | Develop |
GPL, AGPL, MPL,.. 한눈에 보는 오픈소스SW 라이선스
![]() |
hooni | 2014.10.14 | 2066 |