ios - UITableview reloadData is not resetting frame for iPhone 5 -


i'm adding new cells table view using pull add function. when pull down on table view past threshold placeholder cell added. then, call reloaddata , becomefirstresponder on placeholder cell.

the problem reloaddata doesn't appear resetting tableview frame iphone 5 , lower. causes placeholder cell out of visible range. table offset should 0.

add placeholder

-(void)todoplaceholderadded {     nslog(@"todoplaceholderadded");      // create new item     todoitem *newitem = [[todoitem alloc] initwithtext:@""];     [_todolist insertobject:newitem atindex:0];      // refresh table     [self.tableview reloaddata];      // find new cell     todocell* editcell;     (todocell* cell in _tableview.visiblecells) {         if (cell.todoitem == newitem) {             editcell = cell;             editcell.todoitem = newitem;             _cellinedit = cell;             editcell.textfield.placeholder = @"enter task";             break;         }     }      // enter edit mode     [editcell.textfield becomefirstresponder];  } 

edit cell

-(void)celldidbeginediting:(todocell *)editingcell {     nslog(@"celldidbeginediting");     _tableview.scrollenabled = no;     _tableview.bounces = no;     _superviewhorizontalscroll.scrollenabled = no;     _cellinedit = editingcell;      //set offset current editing cell     _editingoffset = _tableview.contentoffset.y - editingcell.frame.origin.y;      nslog(@"table offset: %f", _tableview.contentoffset.y);     nslog(@"frame y: %f", editingcell.frame.origin.y);     nslog(@"offset: %f", _editingoffset);      //slide rows editing cell     for(todocell* cell in [_tableview visiblecells]) {         //add flag cells edit in progress         cell.isediting = yes;         [uiview animatewithduration:0.3             animations:^{                 //set new frame cell                 cell.frame = cgrectoffset(cell.frame, 0, _editingoffset);                  //reduce alpha non editing cells                 if (cell != _cellinedit) {                     cell.alpha = 0.2;                 }         }];     } } 

iphone 5 , lower

2015-04-25 23:09:39.093 quickscrolltest[7996:320879] todoplaceholderadded 2015-04-25 23:09:39.093 quickscrolltest[7996:320879] celldidbeginediting 2015-04-25 23:09:39.093 quickscrolltest[7996:320879] table offset: -136.000000 2015-04-25 23:09:39.093 quickscrolltest[7996:320879] frame y: 0.000000 2015-04-25 23:09:39.093 quickscrolltest[7996:320879] offset: -136.000000 

iphone 6

2015-04-25 23:11:01.071 quickscrolltest[8179:323067] todoplaceholderadded 2015-04-25 23:11:01.078 quickscrolltest[8179:323067] celldidbeginediting 2015-04-25 23:11:01.078 quickscrolltest[8179:323067] table offset: 0.000000 2015-04-25 23:11:01.078 quickscrolltest[8179:323067] frame y: 0.000000 2015-04-25 23:11:01.078 quickscrolltest[8179:323067] offset: 0.000000 


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -