How to change the uitextview font size

前端 未结 7 860
轮回少年
轮回少年 2020-12-13 03:38

can any one help to change the font size in UITextView.

[textView setFont:[UIFont fontWithName:@\"ArialMT\" size:30]];

I use t

相关标签:
7条回答
  • 2020-12-13 04:16

    Have you bind textView with xib or allocated textView?

    If yes,

    You can use following code to check whether this works

    [textView setFont:[UIFont boldSystemFontOfSize:15]];
    

    or

     [textView setFont:[UIFont systemFontOfSize:15]];
    
    0 讨论(0)
  • 2020-12-13 04:19

    Here is for swift 3.0

    textview.font = UIFont(name: textview.font.fontName, size: 18)
    
    0 讨论(0)
  • 2020-12-13 04:24

    Check, if "Selectable" is checked in the xib/Storyboard attribute inspector. If it's not selectable, the size wont be changed

    0 讨论(0)
  • 2020-12-13 04:29
    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
    [textView  setFont: [UIFont fontWithName:@"ArialMT" size:30]];
    textView.text = @"test my font size";
    [self.view addSubview:textView];
    [textView release];
    

    Your code is correct. The problem is from other part of your code. Provide more details about your textView

    0 讨论(0)
  • 2020-12-13 04:29

    I tried it the same way like you with

    [textView setFont:[UIFont fontWithName:kFontName size:kFontSize]];
    

    I set the UITextView inside ViewDidLoad. My problem was, I transformed my view:

    [_viewEnd setTransform:CGAffineTransformMakeScale(0.0, 0.0)];
    

    My problem was solved with setting the properties of the UITextView after transforming my UIView which includes the UITextView.

    0 讨论(0)
  • 2020-12-13 04:33

    Swift 4.0

    textField.font = UIFont.systemFont(ofSize: 17.0)
    
    0 讨论(0)
提交回复
热议问题