Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 1851 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
135 | Develop |
[c#]뉴 툴바 개인적으로 만든거.. (old)
![]() |
hooni | 2013.04.23 | 4272 |
134 | Develop |
알고리즘 성능분석
![]() |
hooni | 2014.06.24 | 4260 |
133 | Develop |
[ios] How To Use UIScrollView to Scroll and Zoom Content (Using Objective-C)
![]() |
hooni | 2016.03.23 | 4245 |
132 | Develop |
[ios] 커스텀 폰트 사용하기 (Custom Fonts)
![]() |
hooni | 2014.04.30 | 4232 |
131 | Develop |
[ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법
![]() |
hooni | 2017.03.29 | 4197 |
130 | Develop | [ios] iOS 사운드 관련 프레임워크 | hooni | 2014.04.18 | 4174 |
129 | Develop | [io] Apple Watch, Today Extension 앱ID 설정 | hooni | 2016.04.20 | 4161 |
128 | Develop | [js] Array.splice() 설명 | hooni | 2014.04.24 | 4132 |
127 | Develop | [vim] vim 명령으로  문자 제거하기 (remove 65279 bomb) | hooni | 2021.02.03 | 4119 |
126 | Develop |
[ios] Swift 4 Dictionary 사용하기
![]() |
hooni | 2018.11.29 | 4106 |
125 | Develop |
[android] 안드로이드 앱 문서 샘플
![]() |
hooni | 2017.07.11 | 4045 |
124 | Develop | [ios] 여러 버전의 Xcode 사용하기 | hooni | 2022.05.28 | 4003 |