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 PPT [network] tcp/ip 설명 html파일 9장(ppt 포함) file hooni 2013.04.23 11650
916 Database [mysql] 쿼리 실행시 ERROR 1366 (HY000) : incorrect string value : for column 3 hooni 2017.03.30 8772
915 Database [mysql] 쿼리 로그 저장 매뉴얼 file hooni 2013.04.23 15216
914 Database [mysql] 중복데이터 삭제하는 초간단 쿼리 hooni 2017.11.22 3419
913 Database [mysql] 접속과 테이블 생성 간단한 설명.. hooni 2003.04.23 18655
912 Develop [mysql] 양력, 음력 DB데이터 file hooni 2013.04.23 7802
911 Database [mysql] 쓰레드가 계속 쌓이기 시작하고 사라지지 않을때.. hooni 2003.04.23 12787
910 System/OS [mysql] 시간 관련 SQL구문.. hooni 2013.04.23 10773
909 Database [mysql] 루트 암호 초기화 hooni 2013.04.23 11044
908 Database [mysql] MySQL 한글 깨짐 현상 해결하기(UTF8) hooni 2017.12.01 5463
907 Database [mysql] MySql 에서 정렬 후 그룹 하는 방법 hooni 2015.05.07 3008
906 Database [mysql] MySQL 백업 및 복구 hooni 2019.11.22 817
905 Database [mysql] MySQL 데이터베이스 추가 및 사용자 추가 hooni 2019.11.22 661
904 System/OS [mysql] mysql user 생성시 ERROR 1364 hooni 2013.04.25 28504
903 System/OS [mysql] MySQL server has gone away 에러 대응 hooni 2013.05.29 19224
902 Database [mysql] MySql DB/테이블 사이즈 확인을 위한 쿼리 hooni 2019.11.22 656
Board Pagination Prev 1 ... 15 16 17 18 19 ... 74 Next
/ 74