How to integrate and use Font Awesome with Objective-C or Swift in an Xcode project?

后端 未结 17 1408
不思量自难忘°
不思量自难忘° 2020-12-12 18:07

So I am trying to use this font http://fortawesome.github.com/Font-Awesome/. I\'ve added the font as a resource and put it in the plist file. Here\'s how I am using it:

17条回答
  •  不思量自难忘°
    2020-12-12 18:53

    Below is the code to set image to a UIButton using FontAwesome

     UIButton *btnMenu = [UIButton buttonWithType:UIButtonTypeCustom];
     btnMenu.frame = CGRectMake(0, 0, 40, 32);
     [btnMenu setTitle:@"\uf0c9" forState:UIControlStateNormal];
     [btnMenu setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
     [btnMenu.titleLabel setFont:[UIFont fontWithName:@"FontAwesome" size:16]];
    

提交回复
热议问题