I have a custom UIViewController
, called BoardViewController
, and I have subclassed this to create GameBoardViewController
. I added an NSNotificationCenter observer in viewDidLoad
of BoardViewController
. When I segue from another view controller to GameBoardViewController
it seems this observer is duplicated somehow. Because now, whenever I cause that particular notification to be posted, the method called from the observer is called twice. I have tested making GameBoardViewController
the initial view controller in the storyboard and there are no issues. It only happens when I segue to it.
Thanks for any help you can provide.
BoardViewController:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gameBoardTileWasTapped:) name:@"gameBoardTileWasTapped" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(log:) name:nil object:nil];
}
GameBoardViewController:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}