//
//  SecondPageViewController.m
//  BJNotification
//
//  Created by WangXu on 15/11/11.
//  Copyright 漏 2015骞?beijiahiddink. All rights reserved.
//

#import "SecondPageViewController.h"
#import "BJNotification.h"

@interface SecondPageViewController ()

@property (weak, nonatomic) IBOutlet UILabel *tipLabel;

@end

@implementation SecondPageViewController

- (void)dealloc {
    [[BJNotificationCenter defaultCenter] removeObserver:self];
    NSLog(@"SecondPageViewController dealloc");
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"SecondPage";
    [[BJNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveTip:) name:@"TipNotification" object:nil];
    self.tipLabel.text = @"娌℃湁浠讳綍鎻愮ず";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)postNotificationEvent:(UIButton *)sender {
    [[BJNotificationCenter defaultCenter] postNotificationName:@"TipNotification" object:@[@"閫氱煡宸插彂閫?,[UIColor greenColor]]];
}

- (void)receiveTip:(BJNotification *)notification {
    NSArray *array = notification.object;
    self.tipLabel.text = array.firstObject;
    self.tipLabel.textColor = array.lastObject;
}


@end
// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com