tableView刷新某一個區的時候改變contentOffSet的問題
1.iOS開發過程中需要點擊按鈕刷新某一個區。但是當我調用[self.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationNone];刷新某一個區的時候總是出現以下的警告:
[LayoutConstraints] Unable to simultaneously satisfy constraints.Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (? ? "",? ? "",? ? "",? ? "",? ? "")Will attempt to recover by breaking constraintMake a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.The methods in the UIConstraintBasedLayoutDebugging category on UIView listed inmay also be helpful.
截圖如下:
從警告的代碼中可以看出我的UITableViewHeaderFooterContentView的width==0,但是上面的子控件的偏移或者子控件的width卻不為0.所以才報了上面的警告!
但是為什么呢?研究了好長時間也沒有研究出來,只是刷新某一個區,調用了[self.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationNone]。怎么會改變了cont entOffSet和Frame呢?問題一直困擾著我,至今沒有解決,希望哪位大神看到了,解決了指點一下。非常感謝!!
雖然不知道為什么,但是也找到了解決的辦法,那就是把[self.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationNone]這個方法換成[self.tableView reloadData],這個警告就不會再出現。希望能夠幫到出現這個問題的小伙伴。。上網也查了關于刷新區和刷新整個tableView的不同。沒有找到什么關健性的問題。。所以就寫個簡書記錄了一下。