IOS development-UIScrollView trap-delete all sub-views, the scroll bar (indicator) disappears, and the uiscrollview scroll bar
UIScrollView is often used to clear a view. The common practice is:
For (UIView * subview in self. scrollView. subviews) {[subview removeFromSuperview];}
Or:
[Self. scrollView. subviews makeObjectsPerformSelector: @ selector (removeFromSuperview)];
But have you found that, after doing so, when you re-Add the content and slide the UIScrollView again, the scroll bar will disappear !!
Therefore, do not clear the view in the preceding method, but add your tag to the content added to UIScroView. filter the content when deleting the View:
Self. v1.tag = kWCScrollViewCustomItemViewTag; [self. scrollView addSubview: self. v1]; //... add more items for (UIView * subview in self. scrollView. subviews) {if (subview. tag = kWCScrollViewCustomItemViewTag) {[subview removeFromSuperview];}