Contents

Views 1852 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];
}

 


?

  1. [c#]뉴 툴바 개인적으로 만든거.. (new)

    Date2013.04.23 CategoryDevelop Byhooni Views7724
    Read More
  2. [mysql] MySQL 한글 깨짐 현상 해결하기(UTF8)

    Date2017.12.01 CategoryDatabase Byhooni Views7700
    Read More
  3. [c][php] 프로세스정보와 메모리 정보 웹으로 출력하는거..

    Date2013.04.23 CategoryDevelop Byhooni Views7662
    Read More
  4. [c#]업글 뉴 툴바 개인적으로 만든거.. (new) ㅋㅋ

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

    Date2013.04.23 CategoryDevelop Byhooni Views7612
    Read More
  6. [android] dp, px 서로 변환

    Date2016.10.21 CategoryDevelop Byhooni Views7608
    Read More
  7. [php] 3 Ways to Detect Mobile or Desktop in PHP

    Date2020.01.28 CategoryDevelop Byhooni Views7604
    Read More
  8. [js] 새로고침(refresh)방법과 다른 페이지 바꾸기..

    Date2003.04.23 CategoryDevelop Byhooni Views7603
    Read More
  9. Enable Safari Hidden Debug Menu in Mac OS X

    Date2017.02.07 CategorySystem/OS Byhooni Views7590
    Read More
  10. [java] 채팅창 처럼2.. swing..

    Date2013.04.23 CategoryDevelop Byhooni Views7577
    Read More
  11. [c] alarm()함수 설명과 간단한 예제

    Date2013.04.23 CategoryDevelop Byhooni Views7555
    Read More
  12. [java] 에디터.. swing 사용

    Date2013.04.23 CategoryDevelop Byhooni Views7505
    Read More
Board Pagination Prev 1 ... 67 68 69 70 71 72 73 74 75 76 ... 99 Next
/ 99