你的位置:首页 > 软件开发 > 操作系统 > 【代码笔记】关于UIFont的一些define

【代码笔记】关于UIFont的一些define

发布时间:2016-03-15 11:00:07
一,效果图。二,工程图。三,代码。RootViewController.h#import <UIKit/UIKit.h>@interface RootViewController : UIViewController@end RootViewController. ...

【代码笔记】关于UIFont的一些define

一,效果图。

【代码笔记】关于UIFont的一些define

二,工程图。

【代码笔记】关于UIFont的一些define

三,代码。

RootViewController.h

#import <UIKit/UIKit.h>@interface RootViewController : UIViewController@end
#import "RootViewController.h"#import "Utils.h"@interface RootViewController ()@end@implementation RootViewController- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];  if (self) {    // Custom initialization  }  return self;}- (void)viewDidLoad{  [super viewDidLoad];  // Do any additional setup after loading the view.    //初始化背景图  [self addView];    //初始化button  [self initButton];  }#pragma -mark -functions//初始化背景图-(void)addView{  self.title=@"UIFont";}//初始化button-(void)initButton{  UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(50, 100, 100, 50)];  [rightButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];  rightButton.backgroundColor=[UIColor redColor];  //给按钮上的字设置大小  [Utils setDefaultFont:rightButton size:20];  [rightButton setTitle:@"完成" forState:UIControlStateNormal];  [self.view addSubview:rightButton];}- (void)didReceiveMemoryWarning{  [super didReceiveMemoryWarning];  // Dispose of any resources that can be recreated.}
【代码笔记】关于UIFont的一些define

 

Utils.h

【代码笔记】关于UIFont的一些define
#import "Utils.h"@implementation Utils//给某个按钮上的数字设置大小+ (void)setDefaultFont:(id)sender size:(float)size{  [sender setFont:[UIFont fontWithName:@"Helvetica" size:size]];}@end
【代码笔记】关于UIFont的一些define

 


 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:【代码笔记】关于UIFont的一些define

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录