Add UISwitch Control at runtime.

Discussion in 'iOS Programming' started by Amit Jain, May 25, 2009.

  1. Amit Jain macrumors member

    Apr 9, 2007
    Hi All,

    Actaully what I need is ..
    Suppose I have 4 rows and each has a switch which are sharing a same action method as they are added at runtime. (Ex: a multiple choice question with 4 options).
    Now what I want is if user selects any switch suppose he selects option A...then action method willbe called and I will come to know the state of the switch(ON/OFF) but how I will come top know that which row (or option A/B/C/D) is being selected as the action for all the switches is same.
    I know one very basic answer will be "make 4 actions for each switch". But only want to use single action method.
    I think now its slear what I need.
    p.s. sorry for so long question .;)
  2. johnnyjibbs macrumors 68030


    Sep 18, 2003
    London, UK
    I think there is an Apple example called TouchCells or something like that, which I believe sets up a table view with switches in each cell. It might be worth having a look at that since I think it does something similar to what you want to do.

Share This Page