reload/refresh subViews - setNeedsDisplay doesnt work

后端 未结 3 1817
一向
一向 2020-12-17 04:11

i have trouble with setNeedsDisplay. I have an UIView with a lot of sub UIViews, created in Inteface Builder. I have also an Button with IBAction. In this IBAction i want to

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 04:39

    Swift 2

    This is a replica of Nick Lockwood's answer for some easy copy paste

    let parent = self.view.superview
    self.view.removeFromSuperview()
    self.view = nil
    parent?.addSubview(self.view)
    

提交回复
热议问题