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

相关文章:

  • 2021-04-04
  • 2022-12-23
  • 2021-10-02
  • 2021-12-06
  • 2022-01-26
  • 2021-12-18
  • 2021-11-17
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-10-30
  • 2021-11-18
相关资源
相似解决方案