【问题标题】:UIRefreshcontrol - UItableview header view is stuck and refreshview is not showingUIRefreshcontrol - UItableview 标题视图被卡住并且 refreshview 没有显示
【发布时间】:2016-08-09 05:30:22
【问题描述】:

我在UITableView 上添加了一个UIRefreshControl。第一次加载屏幕时它工作正常。从第二次开始,每当我在viewWillAppear 中调用beginRefreshing 时,表格视图标题就会卡住并且刷新控件也不会显示。

可能是什么问题?

    override func ViewDidLoad(){

    refreshControl.addTarget(self, action: #selector(PlacesViewController.pullToRefresh), forControlEvents: .ValueChanged)
    tableView.addSubview(refreshControl)
    tableView.tableFooterView = UIView()
    self.tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 110, right: 0)

        FetchExtPlaceList([:],inBackground:inBackground)

}

func FetchExtPlaceList(pramrDisc:parameter,inBackground:Bool){

    if !inBackground{
        ActivityManager.ManageActivityView(self, action: .ActionAdd)
    }else if pageNumber == 1 {
        self.refreshControl.beginRefreshing()

    }


    WSRequest.SendRequest(WSMethod.POST, pramrDisc: pramrDisc, paramsString: nil, operation: WSOperation.FetchExtPlaceList, completionHandler: { response in

        if !inBackground{
            ActivityManager.ManageActivityView(self, action: .ActionRemove)
        }

        if let errorTitle = response.errorTitle {

            if let errorDescription = response.errorDescription {
                UIAlertController.ShowAlert(errorTitle, message: errorDescription)
            }

        }else if let wsError = response.wsError {

            if let infoMessage = wsError.infoMessage {
                UIAlertController.ShowAlert("", message: infoMessage)
            }else if let errorMessage = wsError.errorMessage {
                UIAlertController.ShowAlert("", message: errorMessage)
            }else if let error = wsError.error {
                UIAlertController.ShowAlert("", message: error.description)
            }

        }else{

            if let places = response.parsedObject as? [Place]{

                if self.pageNumber == 1 {
                    self.places.removeAll()
                }

                self.places.appendContentsOf(places)
                self.tableView.reloadData()
            }

        }

        if self.refreshControl.refreshing{
            self.refreshControl.endRefreshing()
        }
    })
}

【问题讨论】:

  • 可以加代码吗?
  • 请检查我是否用代码更新了问题。

标签: ios swift uirefreshcontrol


【解决方案1】:

我有问题。我正在以编程方式调用尝试开始刷新,但我在Here 上发现我必须通过更改 contentoffset 来滚动表格视图。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-16
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多