ios - tableView tag wrong after moveRowAtIndexPath method -


i have view 7 tableviews representing 7 days of week. each tableview initialized tag 0 6. made longpressure recognizer in cells access right tableview:

- (ibaction)longpress:(uigesturerecognizer *)sender {     self.clickedpoint = [sender locationinview:self.view];      // down subview user clicked     uiview *clickedsubview = [self.view hittest:self.clickedpoint withevent:nil];      if( [clickedsubview.superview iskindofclass:[customcell class]] ) {          // selected tableview         uitableview *selectedtableview = (uitableview*)clickedsubview.superview.superview;          nslog(@"selected tag: %d", selectedtableview.tag);     } } 

when press cell tags shown correctly. problem when move row inside of tableview. when moverowatindexpath: in tableview , longpress, tag of tableview made moverow gets tag of last longpress of tableview.

example:

i moverow in table tag 2. longpress table tag 5. go longpress table of tag 2 time log tag = 5 (the 1 before). if longpress table tag 1, go longpress "table of tag 2"(suppose be) again , logs tag 1 should tag 2.

i have read beginupdates makes lose tag , necessary reload. have tried this:

// reload tableview after moverowatindexpath method selectedtableview reloaddata];  // tried refresh view contains tableviews [[self getweekview] setneedsdisplay];  // , tried set tag again after moverowatindexpath method selectedtableview.tag = index; 

nothing works. suspected if happening clickedsubview , if getting the right hittest view tested colored borders , gets right view, wrong tag after moverowatindexpath method.

thank all!

if using custom cell tableviews, suppose using add 1 label on custom cell or if dont want show tag keep hidden.

when load tableview cells data in - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath method time set tag label wont problem of tag.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -