1

hi i am using custom font xcode 5. its font family name is "Alegre Sans" i follow many tutorials online of using custom font in xcode.

I have include custom font file name "alegre.ttf" in xcode resources folder. also i include this file in project .plist under "Fonts provided by applications". and i am using this fond in viewdidload method of viewcontroller like this

CustomLabel* lblObj = [[CustomLabel alloc]initWithFrame:CGRectMake(121, 30, 0, 0)]; [lblObj setText:@"FREE TRAIL"]; [lblObj sizeToFit]; [lblObj setFont:[UIFont fontWithName:@"Alegre Sans" size:10.0]]; // [headerLabel setFont:[UIFont boldSystemFontOfSize:30.0]]; [lblObj setTextColor:[UIColor whiteColor]]; [lblObj setTextAlignment:NSTextAlignmentCenter]; [self.headerBgVw addSubview:lblObj]; 

but unable to change font.

I have wasted my whole day on it but not able to change font . is i am doing mistake in programing or including font file

4

1 Answer 1

6

The font's postscript name is AlegreSans

Update this line

[lblObj setFont:[UIFont fontWithName:@"Alegre Sans" size:10.0]]: 

to

[lblObj setFont:[UIFont fontWithName:@"AlegreSans" size:10.0]]; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.