Code Code - 8 months ago 39
iOS Question

What is the best way to remove all subviews from you self.view?

I was thinking maybe something like this might work:

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

I want to remove every kind of subview. UIImages, Buttons, Textfields etc.

Max Max
[self.view.subviews makeObjectsPerformSelector: @selector(removeFromSuperview)];

It's identical to your variant, but slightly shorter.