Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
Views 1852 Comment 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]; }
-
[c#]뉴 툴바 개인적으로 만든거.. (new)
-
[mysql] MySQL 한글 깨짐 현상 해결하기(UTF8)
-
[c][php] 프로세스정보와 메모리 정보 웹으로 출력하는거..
-
[c#]업글 뉴 툴바 개인적으로 만든거.. (new) ㅋㅋ
-
[c] 네트워크 보안 프로그래밍 과제 (Server,Agent,Client)
-
[android] dp, px 서로 변환
-
[php] 3 Ways to Detect Mobile or Desktop in PHP
-
[js] 새로고침(refresh)방법과 다른 페이지 바꾸기..
-
Enable Safari Hidden Debug Menu in Mac OS X
-
[java] 채팅창 처럼2.. swing..
-
[c] alarm()함수 설명과 간단한 예제
-
[java] 에디터.. swing 사용