【问题标题】:Edit UITextField Font Size with UIStepper使用 UIStepper 编辑 UITextField 字体大小
【发布时间】:2012-07-17 03:32:48
【问题描述】:

有没有办法用 UIStepper 编辑 UITextField 的字体大小?即,点击添加按钮,UITextField 的字体大小增加 1 或 5?到目前为止,我已经尝试过[textField adjustsFontSizeToFitWidth:value];,但没有成功。我怎么能这样做?另外,如果我不能用 UIStepper 控制字体大小,我还能如何编辑字体大小?谢谢

【问题讨论】:

    标签: ios xcode uitextfield font-size uistepper


    【解决方案1】:

    我认为你应该使用:

    [textField setFont:[UIFont systemFontOfSize:value]];
    

    【讨论】:

      【解决方案2】:
      UIFont *textFont = [UIFont fontWithName:@"Helvetica-Bold" size:8.0];
      [textField setFont:textFont];
      

      试试这个...

      【讨论】:

      • 这与使用 UISteppers 值作为字体大小无关。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-30
      • 2012-03-10
      • 1970-01-01
      • 1970-01-01
      • 2017-03-25
      • 1970-01-01
      相关资源
      最近更新 更多