Categories: iOS

【iOS】UIScrollViewにUIRefreshControlをいれたらスクロール慣性がなくなったお話

最近は

scrollView.refreshControl = refreshControl

みたいなコードだけで簡単に引っ張って更新みたいなことができるようになって意気揚々と導入したんだけど、iPhoneX以上でなぜかスクロールできないバグが発生した。

原因はどうやらendRefreshing()が原因のようで、くるくるしてないときにendRefreshing()をやると慣性スクロールがなくなる模様。
なので、以下のようにした。

if refreshControl.isRefreshing {
    refreshControl.endRefreshing()
}

ちゃんと、くるくるしてるか確認するようにしないとだめということですね。
気をつけよう。

mogmet

View Comments

  • I am an investor of gate io, I have consulted a lot of information, I hope to upgrade my investment strategy with a new model. Your article creation ideas have given me a lot of inspiration, but I still have some doubts. I wonder if you can help me? Thanks.

  • I am currently writing a paper and a bug appeared in the paper. I found what I wanted from your article. Thank you very much. Your article gave me a lot of inspiration. But hope you can explain your point in more detail because I have some questions, thank you. 20bet