ios - Modify displayed tableview data for iphone -
i new in iphone development.i have 1 view controller contains tableview , custom cell there uitableviewcell contains favorite button twitter favorite button.i using afnetworking sending , post request , response comming in json format.after parse json displaying json in tableview.the json getting below
{ "user_id" = 328; "user_name" = "ios.dev";"user_lname" = "imac";} { "user_id" = 318; "user_name" = "ios.dev1";"user_lname" = "imac1";} { "user_id" = 358; "user_name" = "ios.dev2";"user_lname" = "imac2";} { "user_id" = 328; "user_name" = "ios.dev3";"user_lname" = "imac3";} { "user_id" = 338; "user_name" = "ios.dev4";"user_lname" = "imac4";}
there 1 favorite button on tableview cell. when clicking on button response comming server.suppose clicking on first cell post request go using cell userid , new response come.now problem how display new json data in current cell , want modify other cell data without reloading tableview new data.example suppose receive response
{ "user_id" = 328; "user_name" = "iphonefamily";"user_lname" = "iphoneprogram";}
now want search entire tableview cell user_id newresponse user_id , want replace cell data new data response.please me.thanks in advance.
nsarray *tweets=responseobject; placesarray=[[nsmutablearray alloc]init]; (nsdictionary *dictionary in tweets) { tweetdata *tweetdata=[[tweetdata alloc]initwithdictionary:dictionary]; [placesarray addobject:tweetdata]; } [tableview reloaddata]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { tweetcell *cell=[tableview dequeuereusablecellwithidentifier:@"tweetcell"]; cell.tweet=[placesarray objectatindex:indexpath.row]; cell.delegate=self; /// cell.tweet=placesarray[indexpath.row]; return cell; }
this code using displaying data. , inside custom cell - (ibaction)onfavorite:(id)sender {}
method.
you can make dictionary key userid , indexpath values. when data server, find corresponding index path dictionary, put in array , use [tableview reloadrowsatindexpaths:<#(nsarray *)#> withrowanimation:<#(uitableviewrowanimation)#>]
Comments
Post a Comment