ios字体大小适应不同屏幕


//根据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];


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM