UITextView字体大小

时间:2015-08-31 23:55:45

标签: ios xcode swift uitextview

我有一个空白/空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"


}

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

1 个答案:

答案 0 :(得分:0)

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