How to change UITableView cell style dynamically

2009-11-21 Thread Tharindu Madushanka
Hi I am trying to create a table with a single cell like in Contacts Application top one. What I want is change the cell style time to time. But changing the style does not work even I call [tableview reloadData] it seems like cell style is not changing I want to switch between Default cell

Re: How to change UITableView cell style dynamically

2009-11-21 Thread Tharindu Madushanka
Hi Removing reuse identifier solved the problem so now I am creating a cell like below. It worked. UITableViewCellStyle style; if(profile.name.length 0) { style = UITableViewCellStyleSubview; } else { style = UITableViewCellStyleDefault; } UITableViewCell *cell = [[[UITableViewCell

Re: How to change UITableView cell style dynamically

2009-11-21 Thread Karolis Ramanauskas
I don't see an example of how you are creating cells in your first post. But in case you were using the same string for the reuse identifier then when the cell is loaded the second time it will not switch to a different style. Because whatever cell was cashed the first time it will be reused.

Re: How to change UITableView cell style dynamically

2009-11-21 Thread Luke Hiesterman
If you have 2 different styles of cells then you should have 2 different reuse identifiers. Then when you dequeue, you ask for an available cell of the apropeiate type. Luke Sent from my iPhone. On Nov 21, 2009, at 1:55 AM, Tharindu Madushanka tharindu...@gmail.com wrote: Hi Removing

Re: How to change UITableView cell style dynamically

2009-11-21 Thread Tharindu Madushanka
mm ok I will add two types of cells. But since its only a single cell table, I thought there would not be any performance issue or something doing that. On Sat, Nov 21, 2009 at 8:01 PM, Luke Hiesterman luket...@apple.com wrote: If you have 2 different styles of cells then you should have 2

Re: How to change UITableView cell style dynamically

2009-11-21 Thread Luke Hiesterman
I'm sure you could get away without doing that in this case because your table is so simple. The solution I gave you, though, will scale in case you ever need to do it on a bigger table. Luke Sent from my iPhone. On Nov 21, 2009, at 6:38 AM, Tharindu Madushanka tharindu...@gmail.com