UITableViewStyleGrouped & Plain

Discussion in 'iOS Programming' started by sujithkrishnan, Jul 10, 2008.

  1. sujithkrishnan macrumors 6502

    May 9, 2008

    In my iPhone app, i made use of UITablView, with both styles..

    I am assigning UITablevIewCell's text as

    cell.text = presentItem.title;
    Then the text on cell is showing clearly....

    Say .... "item number 1", "item number 2",.... etc...

    If i am changing the style of table (during init) to UITablevIewStyleGrouped,
    the cell.text are shown as having trailing ends for all cells...

    like .... "item num...","item num..." etc...

    Also the separation line is breaking below the texts. i felt the dimension of cell.text n Grouped style is having higher height and lower width than Plain style... (However its not in developer's control i think..)

    But for UITableViewStyleGrouped, if i change the line as

    cell.text = @"item number" // statically assigning

    it will show perfectly for all cells.......

    say .."item number","item number".....

    Why such things happen with dynamic strings ???

    I want my table in grouped style...

    What are the other changes than in look-style happen when we change the tableViewStyle ??

    What i marked RED (above) is right, why the behaviour change with static string and dynamic string???
  2. Enuratique macrumors 6502

    Apr 28, 2008
    I'm not entirely sure why a static string would work versus a dynamic string, but you do atleast have control over the cell's height... Take a look at UITableViewDelegate's heightForRowAtIndexPath method... You would put this in the same class you're setting the cell text.

Share This Page