bobbypage
bobbypage

Reputation: 2169

How to post NSNotificationCenter if orientation is landscape?

I would my view controller to post a notification used NSNotificationCenter if the orientation is landscape. I'm currently doing this:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
    if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) {

    [[NSNotificationCenter defaultCenter] postNotificationName:@"change" object:self];
    }
}

I don't seem to get a response in my other file. What am I doing wrong?

Upvotes: 0

Views: 246

Answers (1)

Matt Long
Matt Long

Reputation: 24476

You're returning YES before you send your notification. It never gets called.

Upvotes: 1

Related Questions