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. [android] 안드로이드 동영상 스트리밍 예제

    Date2015.01.02 CategoryDevelop Byhooni Views4813
    Read More
  2. [java] netty (비동기 이벤트 방식 네트워크 프레임워크) 사용법 #2 (client)

    Date2015.01.02 CategoryDevelop Byhooni Views2037
    Read More
  3. [java] netty (비동기 이벤트 방식 네트워크 프레임워크) 사용법 #1 (server)

    Date2015.01.02 CategoryDevelop Byhooni Views2212
    Read More
  4. ZBar 라이브러리를 이용한 바코드 스캔 앱 개발하기

    Date2015.01.01 CategoryDevelop Byhooni Views1628
    Read More
  5. [ios] 비동기 블럭 코드 예제

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

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

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

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

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

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

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

    Date2014.10.02 CategoryDevelop Byhooni Views900
    Read More
  13. [js] jQuery 셀 병합

    Date2014.09.23 CategoryDevelop Byhooni Views3490
    Read More
  14. [ios] Xcode cannot run using the selected device

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

    Date2014.08.08 CategoryDevelop Byhooni Views1858
    Read More
  16. [ios] 카테고리 확장 메소드를 찾지 못하는 경우

    Date2014.08.08 CategoryDevelop Byhooni Views1993
    Read More
Board Pagination Prev 1 ... 9 10 11 12 13 ... 53 Next
/ 53