Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 750 댓글 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 |
[js] 자바스크립트와 정규표현식 메뉴얼 (chm 형식)
![]() |
hooni | 2013.04.23 | 7629 |
668 | Develop |
[c++] 윈도우 API 정복 예제
![]() |
hooni | 2013.04.23 | 7632 |
667 | Develop |
[c++] winsock을 이용한 서버,클라이언트와 ssl서버,클라이언트
![]() |
hooni | 2013.04.23 | 7632 |
666 | Develop | [c] OpenGL 관측점 이동 | hooni | 2003.04.23 | 7635 |
665 | Develop | [js] 핫키(단축키) 구현방법 | hooni | 2003.04.23 | 7649 |
664 | Develop |
[c#] BFilter 툴바 소스 코드 ㅎㅎ
![]() |
hooni | 2013.04.23 | 7649 |
663 | Develop |
[java] 파일 라인수 계산하는 프로그램 (하위 디렉토리까지..)
![]() |
hooni | 2013.04.23 | 7650 |
662 | Develop |
[c#]업글 뉴 툴바 개인적으로 만든거.. (new) ㅋㅋ
![]() |
hooni | 2013.04.23 | 7651 |
661 | Develop |
[php] 자바스크립트 개판 만들기..
![]() |
hooni | 2013.04.23 | 7670 |
660 | Develop | SVN 초간단 사용하기 | hooni | 2014.02.28 | 7674 |
659 | Develop | [c] 관계형 연산자에 대한 설명 | hooni | 2013.04.23 | 7677 |
658 | Develop |
[c] 구조체 배열 예제 (학생 성적 계산)
![]() |
hooni | 2013.04.23 | 7679 |