iOS UITableView and Uitableviewindex

Source: Internet
Author: User



Scene:

I encountered the following situation in a project: There is a uitableview in Viewcontroller, and a button is added to the rightmost side of each cell in TableView. After adding the index bar to TableView, you will find that the button added to the cell cannot be pressed to respond to the departure event.


Analysis: Find the corresponding code file, click the View Overview button below (Debug view Hierarchy) to see the approximate view.


We can also print out all the TableView's sub-views: we can see the two views of Uitableviewindex and Uitableviewwrapperview, but we can't find the relevant information on Apple's official documents. We can know by setting their borders: Uitableviewindex is the size of the indexed view Uitableviewwrapperview view is the first full screen size view that TableView appears on the screen.


So we can put the button on the cell on the Uitableviewindex, followed by the idea of encoding, open the View overview The Discovery button still appears below the indexed view, after the Run button is not responding



Resolution strategy: We can add the button to the view on the controller, and then implement the UITableView Uiscrollviewdelegate protocol, by implementing the method

-(void) Scrollviewdidscroll: ( Uiscrollview *) ScrollView to set the location where the button is located so that the button can move with the cell and respond to the departure event.




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

iOS UITableView and Uitableviewindex

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.