Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 753 댓글 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 | [js] 한글주소(URL) 인코딩(encode, Encoding), 자바스크립트(JavaScript) | hooni | 2013.04.23 | 11345 |
456 | Develop |
URI 인코딩, URL 인코딩
![]() |
hooni | 2013.04.23 | 18899 |
455 | Develop | OGNL(Object Graph Navigation Language) | hooni | 2013.04.23 | 15777 |
454 | Develop |
[c] 포인터 학습용 예제 소스 코드
![]() |
hooni | 2013.04.23 | 21079 |
453 | Develop |
[c#] 정규표현식을 이용한 문자열에서 태그 제거함수
![]() |
hooni | 2013.04.23 | 17871 |
452 | Develop |
[vb] 문자열에서 태그 제거함수 (Visual Basic)
![]() |
hooni | 2013.04.23 | 22673 |
451 | Develop | [unix] 날짜 관련 쉘 명령어 (특정일 또는 +-시간, 날짜 계산된 값) | hooni | 2013.04.23 | 14880 |
450 | Develop | [js] 자바스크립트를 동적으로 로딩하기 | hooni | 2013.04.23 | 13603 |
449 | Develop | [c#] 파일(File) 쓰기 ㅎㅎ | hooni | 2013.04.23 | 13316 |
448 | Develop |
[php] 한샘 전자발주 시스템..
![]() |
hooni | 2013.04.23 | 12021 |
447 | Develop |
[jsp] RSS(xml) 파싱해서 보여주기 ㅎㅎ
![]() |
hooni | 2013.04.23 | 13234 |
446 | Develop |
[php] 심플한 게시판 ㅋㅋ
1 ![]() |
hooni | 2013.04.23 | 13032 |