Search code examples
iphoneios-simulator

Cannot press button in iPhone simulator


I am following a very simple iOS development tutorial where I have two UIButtons on a window.

I connected the buttons to the IBActions and the buttons are enabled for user interaction.

When I launch the application in the simulator, I cannot click on the buttons. The buttons don't even change color to blue to indicate that they are pressed.

Does anyone have any ideas why this might be happening?

Thanks

Edit: Ok so my window does not have a view controller, I'm going to try and add one and see if it helps.


Solution

  • The most probable situation i can think of is that you didn't add button to the view..but just dropped in the IB and connected them .. in the view hierarchy on the left (in IB).. here will be

    • File Owner
    • First Responder
    • View

    Make sure the button are in the view...as in they are added to the view..