How to Use an UIButton to control an event *PLEASE HELP*

Discussion in 'iOS Programming' started by Schnarr, Jun 30, 2009.

  1. Schnarr macrumors newbie

    Oct 6, 2008
    I have a utility app I'm building with the two sides. On the FlipSide I have 9 UIButtons. I want to be able to use those buttons to control the background color on the Main screen. What code would I have to use to be able to do that, and where will I need to place the code?

    Thanks for the Help! If you need further clarification, please ask
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    You need to make the MainView or it's background color, from the MainViewController accessible from the FlipsideViewController. This can be achieved by creating a setter for it in MainViewController's code (using an @property might be a good way to go). Then you need to find a way to get access to the MainViewController instance from within the FlipsideViewController instance, either via the AppDelegate or an instance-variable within FlipsideViewController that you assign. Then you should set up an IBAction method, that the buttons use, that actually does the setting.

    Hope that covers the basic approach. At least, that's how I'd approach it.

Share This Page