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

 

?

  1. [svn] Can't convert string from native encoding to 'UTF-8' 메시지가 나오는 경우

    Date2014.12.18 CategorySystem/OS Byhooni Views993
    Read More
  2. [svn] SVN trunk 변경사항 되돌리기 (SVN Rollback)

    Date2014.11.27 CategorySystem/OS Byhooni Views1564
    Read More
  3. [ios] 비동기 블럭 코드 예제

    Date2014.11.21 CategoryDevelop Byhooni Views825
    Read More
  4. [ios] 스크린 캡쳐 (전원버튼 + 홈버튼) 호출 알아내기

    Date2014.11.19 CategoryDevelop Byhooni Views1556
    Read More
  5. [android] 가속도 센서를 이용한 흔듦(Shake) 감지

    Date2014.11.04 CategoryDevelop Byhooni Views1898
    Read More
  6. [web] 더 빠른 웹을 위한 프로토콜, 'HTTP/2'

    Date2014.10.20 CategoryDevelop Byhooni Views1641
    Read More
  7. GPL, AGPL, MPL,.. 한눈에 보는 오픈소스SW 라이선스

    Date2014.10.14 CategoryDevelop Byhooni Views1146
    Read More
  8. [js] 좋은 강연자료 & UI 자료

    Date2014.10.06 CategoryDevelop Byhooni Views909
    Read More
  9. '2014 모바일 개발 트렌드' 발표자료입니다.

    Date2014.10.02 CategoryDevelop Byhooni Views980
    Read More
  10. [ios] iOS 8 개발자가 우선 알아야 할 3가지

    Date2014.10.02 CategoryDevelop Byhooni Views902
    Read More
  11. [js] jQuery 셀 병합

    Date2014.09.23 CategoryDevelop Byhooni Views3492
    Read More
  12. IoT가 만드는 미래와 플랫폼 경쟁력

    Date2014.09.23 CategoryEtc Byhooni Views0
    Read More
  13. SVN(Subversion) 설치와 설정 (sasl 인증 적용 포함)

    Date2014.09.11 CategorySystem/OS Byhooni Views5671
    Read More
  14. [linux] yum 업데이트 시 커널 제외하기

    Date2014.09.11 CategorySystem/OS Byhooni Views1260
    Read More
  15. [ios] Xcode cannot run using the selected device

    Date2014.08.14 CategoryDevelop Byhooni Views1789
    Read More
  16. [ios] Objective-C 에서 자주 사용하는 수학 함수와 유용한 Define

    Date2014.08.08 CategoryDevelop Byhooni Views1860
    Read More
Board Pagination Prev 1 ... 15 16 17 18 19 ... 74 Next
/ 74