I have a login/signup page that is changed using a segmented control. The login page is generic and the self.title = @"login" and the bar item = login to send login request. However when the user selected the signup segmented control I want to refresh the navigation bar to display the self.title = @"Sign Up" and the bar button = sign up to send a register request. I have used this code in the segmented control is:

1 Answer
1

Assuming the first block of code is located in the viewDidLoad method, you'll need to change your UIViewController so that the title and button are altered when the UISegmentedControl's value changes. In other words, try moving the first block of code to the segmentSwitch: method.

The reason why your code isn't working is because viewDidLoad only gets called once, and so the first block of code is only executed once, while you want it executed every time the user selects a new segment.