UiTextView font resizing not working

I just want to resize a UITextView character. you can still attach a string, but I'm trying to resize: impossible. When I searched the forum, I found that some people selected Editableand canceled it. Other people got it by choosing SelectableView in the properties. Then I tried this way ... in no way changed. Just plain text.

import UIKit
@objc(TextControllerSwift) class TextControllerSwift: UIViewController {

var selectedMovie: String?
var textPlaying: String?

@IBOutlet weak var textMuseum: UITextView!
override func viewDidLoad() {
    super.viewDidLoad()
    realPlay()
}

func playText(textSelect: String) {
textPlaying = textSelect 
}

//Giving the time to Segue method to wakeup.
func realPlay(){
var textRoom: String?

//reading the file .txt
let path = NSBundle.mainBundle().pathForResource(textPlaying, ofType:"txt")
if (path != nil){
        do {
      textRoom= try String(contentsOfFile: path!, encoding: NSUTF8StringEncoding)  
//here i'm getting the string.
}
catch {/* ignore it */}
//i tried it these options...
textMuseum.editable=true
textMuseum.selectable=true  
textMuseum!.text=""

//Got the text, now i put into UiView
textMuseum.font = UIFont(name: "Arial-Unicode", size: 50)
textMuseum.text=textMuseum.text.stringByAppendingString(String(textRoom!))
}}}

hmmm where am i wrong? because I changed the font of textMuseum. Should I free some Costraint on a UITextView object set to StoryBoard? also when deleting Editable, the Selectableresult is the same. why?

Thank you for any help.

EDIT: Git - , . , "testo" uisegmented .

https://github.com/sanxius/TryText.git

+4
1

:

  • UITextView: textMuseum.selectable = true
  • , , Info.plist Fonts provided by application.
  • . Arial-Unicode. Arial-Unicode.ttf - , .

, :

for familyName in UIFont.familyNames() {
    for fontName in UIFont.fontNamesForFamilyName(familyName) {
        print(fontName)
    }
}

, iOS Arial, UIFont(name: "ArialMT", size: 50). Arial-Unicode.ttf.

+2

Source: https://habr.com/ru/post/1610280/


All Articles