Remove white Space after hide views in scrollview?

前端 未结 1 1344
梦谈多话
梦谈多话 2021-01-25 17:41

I have UIScrollview with dynamic views(Label, Imageview) inside it. I hide some views but white blank space is there. how can I remove it?

I tried with

相关标签:
1条回答
  • 2021-01-25 17:45

    Just hiding views won't help, as it still will take place. You have several options: 1. Each of views inside scrollView should have height constraint that should be set to 0 when hiding is required. Then you should call

    [scrollView setNeedsLayout];
    [scrollView layoutIfNeeded];
    
    1. You can remove unneeded views from scrollView by calling

    [viewToHide removeFromSuperview];

    0 讨论(0)
提交回复
热议问题