首页 > 其他 > 详细

使用一个类封装所有字体的设置

时间:2015-07-23 00:37:38      阅读:246      评论:0      收藏:0      [点我收藏+]

首先,定义好字体样式plist配置文件

技术分享

 

技术分享

 

然后写一个类,封装plist字体配置文件读取、给UILabel设置字体、UIButton设置字体、UITextfiled设置字体 ....

 

#import <Foundation/Foundation.h>

@interface FontManager : NSObject

@property (nonatomic, strong, readonly) NSDictionary *fontList;

+ (instancetype)sharedManager;

//加载本地字体Plist文件
//- (void)setupFontList;

//给Label设置字体
- (void)setLabel:(id)sender withText:(NSString*)aText andFontKey:(NSString*)key;

//给Button设置字体
- (void)setButton:(id)sender fontKey:(NSString*)fontKey buttonState:(UIControlState)controlState;

//给Textfiled设置字体
- (void)setTextfiled:(id)sender WithText:(NSString*)aText Fontkey:(NSString*)key PlaceHolderKey:(NSString*)placeHolder;

- (UIFont*)getFontWithFontKey:(NSString*)key;
- (UIColor*)getColorWithFontKey:(NSString*)key;

@end

 

剩下 .m实现就不贴了,很简单。

使用一个类封装所有字体的设置

原文:http://www.cnblogs.com/xiongzenghui/p/4669043.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!