我的UIRefreshControl
添加了UITableView
。第一次加载屏幕时,它工作正常。从第二次开始,每当我在beginRefreshing
中调用viewWillAppear
时,表视图标头就会卡住,并且刷新控件也不显示。
可能是什么问题?
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()
}
})
}