简体   繁体   English

在静态tableview单元格中将文本设置为动态

[英]Set text as dynamic in a static tableview cell

I'm attempting to set my UILabel as dynamic text. 我试图将我的UILabel设置为动态文本。 The UILabel appears in a static tableview cell. UILabel出现在静态tableview单元格中。 I have created an outlet for the UILabel in my TableViewController and then in viewDidAppear I attempt to make the label's text dynamic as follows: 我在TableViewController中为UILabel创建了一个出口,然后在viewDidAppear ,尝试使标签的文本动态化,如下所示:

override func viewDidAppear(animated: Bool) {
    tableView.reloadData()
    myLabel.font = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)

    myLabel.accessibilityLabel = myLabel.text
}

您应该将myLabel.text属性设置为myLabel.accessibilityLabel是出于可访问性目的

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

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