【发布时间】: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