Resolved custom font for Custom UITableViewCell

Discussion in 'iOS Programming' started by erdinc27, Apr 17, 2014.

  1. erdinc27, Apr 17, 2014
    Last edited: May 2, 2014

    erdinc27 macrumors regular

    Jul 20, 2011
    i want to use a custom font for my application. i added font file to my app and the in info.plist i added a new row Fonts Provided By Application as an array and added my font OpenSansBold.ttf. and the font file can be seen in Build Phases also. In the table view cell i want to use that font so i wrote this.
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        static NSString *cellID = @"HaberCell";
        HaberCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
        if (cell == nil)
            cell = [[HaberCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        Haber *currentHaber = [self.arrHaberler objectAtIndex:indexPath.row];
        cell.haberLbl.text = currentHaber.haberTitle;
        cell.haberLbl.font = [UIFont fontWithName:@"OpenSansBold" size:12];
        return cell;
    but it cant be seen in the right font format. how can i change the label's font here ?
  2. dantastic macrumors 6502a


    Jan 21, 2011
    you're doing it right but it can be tricky to know what a font is actually named.

    start by logging this fella
    [UIFont familyNames]
    Then find the font family you're after in the list and print out this fella
    [UIFont fontNamesForFamilyName:@"myFont"]
    That will tell you what you should name the font you are trying to load.
  3. D.T. macrumors G3


    Sep 15, 2011
    Vilano Beach, FL
    Yeah, it’s the internal font name, not the TTF filename. A quick search seems to indicate this font name should be:

  4. TheWatchfulOne macrumors 6502


    Jun 19, 2009
    iOS Fonts List

    Looking at Apple's documentation, I found a very useful page that lists all fonts installed with iOS 7 and additional fonts which apps can downloaded.
  5. erdinc27 thread starter macrumors regular

    Jul 20, 2011
    thanks for the help guys. i solved the problem by your suggestions
  6. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Can you tag the thread as Resolved then? Thanks.

Share This Page