Control does not immediately return to first row in UITableView after dismissing UIImageView in iOS -


i have ios application displaying uitableview, in turn composed of custom rows made of uitextfields, , uilabels. on first launch, have uiimageview covers uitableview until user presses button in order dismiss uiimageview (thus revealing uitableview behind it). however, problem instead of returning control first row of uitableview, selecting last row of uitableview, , on top of that, despite me making explicit call method, "becomefirstresponder", uitextfield in last row of uitableview not allow me enter text until explicitly select row table. , able enter text. assuming method "cellforrowatindexpath" populates table top down, why last row of table being selected, , not top (this guess, , if wrong please correct me).

what enable first row of uitableview once user dismisses uiimageview , have become "firstresponder" automatically, allowing user enter text right away without having explicitly select particular row.

my code dismisses uiimageview after pressing button here:

- (ibaction)begindataentry:(id)sender {      [_imageview removefromsuperview];     [_cell.datafield becomefirstresponder];  }  

it if uitableview in "limbo" state until explicitly select row table. can show me i'm doing wrong?

thanks in advance reply.

use uitableview scrolltorowatindexpath:atscrollposition:animated: display correct row when view redisplayed.

it safer use index paths refer table rows rather keeping references cells. so, here's alternative:

- (ibaction)begintirecountentry:(id)sender {      [_imageview removefromsuperview];     nsindexpath firstcellpath = [nsindexpath indexpathforrow:0 insection:0];      [self.tableview scrolltorowatindexpath: firstcellpath atscrollposition:uitableviewscrollpositiontop animated:yes];     mycell cell = (mycell *)[self.tableview cellforrowatindexpath:firstcellpath];     [cell.datafield becomefirstresponder];  }  

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -