Contents

조회 수 657 댓글 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];
}

 


?

  1. [c++] 인라인 함수 설명과 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views6633
    Read More
  2. [c] 웅지학원 NAT를 소스코드로..

    Date2013.04.23 CategoryDevelop Byhooni Views6611
    Read More
  3. [c] 간단한 점 이동 샘플 소스코드

    Date2013.04.23 CategoryDevelop Byhooni Views6544
    Read More
  4. [c] 민수형 소스(도메인소켓포함)

    Date2013.04.23 CategoryDevelop Byhooni Views6522
    Read More
  5. [js] 새로고침(refresh)방법과 다른 페이지 바꾸기..

    Date2003.04.23 CategoryDevelop Byhooni Views6521
    Read More
  6. [c] 네트워크 보안 프로그래밍 과제 (Server,Agent,Client)

    Date2013.04.23 CategoryDevelop Byhooni Views6473
    Read More
  7. [js] 윤동이가 만든 영어 학습(?) 프로그램

    Date2013.04.23 CategoryDevelop Byhooni Views6462
    Read More
  8. [c] 메세지 프로그램 (Server - Agent - Client)

    Date2013.04.23 CategoryDevelop Byhooni Views6459
    Read More
  9. [php] 정규표현식 간단히 정리

    Date2013.04.23 CategoryDevelop Byhooni Views6455
    Read More
  10. [doc] C언어 문법 설명서

    Date2013.04.23 CategoryDevelop Byhooni Views6437
    Read More
  11. [java] 채팅창 처럼2.. swing..

    Date2013.04.23 CategoryDevelop Byhooni Views6423
    Read More
  12. [c] 다중연결 서버 만들기 #3 - poll() 사용

    Date2013.04.23 CategoryDevelop Byhooni Views6342
    Read More
Board Pagination Prev 1 ... 47 48 49 50 51 52 53 54 55 56 ... 71 Next
/ 71