Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 755 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
1149 | Develop | [vb] 비주얼 베이직 순위 정렬 루틴 | hooni | 2003.04.23 | 58436 |
1148 | Develop | [vb] 비주얼 베이직 131페이지 | hooni | 2003.04.23 | 58159 |
1147 | Develop |
[android] SurfaceView를 이용한 애니메이션 ㅎㅎ
![]() |
hooni | 2013.04.23 | 57773 |
1146 | Develop |
레고 NXT 마인드스톰 밸런싱 로봇 ㅎㅎ
![]() |
hooni | 2013.04.23 | 57766 |
1145 | Develop |
[Xcode] 디버깅 옵션
![]() |
hooni | 2013.04.23 | 57259 |
1144 | Develop | [vb] 비주얼 베이직 205페이지 | hooni | 2003.04.23 | 56136 |
1143 | Develop | [vb] 비쥬얼 베이직 기출 문제 연습 | hooni | 2003.04.23 | 55241 |
1142 | Develop | [vb] 비주얼 베이직 173페이지 | hooni | 2003.04.23 | 54914 |
1141 | Develop | [vb] 비쥬얼 베이직 기출 문제 연습2 | hooni | 2003.04.23 | 54447 |
1140 | Develop |
[iphone] view에 대한 조사 ㅡ,.ㅡ;
![]() |
hooni | 2013.04.23 | 54117 |
1139 | Develop | [vb] 비쥬얼 베이직으로.. | hooni | 2003.04.23 | 53131 |
1138 | System/OS | [linux] 아파치설치/설정 - 알리어싱(aliasing) | hooni | 2003.04.23 | 51450 |