Remove all subviews?

前端 未结 15 1729

When my app gets back to its root view controller, in the viewDidAppear: method I need to remove all subviews.

How can I do this?

15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 00:51

    Use the Following code to remove all subviews.

    for (UIView *view in [self.view subviews]) 
    {
     [view removeFromSuperview];
    }
    

提交回复
热议问题