Q:

UISegmentControl not functioning?

I've hooked up a UISegmentControl in my navigation bar. It appears just fine, but when I tap the different segments, it doesn't execute cases 1 & 2 - it simply stays on case 0 (and thus, keeps logging "Requests!"). Any idea why this might be? See code below:
- (IBAction)segmentControl:(id)sender {

        switch (self.segmentControl.selectedSegmentIndex)
        {

            case 0:

                [self.tableView setHidden:NO];
                [self.neighboursView setHidden:YES];
                  [self.friendsView setHidden:YES];

                NSLog(@"Requests!");

                break;

            case 1: 

                [self.tableView setHidden:YES];
                [self.friendsView setHidden:NO];
                [self.neighboursView setHidden:YES];

                [self acceptedFriends];
                     NSLog(@"Friends!");

                break;

            case 2:

                [self.tableView setHidden:YES];
                [self.neighboursView setHidden:NO];
                [self.friendsView setHidden:YES];

                [self neighbourInfo];
                     NSLog(@"Neighbours!");
                break;

        }

    }

A:

Try this;
    -(IBAction)segmentControl:(id)sender {

      UISegmentedControl *segmentedControl = (UISegmentedControl *) sender;
      NSInteger selectedSegment = segmentedControl.selectedSegmentIndex;

      switch (selectedSegment)
            {
             case 0:
            .

            .

            .
            }
     }

