PDA

View Full Version : UITableViewStyleGrouped & Plain




sujithkrishnan
Jul 10, 2008, 03:35 AM
Hi,

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???



Enuratique
Jul 10, 2008, 09:38 AM
Hi,

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???

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 (http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath:) method... You would put this in the same class you're setting the cell text.