iphoneuisegmentedcontrolgrouped-table

Add UISegmentedControl in table cell programmatically with clear background


I have grouped table view. I want to add UISegmentedControl in table cell with clear background so that it will be displayed as FOOTER . How can I do this? I tried using clearColor. But it's not working.


Solution

  • Set the background view with a clear UIView object like so:

    UIView *clearView = [[UIView alloc] initWithFrame:CGRectZero];
    [clearView setBackgroundColor:[UIColor clearColor]];
    [self setBackgroundView:clearView];
    [clearView release];
    

    And make sure you set cell selection style to none.

    Edit: added some square brackets