objective c - iOS tableView with sections - how to get global index -


i have question : created table multiple sections (they set webservice response, dynamic). example, first section have 3 cells (0,1,2), second section - 4 cells (0,1,2,3), third section - 7 cells (0,1,2,3,4,5,6).

when click, example, on third cell in third section, can number in cell (third section), , number of cell in current section (third cell). know, no matter section, cell's number (so, in above example - third cell in third section, tenth cell)

what do? how number?

for example in tableview:cellforrowatindexpath: if want use in cell text.

-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     //....     nsinteger sum = 0;     for(nsinteger idx = 0; idx < indexpath.section, ++idx){         sum += [tableview tableview:tableview numberofrowsinsection:idx];     }     sum += indexpath.row +1;     //.... } 

but tableview:didselectrowatindexpath: work.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -