Develop
2015.06.26 16:55
[ios] NSNotificationCenter 초간단 사용 예~ ㅋㄷ
조회 수 652 댓글 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]; }
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
733 | Develop | [php] whois정보 조회 프로그램 | hooni | 2003.04.23 | 11733 |
732 | Develop | [php] URL/URI 관련 환경변수 | hooni | 2003.04.23 | 9146 |
731 | Develop | [php] substr() 한글 자를 때 깨짐 방지 | hooni | 2014.01.09 | 20359 |
730 | Develop | [php] php5.3부터는 eregi()대신 preg_match()를 사용 | hooni | 2013.11.18 | 12461 |
729 | Develop | [php] php+db 연동(odbc, mssql, mysql, sybase) 3 | hooni | 2013.04.23 | 8538 |
728 | Develop | [php] mysql_ 과 mysqli_ 의 차이 | hooni | 2017.12.01 | 1682 |
727 | Develop | [PHP] Mac OS에서 PHP 7 설치하기 | hooni | 2018.05.11 | 4868 |
726 | Develop | [php] Laravel Route에서 PC/Mobile 분기 | hooni | 2018.01.24 | 2453 |
725 | Develop | [php] Laravel 5.4: Specified key was too long error | hooni | 2017.12.04 | 9212 |
724 | Develop | [php] Laravel 4. twitter bootstrap 적용하기 | hooni | 2018.04.05 | 2530 |
723 | Develop | [php] GregorianToJD(), JDToGregorian() 함수 내용 | hooni | 2013.12.25 | 10589 |
722 | Develop | [php] gd 프로그램.. htm 파일.. ㅋㅋ | hooni | 2013.04.23 | 7410 |