Contents

Views 654 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

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
No. Category Subject Author Date Views
1137 Etc 양성/음성 오류에 대한 개념 hooni 2013.04.23 19851
1136 Algorithm 암호 알고리즘 및 프로토콜의 이해.. file hooni 2013.04.23 17208
1135 Develop 알고리즘 성능분석 file hooni 2014.06.24 2963
1134 Develop 알고리즘 성능 분석 기준 hooni 2014.06.24 2783
1133 System/OS 아파치(Apache) 인증사용(htaccess)으로 특정 디렉토리에 암호걸기 hooni 2013.04.23 13659
1132 Etc 아이폰의 터치스크린 정확도 file hooni 2015.04.01 1411
1131 Develop 아이 훌레시 작업중 ㅋㅋ secret hooni 2013.08.09 0
1130 Etc 아두이노 관련 정보.. hooni 2013.04.23 21770
1129 Etc 스파이웨어(BHO) 탐지하는 방법.. hooni 2013.04.23 44404
1128 Algorithm 스터디 자료, 암호화에 대해서.. 나중에 볼 ppt.. file hooni 2013.04.23 13370
1127 Etc 스마트폰 보안 해외 발생 사례~ file hooni 2013.04.23 24936
1126 Etc 수리통계학 : 표본공간과 사상-1 hooni 2015.04.20 900
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 98 Next
/ 98