阅读背景:

如何设置可能有也可能没有文本的设置标签?

来源:互联网 

Im a developing an iOS app in Swift and I have an array of strings that I have broken down to separate string literals by creating a new variable that is the array and one of its indexes. I want to put each new created string in a text label and display in it in my view controller. I want the labels to be stacked on top of each vertically, however I don't want the label to appear in the view controller if the that string turns out to be nil. The string may or may not have a value depending on if the user decides to fill it with data and I retrieve through firebase. I don't believe this is related to firebase though. I am just curious what would be the most efficient way of displaying these labels on top of one another, yet if one equals nil that label's size is reduced to zero and the next label that comes behind (again depending on if it contains a value or not) replaces that one. This is because I don't want the label taking up space in the view controller if doesn't hold a value. Im a developing an iOS app in Swift and I have




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: