IOS work encounters a problem record

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.