Delete content in UIScrollView Programmatically?

How do you delete content in a UIScrollView programmatically? Since I have to frequently update the content in it.

+3
source share
4 answers

You can scroll the subzones of the scroll view, for example:

for(UIView *subview in scrollView.subviews)
    [subview removeFromSuperview];

or you can use a method - [NSArray makeObjectsPerformSelector:], for example:

[scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
+6
source

I do not think that there is a difference between a typical UIView:

for (UIView *v in [scrollView subviews])
    [v removeFromSuperView];
+6
source
for(UIView *vw in [scrView subViews])
  [vw removeFromSuperView];

, scrollview

+5

.

[[myScrollView viewWithTag:myButtonTag] removeFromSuperview];
+4

All Articles