简体   繁体   English

UITextView字体大小

[英]UITextView Font Size

I have a blank/empty UITextView that will output a result based on user-inputs. 我有一个空白/空的UITextView,它将根据用户输入输出结果。 Everything works great with one small detail that's been bugging me - the font size when it delivers the output is too small for my liking! 一切都很正常,一个小细节一直困扰着我-交付输出时的字体大小对于我来说太小了! I tried changing it in the "Attributes Inspector" of storyboard but that only affects it if I decide to have text in the box prior to an output. 我尝试在情节提要的“属性检查器”中对其进行更改,但这仅在我决定在输出之前在框中包含文本时才会影响它。

My code thus far is 到目前为止,我的代码是

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"


}

I've tried adding code like [textView setFont:[UIFont boldSystemFontOfSize:15]]; 我尝试添加类似[textView setFont:[UIFont boldSystemFontOfSize:15]]; just above my freePointResult.text = ... line but to no avail. 就在我的freePointResult.text = ...行上方,但无济于事。

I found the answer to my own question...Check if "Selectable" is checked in the xib/Storyboard attribute inspector. 我找到了自己的问题的答案...检查xib / Storyboard属性检查器中是否选中了“ Selectable”。 If it's not selectable, the size wont be changed 如果无法选择,则不会更改大小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM