samedi 23 juillet 2016

How to format certain words of a cell's text label

I have a xamarin iOS project where I am displaying a cell with x lines of text. I currently define my cells like so:

public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
    {
        UITableViewCell cell = tableView.DequeueReusableCell ("cells");
        ...
        cell.TextLabel.Lines = 0;
        cell.TextLabel.Text = "Bold: " + info1 + "Bold: " + info2;

        ...
    }

Which displays the cell like:

   +----------------------+
   |Bold: Testing         |
   |Bold: Testing2        |
   +----------------------+

I want to be able to turn just the Bold text to the bold font and keep the other info in normal text font. Is this possible given my current approach?

Aucun commentaire:

Enregistrer un commentaire