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 |
[jsp][php] 간단한 강좌 자료..
![]() |
hooni | 2003.04.23 | 8128 |
668 | Develop |
[jsp][php] LDAP 프로그래밍..
![]() |
hooni | 2003.04.23 | 7407 |
667 | Develop | [jsp] 페이지에 한글이 정상적으로 보이지 않을 때.. | hooni | 2013.04.23 | 8169 |
666 | Develop |
[jsp] 초간단한 include 구문 예제..
![]() |
hooni | 2013.04.23 | 7236 |
665 | Develop |
[jsp] 정적/동적(차트생성) 이미지 전달
![]() |
hooni | 2003.04.23 | 7327 |
664 | Develop |
[jsp] 유효성체크(Client, Server 에서)
![]() |
hooni | 2003.04.23 | 7448 |
663 | Develop |
[jsp] RSS(xml) 파싱해서 보여주기 ㅎㅎ
![]() |
hooni | 2013.04.23 | 13223 |
662 | Develop |
[jsp] HelloServlet 출력문
![]() |
hooni | 2003.04.23 | 7830 |
661 | Develop |
[jsp] Get방식, Post방식 전송 예제..
![]() |
hooni | 2003.04.23 | 13786 |
660 | Develop |
[json] 종결자 (설명과 웹, C/C++/C# 프로그램 샘플 코드)
![]() |
hooni | 2013.04.23 | 72016 |
659 | Develop |
[java] 파일 라인수 계산하는 프로그램 (하위 디렉토리까지..)
![]() |
hooni | 2013.04.23 | 7649 |
658 | Develop | [java] 컴포넌트 배치 ㅡ.,ㅡ; | hooni | 2003.04.23 | 7170 |