How to get a certain subview from UIView by tag

前端 未结 6 1100
野趣味
野趣味 2021-02-03 21:00

I\'m a noob in Objective-C and I have one question.

I have one UILabel object that I adding to one UIView with this code:

UILabel *label = [         


        
6条回答
  •  遥遥无期
    2021-02-03 21:38

    Swift 3.0 and Swift 4.0

    if let subLabel:UILabel = primaryView.viewWithTag(123) as? UILabel {
        subLabel.text = "do things here :-D"
    }
    

提交回复
热议问题