Forum Xamarin.iOS

Fonts are different when using code vs Storyboard

ziggyziggy Member ✭✭
edited February 2019 in Xamarin.iOS

I am going thru the IOS 101 class and I do not know why the font /display is different for the code based approach and storyboard approach

  1. code based approach:

            // create empty table cell with subtitle style
            var cell = tableView.DequeueReusableCell(CellId);
            // check if the cell has not yet been created
            if (cell == null)
                // create a new cell and define its properties that do not change
                cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellId);
                cell.TextLabel.Font = UIFont.FromName("Helvetica Light", 14);
                cell.DetailTextLabel.Font = UIFont.FromName("Helvetica Light", 12);
                cell.DetailTextLabel.TextColor = UIColor.LightGray;
                // put an accessory view
                cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
  2. story board approach

    • I set the font in the designer.

Unfortunately, I am unable to post photos yet since I am new considering I am a paid customer

Best Answer


  • ziggyziggy Member ✭✭

    This one works! Thanks for that. I wonder why this was not brought up in the video class

Sign In or Register to comment.