Contents

조회 수 654 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

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];
}

 


?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
45 Etc 스파이웨어(BHO) 탐지하는 방법.. hooni 2013.04.23 44409
44 Etc 아두이노 관련 정보.. hooni 2013.04.23 21770
43 Develop 아이 훌레시 작업중 ㅋㅋ secret hooni 2013.08.09 0
42 Etc 아이폰의 터치스크린 정확도 file hooni 2015.04.01 1417
41 System/OS 아파치(Apache) 인증사용(htaccess)으로 특정 디렉토리에 암호걸기 hooni 2013.04.23 13659
40 Develop 알고리즘 성능 분석 기준 hooni 2014.06.24 2785
39 Develop 알고리즘 성능분석 file hooni 2014.06.24 2965
38 Algorithm 암호 알고리즘 및 프로토콜의 이해.. file hooni 2013.04.23 17209
37 Etc 양성/음성 오류에 대한 개념 hooni 2013.04.23 19853
36 Etc 엑셀 함수 총 정리 ㅎㅎ file hooni 2013.06.05 24464
35 Etc 여기저기서 모은 VoIP(인터넷전화) 자료들~ file hooni 2013.04.23 15966
34 Etc 여러 대학 및 권위있는 기관 강좌 모음 ㅋㅋ hooni 2013.06.17 15121
Board Pagination Prev 1 ... 89 90 91 92 93 94 95 96 97 98 Next
/ 98