조회 수 665 추천 수 0 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
25 Develop 라이브러리에 대한 설명 (static & dynamic library) hooni 2013.04.23 6948
24 Develop 레고 NXT 마인드스톰 밸런싱 로봇 ㅎㅎ file hooni 2013.04.23 57722
23 Develop 레고 마인드스톰 NXT 수도쿠, 큐브 소스코드.. 20 file hooni 2013.04.23 81454
22 Develop 리팩토링 계획안 file hooni 2017.05.15 764
21 Develop 링크들 보고 지울 내용 secret hooni 2019.11.21 0
20 Develop 모터에 대한 pid 제어.. ㅎㅎ file hooni 2013.04.23 18885
19 Develop 밸런싱 로봇.. 최종.. (관련 논문도 첨부) ㅋㅋ file hooni 2013.04.23 22827
18 Develop 베지어 곡선(Bézier curve) 알고리즘(spline 곡선) 3 file hooni 2013.04.23 33303
17 Develop 사이버보안실무 발표자료 (2017.06.08) file hooni 2017.06.05 1228
16 Develop 사이버보안실무 수업 메모 secret hooni 2017.03.23 0
15 Develop 서기의 PHP 동영상 강의(싱싱해) hooni 2013.05.15 30989
14 Develop 아이 훌레시 작업중 ㅋㅋ secret hooni 2013.08.09 0
13 Develop 알고리즘 성능 분석 기준 hooni 2014.06.24 2804
12 Develop 알고리즘 성능분석 file hooni 2014.06.24 2987
11 Develop 웹페이지 성능 테스트 툴 설명 hooni 2013.04.23 27456
10 Develop 이어서 작업할 내용~ secret hooni 2013.11.21 0
Board Pagination Prev 1 ... 49 50 51 52 53 Next
/ 53