【问题标题】:UITextView Font SizeUITextView 字体大小
【发布时间】:2015-09-01 08:03:02
【问题描述】:

我有一个空白/空 UITextView,它将根据用户输入输出结果。一切都很好,一个小细节一直困扰着我——输出输出时的字体大小太小了,我不喜欢!我尝试在情节提要的“属性检查器”中更改它,但只有在我决定在输出之前在框中包含文本时才会影响它。

到目前为止我的代码是

class FreePointViewController: UIViewController {

@IBOutlet weak var fpCoilSizeInput: UITextField!
@IBOutlet weak var fpCoilThicknessInput: UITextField!
@IBOutlet weak var fpLengthInput: UITextField!
@IBOutlet weak var fpPullForceInput: UITextField!
@IBOutlet weak var freePointResult: UITextView!

    @IBAction func freePointButton(sender: AnyObject) {
    var freePointConst:Double = 20684

    calcFreePoint.freePointCoilSize = Double((fpCoilSizeInput.text as NSString).doubleValue)
    calcFreePoint.freePointCoilThickness = Double((fpCoilThicknessInput.text as NSString).doubleValue)
    calcFreePoint.freePointStretchPipe = Double((fpLengthInput.text as NSString).doubleValue)
    calcFreePoint.freePointPullForce = Double((fpPullForceInput.text as NSString).doubleValue)

    var freePointArea:Double = M_PI * (calcFreePoint.freePointCoilSize - calcFreePoint.freePointCoilThickness) * calcFreePoint.freePointCoilThickness

    var freePoint = (freePointConst * calcFreePoint.freePointStretchPipe * freePointArea) / calcFreePoint.freePointPullForce

    var freePointFormat = "0.2"

    freePointResult.text = "The pipe is stuck at \(freePoint.format(freePointFormat)) meters"


}

我尝试在 freePointResult.text = ... 行上方添加类似 [textView setFont:[UIFont boldSystemFontOfSize:15]]; 的代码,但无济于事。

【问题讨论】:

    标签: ios xcode swift uitextview


    【解决方案1】:

    我找到了我自己问题的答案...检查是否在 xib/Storyboard 属性检查器中选中了“可选”。如果不可选,则大小不会改变

    【讨论】:

      猜你喜欢
      • 2012-05-07
      • 1970-01-01
      • 2011-09-24
      • 1970-01-01
      • 2012-11-07
      • 2011-01-03
      • 2011-03-04
      • 2012-07-20
      • 1970-01-01
      相关资源
      最近更新 更多