我只是想修改UITextView的字符大小。直到现在可以附加字符串,但我试着改变尺寸:是不可能的。 当我搜索论坛时,我发现有些人选择了Editable
并取消选择它。其他人通过从视图属性中选择Selectable
来获得它。然后我尝试了这种方式......没办法改变。只有纯文本。UiTextView更改字体大小不起作用
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!))
}}}
嗯我在哪里出错了? 因为我改变了textMuseum字体。我应该释放一些Costraint放在StoryBoard中的UITextView对象吗?也用editable
和selectable
删除的结果是一样的。为什么?
谢谢你的帮助。
编辑: 添加Git仓库 - 没有工作视频,因为我删除了这部分。要查看问题,只需点击uisegmented“testo”并选择播放或表格即可。
https://github.com/sanxius/TryText.git
检查你的字体家族包含的字体是否可用,如果可用检查空间和名称一次 –
@ Anbu.Karthik我改变了字体,我把HelveticaNeue(系统标准)...结果相同。 – SanXiuS