About adding controls in UITableView

Discussion in 'iPhone/iPad Programming' started by iphonejudy, Sep 25, 2008.

  1. macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #1
    Hi,


    I want to add button in the UITableView,

    1) Can i add controls in the UITableView?

    2)If so,How Can we do?,What is the code we have to use for that?

    Can anybody please tell me ?


    Thanks
    judy
     
  2. macrumors member

    Joined:
    Jul 9, 2008
    #2
    Depends on what you mean by adding controls in UITableView.

    The simplest answer is that you can add any control you want to a UITableView cell by calling cell.contentView addSubView:myControl.

    You can also add controls to the header and footer cells of a table, using similar code.

    Hope that helps!
     
  3. thread starter macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #3
    :apple:
    Hi,Thanks for ur reply

    I want to add a button in the UITableView,
    Can i have a brief code for that?

    Thanks
    judy
     
  4. macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #4
    You're still not entirely clear :p. Did you mean in the TableView or in one of the cells? If it's in the tableview, you'd need to do something like [self.view addSubview:button]. If it's in the cell then you'd need to do something like [cell addSubview: button].
     
  5. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #5
    Check the UICatalog example for code that does exactly that.
     

Share This Page