iOS reordering a UITableView -


i have uitableview reads data sql db.

when reorder data changes top , bottom ones

enter image description here

dragging 1 top bottom

enter image description here

when let go @ 5 switches top , bottom ones.

enter image description here using following

- (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)fromindexpath toindexpath:(nsindexpath *)toindexpath {              [mystringsarray exchangeobjectatindex:fromindexpath.row withobjectatindex:toindexpath.row];  } 

how can reorder list? it'll 2,3,4,5,1 , not 5,2,3,4,1

exchange not proper way should use this.

- (void)tableview:(uitableview *)tableview moverowatindexpath:(nsindexpath *)fromindexpath toindexpath:(nsindexpath *)toindexpath  {      id buffer = [mystringsarray objectatindex:fromindexpath.row];      [mystringsarray removeobjectatindex:fromindexpath.row];        [mystringsarray insertobject:buffer atindex:toindexpath.row]; } 

edited match comment below.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -