Delete all objects from uiview?

I have a UIview that I draw a series of buttons on. I want to change these buttons depending on the choice the user makes. This works well ... but I cannot remove the buttons that were already there.

This is a UIScrollView with a view added as a subtitle. This is a peep that I need to basically β€œclear” / erase. There is nothing in this view in the interface builder. I just add it to my code.

I looked around and watched how to do subViewcontroller setNeedsDisplay, but nothing works.

any ideas? Thanks for any help.

+6
iphone uiview
source share
1 answer

I really understood how to do what I need ... but I still would like to see what people suggested.

I wanted to remove all the buttons in my view that were assigned to UIScrollView. I KNOW that they are only added to buttons, so I just looped them around, deleting them one at a time.

for (UIButton *aButton in [viewBasicItems subviews]) { [aButton removeFromSuperview]; } 
+9
source share

All Articles