Forum Xamarin Xamarin.iOS

How to add a row manually on table..

RomuloVielRomuloViel USMember ✭✭

My table auto complete with array. I use
cell.TextLabel.Text = "information here"

I want to complete another row manually. Up is the array but I want to put in the last row, which is out of the array, "Apple"
or in the first row, second, middle... however..

How I do that?


  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    You can just update the array in your TableViewSource and call the ReloadData() method of your table.

  • RomuloVielRomuloViel USMember ✭✭
    edited August 2014

    No, it isn't work :s

    I call two times:

    `UITableViewCell cell = tableView.DequeueReusableCell (cellID);

    cell.TextLabel.Text = servName.ToString ();

    cell.TextLabel.Text = service.Peripheral.Name.ToString ();

    tableView.ReloadData ();

    return cell;`

  • rmaciasrmacias USBeta, University ✭✭✭✭✭
    edited August 2014

    You're not making any sense. I'm not quite sure the issue you're having. I'd suggest looking at the Working With Tables tutorial.

  • RomuloVielRomuloViel USMember ✭✭

    here Is my code:
    `public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
    UITableViewCell cell = tableView.DequeueReusableCell (cellID);

                if (cell == null) {
                    cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellID);
                CBService service = this._services [indexPath.Row];
                //Here is what already on the table...
                cell.TextLabel.Text = servName.ToString ();
                //Here is what I wanna to add to the last cell..
                //cel.TextLabel.Text = service.Peripheral.Name.ToString();
                cell.DetailTextLabel.Text = "UUID:" + service.UUID.ToString ();
                return cell;

    But if I add the two lines one overrides the other in the table.
    The first populates the table and I want the other aparareca command on another line ... how do I do that?

Sign In or Register to comment.