IOS work encounters a problem record
1, the scrolldelegate problem of UITableView
Afternoon encountered a strange problem, have not noticed before, because a VC to achieve TableView and other view location linkage,
So realized the TableView delegate in the Scrollviewdidscroll method, the results in click on the product push product Details VC B, the problem arises.
Problem performance:
In the call [Self.navigationcontroller PUSHVIEWCONTROLLER:PRODUCTDETAILVC Animated:yes];
The TableView in VC a always scrolls to the top (Contentoffset has been modified)
See for a long time also did not find the problem, behind in scrollviewdidscroll position added a breakpoint, found in Navigationcontroller in the process of push VC B, the system will call a VC A in the TableView Scrollviewdidscroll method, the key is that the incoming contentoffset in the call is problematic (0,-CONTENTINSET.Y), so that the TableView in VC a will automatically return to the head
Solution: In VC a viewwilldisappear when set TableView delegate for nil, at the same time in the Viewwillappear TableView of delegate set back, the problem is resolved out.
All on all the problem is strange, I hope you no longer be troubled by the same problem
Keep track of the wonderful problems encountered in iOS development and update them at any time.