objective c - How can I get indexPath of a uiview on a cell - iOS -


i have view controller table view. each cell has custom view 5 star rating system. handle touchesbegan of view @ class of view

    - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     uitouch *touch = [touches anyobject];     cgpoint touchlocation = [touch locationinview:self];     [self handletouchatlocation:touchlocation];  } 

how can indexpath in order know on cell user voted? don't have button have uiview cannot use following:

cgpoint buttonposition = [sender convertpoint:cgpointzero toview:self.tableview]; nsindexpath *indexpath = [self.tableview indexpathforrowatpoint:buttonposition]; 

you can store index path in custom view when create view in cellforrowatindexpath: making property in class of view. property can set in init custom view. index path available in touchesbegan:withevent: method reading property.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -