首页 > 移动平台 > 详细

ios字体大小适应不同屏幕

时间:2016-06-14 11:49:56      阅读:327      评论:0      收藏:0      [点我收藏+]

//根据button高度来设置字体大小

CGFloat dayLabelWidth = (viewWidth-10)/7-1;

    cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(viewWidth/2, viewHeight-dayLabelWidth*1.2, viewWidth/2, dayLabelWidth*1.2)];

    cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:dayLabelWidth*0.5];

    [cancelButton setTitle:@"取消" forState:UIControlStateNormal];

    cancelButton.backgroundColor = [UIColor grayColor];

    [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

    [cancelButton addTarget:self action:@selector(cancelSelectCurrentDate) forControlEvents:UIControlEventTouchUpInside];

   [self addSubview:cancelButton fixedOn:viewName fixed:true];

ios字体大小适应不同屏幕

原文:http://www.cnblogs.com/liuting-1204/p/5583200.html

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