iphone - Determine if a tableview cell is visible -
is there way know if tableview cell visible? have tableview first cell(0) uisearchbar. if search not active, hide cell 0 via offset. when table has few rows, row 0 visible. how determine if row 0 visible or top row?
uitableview
has instance method called indexpathsforvisiblerows
return nsarray
of nsindexpath
objects each row in table visible. check method whatever frequency need , check proper row. instance, if tableview
reference table, following method tell whether or not row 0 on screen:
-(bool)isrowzerovisible { nsarray *indexes = [tableview indexpathsforvisiblerows]; (nsindexpath *index in indexes) { if (index.row == 0) { return yes; } } return no; }
because uitableview
method returns nsindexpath
, can extend sections, or row/section combinations.
this more useful visiblecells
method, returns array of table cell objects. table cell objects recycled, in large tables have no simple correlation data source.
Comments
Post a Comment