Contents

Views 753 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
45 Etc 스파이웨어(BHO) 탐지하는 방법.. hooni 2013.04.23 44465
44 Etc 아두이노 관련 정보.. hooni 2013.04.23 21814
43 Develop 아이 훌레시 작업중 ㅋㅋ secret hooni 2013.08.09 0
42 Etc 아이폰의 터치스크린 정확도 file hooni 2015.04.01 1511
41 System/OS 아파치(Apache) 인증사용(htaccess)으로 특정 디렉토리에 암호걸기 hooni 2013.04.23 13728
40 Develop 알고리즘 성능 분석 기준 hooni 2014.06.24 2907
39 Develop 알고리즘 성능분석 file hooni 2014.06.24 3094
38 Algorithm 암호 알고리즘 및 프로토콜의 이해.. file hooni 2013.04.23 17260
37 Etc 양성/음성 오류에 대한 개념 hooni 2013.04.23 19904
36 Etc 엑셀 함수 총 정리 ㅎㅎ file hooni 2013.06.05 24602
35 Etc 여기저기서 모은 VoIP(인터넷전화) 자료들~ file hooni 2013.04.23 16029
34 Etc 여러 대학 및 권위있는 기관 강좌 모음 ㅋㅋ hooni 2013.06.17 15254
Board Pagination Prev 1 ... 89 90 91 92 93 94 95 96 97 98 Next
/ 98