Best way to refresh/reload UIScrollView

前端 未结 6 1979
走了就别回头了
走了就别回头了 2021-01-04 05:59

I have a method that adds some subviews (images/buttons) to my ScrollView.

The thing is that from outside of the ScrollView the user can tap a button that will chang

6条回答
  •  臣服心动
    2021-01-04 06:16

    This is kind of an old thread, but a slightly easier method might just be to add a tag to the view's your adding to the UIScrollView, let's say 15. Then

    for (UIView * view in _scrollView.subviews) {
        if (view.tag == 15) {
            [view removeFromSuperview];
        }
    }
    

    this way you can be sure that only the view's you have added get removed. Just a thought.

提交回复
热议问题