Thursday 15 September 2011

ios - Adding Multiple Font Types From The Same Family To Xcode 6 -



ios - Adding Multiple Font Types From The Same Family To Xcode 6 -

i trying add together multiple fonts xcode 6. problem when there multiple styles of same family example:

"mensch-bold" "mensch-thin"

when open these fonts same name raw font file shown below:

when add together these fonts, update .plist file fonts etc, can "mensch" work. cannot of sub families, , it's because named same "mensch" despite variations.

is there work around this? know how can install multiple font styles of same font family?

probably have installed both families. xcode6 shows custom fonts in attributes tab if have more 1 style same font family 1 of them shows up. can utilize subclasses working.

first find font names have installed using next code: (adding custom fonts ios app finding real names)

static void dumpallfonts() { (nsstring *familyname in [uifont familynames]) { (nsstring *fontname in [uifont fontnamesforfamilyname:familyname]) { nslog(@"%@", fontname); } } }

then add together subclass, , utilize font name got previous code. next illustration uilabel.

@interface customfontlabel : uilabel @end @implementation customfontlabel - (void)awakefromnib { [super awakefromnib]; self.font = [uifont fontwithname:@"mensch" size:self.font.pointsize]; } - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { self.font = [uifont fontwithname:@"mensch" size:self.font.pointsize]; } homecoming self; } @end

after can alter class of label customfontlabel xib file.

ios fonts uilabel plist xcode6

No comments:

Post a Comment