Views 654 Votes 0 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
917 System/OS [linux] 꿀통(honeyd) 설치하기.. 메뉴얼 과정 6 file hooni 2006.04.23 20219
916 System/OS [linux] 데비안(debian.org) 리눅스 명령어 예제 hooni 2006.04.23 10422
915 System/OS [mysql] 시간 관련 SQL구문.. hooni 2013.04.23 10773
914 Database [mysql] 쿼리 로그 저장 매뉴얼 file hooni 2013.04.23 15216
913 Algorithm [security] RSA 암호화 설명과 예.. hooni 2013.04.23 16616
912 Algorithm 스터디 자료, 암호화에 대해서.. 나중에 볼 ppt.. file hooni 2013.04.23 13370
911 Develop [c] 최대공약수, 최소공배수, 서로소 구하기 (펌) hooni 2013.04.23 11158
910 Develop [c++] RSA Sample 4 CPP hooni 2013.04.23 9181
909 System/OS [router] 시스코 라우터 명령어 모드.. hooni 2013.04.23 12944
908 Algorithm [security] 블럭 암호에 대해서.. hooni 2013.04.23 17118
907 System/OS [router] 라우팅 프로토콜 BGP (간단한 세팅) hooni 2013.04.23 10949
906 System/OS 네트워크별 MTU(최대 전송 단위) hooni 2013.04.23 17641
905 System/OS OSI (Open Systems Interconnection) 개방형 시스템간 상호 접속 file hooni 2013.04.23 10785
904 System/OS 라우팅 경로 결정 영향 요소 ㅋㅋ file hooni 2013.04.23 15850
903 System/OS [owasp] 10대 웹어플리케이션 보안 취약 file hooni 2013.04.23 15906
902 Database [mysql] 루트 암호 초기화 hooni 2013.04.23 11044
Board Pagination Prev 1 ... 15 16 17 18 19 ... 74 Next
/ 74