gpt4 book ai didi

ios - Xcode:当网站缩放时,UIWebView 拉动刷新动画不居中

转载 作者:行者123 更新时间:2023-12-01 18:43:57 24 4
gpt4 key购买 nike

我有一个使用 Xcode 和 Swift 创建的 iOS 应用程序。我正在使用以下代码进行下拉刷新:

func pullToRefresh() {
self.homewebview.reload()
}
func addRefreshControl() {
refreshControl = UIRefreshControl()
refreshControl.attributedTitle = NSAttributedString(string: "Please wait a moment…")
refreshControl.addTarget(self, action: #selector(FirstViewController.pullToRefresh), forControlEvents:.ValueChanged)
self.homewebview.scrollView.addSubview(refreshControl)
}

它工作得很好,动画也显示出来了。但是,当用户放大(放大或缩小)网站并拉动以刷新动画(旋转轮,“请稍等……”文本)时,不会显示居中(水平),具体取决于放大网站的哪一侧实际显示。

有人知道如何解决吗?

最佳答案

  • 检查您是否在使用 contentInsets , 如果是,则将布局约束/布局 anchor 设置为 refreshControl.superView有偏移量。
  • 还设置tableView.refreshControl = refreshControl而不是将其添加为 subview
  • 关于ios - Xcode:当网站缩放时,UIWebView 拉动刷新动画不居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38353864/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com