Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 752 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
457 | Develop |
[c#] MS IE(Internet Explorer) 툴바 버튼 예제 2003/2005 두가지 버전
![]() |
hooni | 2013.04.23 | 2090 |
456 | Develop |
[c] 네트워크 트래릭 모니터링.. 졸업작품..
2 ![]() |
hooni | 2013.04.23 | 11064 |
455 | Develop |
[c] 텍스트 파일(로그)을 정해진 라인 단위로 쪼개주는 코드
![]() |
hooni | 2013.04.23 | 7058 |
454 | Develop |
[c#] mfc 기반의 웹서비스 서버/클라이언트 샘플과 예제 소스
![]() |
hooni | 2013.04.23 | 2073 |
453 | Develop | [c++] Win32API를 이용한 ExitWindowsEx 사용한 예제코드 | hooni | 2013.04.23 | 7987 |
452 | Develop |
[c#] BHO 한샘툴바랑 동현툴바..
![]() |
hooni | 2013.04.23 | 2208 |
451 | Develop | [c] 가변인자 함수(printf와 같은..) | hooni | 2013.04.23 | 7193 |
450 | Develop |
[c] openssl 샘플코드.. 어려움 ㅠㅠ
![]() |
hooni | 2013.04.23 | 7036 |
449 | Develop |
[c] 바로 보고 정리할 것.. ㅋㄷㅋㄷ
![]() |
hooni | 2013.04.23 | 7148 |
448 | Develop |
[c] UTF-8을 EUC-KR로 변환.. (iconv)
![]() |
hooni | 2013.04.23 | 20177 |
447 | Develop |
[c] 도메인(호스트)으로 IP정보 알아오기.. (nslookup과 비슷)
![]() |
hooni | 2013.04.23 | 6942 |
446 | Develop |
[c] 파이프(popen)로 다른 프로세스 실행결과 가져오기
![]() |
hooni | 2013.04.23 | 8412 |