Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone: How to remove all objects from a UIScrollView

Basically I want to remove all objects from a UIScrollView and I haven't yet found a solution to it because a simple "removeAllObjects" command doesn't work. Does anyone have an idea how to do it?

like image 955
Jeff Avatar asked Jul 12 '10 19:07

Jeff


2 Answers

Even easier:

[[scrollView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
like image 105
TomH Avatar answered Oct 01 '22 21:10

TomH


The easiest way:

for(UIView *subview in [scrollView subviews]) {

    [subview removeFromSuperview];

}
like image 22
iwasrobbed Avatar answered Oct 01 '22 20:10

iwasrobbed