Reputation: 237
I have two cells:
like taskcella, taskcellb
but it dynamically returns only 1 cell data
is there possible to add and return multiple cellidentifiers?
public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
{
// in a Storyboard, Dequeue will ALWAYS return a cell,
UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
cell.TextLabel.Text = "Görev : " + tableItemsX[indexPath.Row].Gorev;
UITableViewCell celld = tableView.DequeueReusableCell (cellIdentifierd);
celld.TextLabel.Text = "İşlem : " + tableItemsX[indexPath.Row].Gorev;
return celld; return cell;
}
this is code which return first, returns first
Upvotes: 0
Views: 138
Reputation: 1292
First of all make sure that in you TableViewSource
you override method RowsInSection
and it's returns 2
public override int RowsInSection(UITableView tableview, int section)
{
return 2;
}
Then rewrite you GetCell
method in the next way
public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
{
if (indexPath.Row == 0)
{
UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
cell.TextLabel.Text = "Görev : " + tableItemsX[indexPath.Row].Gorev;
return cell;
}
else
{
UITableViewCell celld = tableView.DequeueReusableCell (cellIdentifierd);
celld.TextLabel.Text = "İşlem : " + tableItemsX[indexPath.Row].Gorev;
return celld;
}
}
Upvotes: 1