Hello. I'm a relatively new iphone programmer, but this seemingly simple task is frustrating me. On a fully programmatically-created interface, I have three views: two main views, and a settings view. In the settings view, I have a segmented control, and a "done" button. I would like to make it so that when the user picks either of the two segmented options (each cooresponding to a separate view), pushing the done button then takes him to the chosen view. Currently, I have tested and confirmed that when i set the action of the done button to either view manually, I can access each view, but when I set up some if-statements that determine the action of the button depending on the chosen segment, it doesn't seem to work. I put this code right after the code that places the done button, and my if statement was similar to this: if(segmentedcontrol.selectedSegmentIndex ==0)... I'm not absolutely sure if this is the correct method for determining the selected segment... My question is, How exactly can I set up my code to work in this fashion? Can I set up a method with the aforementioned if-statement idea or is there something better?