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