Put JSON elements in TableView as Sections Title and Cell title - ios

Below is JSON, and need to put it in table view such that "subitemname" becomes the section title and "subtosubitemname" becomes the title for cell.
I am trying it but didn't get successful.
Title for section is in place but title for rows is not retrieved.
here is the code I tried.
- (void)viewDidLoad {
[super viewDidLoad];
NSString *urlString = [NSString stringWithFormat:#"URL"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:#"GET"];
NSError *error;
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *str=[[NSString alloc]initWithData:returnData encoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&error];
NSArray *DATAA=[jsonDict objectForKey:#"Menu"];
subid=[DATAA valueForKey:#"subitemid"];
subname=[DATAA valueForKey:#"subitemname"];
NSArray *sub= [DATAA valueForKey:#"Submenu"];
_SubItemName=[sub valueForKey:#"subtosubitemname"];
_SubItemId=[sub valueForKey:#"subtosubitemid"];
}
#pragma mark - Table view data source
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{ return [subname objectAtIndex:section];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [subid count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [_SubItemId count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cell=[tableView dequeueReusableCellWithIdentifier:#"Cell" forIndexPath:indexPath];
NSArray *subn=[_SubItemName objectAtIndex:indexPath.section];
cell.textLabel.text=[subn objectAtIndex:indexPath.row];
return cell;
}
where subname is an array having "subitemname" objects and _SubItemName is an array having "subtosubitemname" objects.
{ "Menu":
[{"subitemid":1,
"itemid":1,
"subitemname":"TELEVISIONS",
"ordernum":1,
"Submenu":
[{
"subitemid":1,
"subtosubitemid":1,
"itemid":1,
"subtosubitemname":"FULL HD TV"},
{
"subitemid":1,
"subtosubitemid":2,
"itemid":1,
"subtosubitemname":"SMART TV"
}
]
},
{
"subitemid":2,
"itemid":1,
"subitemname":"AUDIO & VIDEO",
"ordernum":2,
"Submenu":
[{
"subitemid":2,
"subtosubitemid":3,
"itemid":1,
"subtosubitemname":"HOME AUDIO SYSTEMS"
},
{
"subitemid":2,
"subtosubitemid":4,
"itemid":1,
"subtosubitemname":"DTH SERVICES"
},
{
"subitemid":2,
"subtosubitemid":5,
"itemid":1,
"subtosubitemname":"AUDIO & VIDEO ACCESSORIES"
},
{
"subitemid":2,
"subtosubitemid":11,
"itemid":1,
"subtosubitemname":"PROJECTORS"
}
]
},
{
"subitemid":3,
"itemid":1,
"subitemname":"LARGE APPLIANCES",
"ordernum":3,
"Submenu":
[
{
"subitemid":3,
"subtosubitemid":14,
"itemid":1,
"subtosubitemname":"WASHING MACHINES & DRYERS"
},
{
"subitemid":3,
"subtosubitemid":16,
"itemid":1,
"subtosubitemname":"AIR CONDITIONERS"
},
{
"subitemid":3,
"subtosubitemid":18,
"itemid":1,
"subtosubitemname":"REFRIGERATORS"
},
{
"subitemid":3,
"subtosubitemid":19,
"itemid":1,
"subtosubitemname":"INVERTERS & BATTERIES"
}]}]}

NSMutableArray *menuData = [jsonDict objectForKey:#"Menu"];
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return [[menuData objectAtIndex:section] objectForKey:#"subitemname"];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [menuData count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSArray *subMenuData = [[menuData objectAtIndex:section] objectForKey:#"Submenu"];
return [subMenuData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cell=[tableView dequeueReusableCellWithIdentifier:#"Cell" forIndexPath:indexPath];
NSDictionary *cellData = [[[menuData objectAtIndex:section] objectForKey:#"Submenu"] objectAtIndex:indexPath.row];
cell.textLabel.text=[cellData objectForKey:#"subtosubitemname"];
return cell;
}
Hope this work for you.

Try this ... Just one array is enough.. menu = [jsonDict objectForKey:#"Menu"];
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return menu[indexPath.section][#"subitemname"];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [menu count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSArray *submenu = menu[indexPath.section][#"Submenu"];
return [submenu count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cell=[tableView dequeueReusableCellWithIdentifier:#"Cell" forIndexPath:indexPath];
NSArray *submenu = menu[indexPath.section][#"Submenu"];
cell.textLabel.text = submenu[indexPath.row][#"subtosu‌​bitemname]";
return cell;
}

Related

i want view data from json in table view

1-connection
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[self.data appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
_arrayOfData = [NSJSONSerialization JSONObjectWithData:self.data options:NSJSONReadingJSON5Allowed error:nil];
}
2 - Table view data source`enter code here`
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return _arrayOfData.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"cell" forIndexPath:indexPath];
_dObj = [_arrayOfData objectAtIndex:indexPath.row];
cell.textLabel.text =[_dObj objectForKey:#"title"];
return cell;
}

IOS,Tableview Objective C,

There is 5 elements in an array , in that 2 elements have data and another elements are blank and in tableview it show both element but when i scroll the app crash.i have to show menu_name in the section and its working but when i scroll tableview the app crash because, so can any one give me the solution?
Here is the Response which i have to show in tableview
"status":"true",
"message":"food point menu available",
"data":[
{
"menu_id":"9",
"menu_name":"Morning Menu",
"food_list":[
{
"food_name":"Brigadeiros",
"foodtype":"Pastas",
"food_per_person":"20",
"food_bonus":"packing"
},
{
"food_name":"Cachaca",
"foodtype":"Pastas",
"food_per_person":"30",
"food_bonus":"packing"
}
]
},
{
"menu_id":"10",
"menu_name":"Afternoon Menu",
"food_list":[
{
"food_name":"Quindim",
"foodtype":"Pastas",
"food_per_person":"30",
"food_bonus":"packing"
},
{
"food_name":"Cachaca",
"foodtype":"Pastas",
"food_per_person":"30",
"food_bonus":"packing"
}
]
},
{
"menu_id":"12",
"menu_name":"Evening Menu",
"food_list":""
},
{
"menu_id":"17",
"menu_name":"MenuSegundaFeira",
"food_list":""
},
{
"menu_id":"18",
"menu_name":"MenuTercaFeira",
"food_list":""
}
]
}
And this is the code which i have written in my app
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if([FinalArrayCategory count]>0) {
return [[[FinalArrayCategory objectAtIndex:0] objectForKey:#"food_list"] count];
}
else
{
return 0;
}
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if([FinalArrayCategory count]>0) {
return [[FinalArrayCategory valueForKey:#"menu_name"] count];
}
else
{
return 0;
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSString *sectionName;
sectionName =[[FinalArrayCategory valueForKey:#"menu_name"] objectAtIndex:section];
return sectionName;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
MenuListCELL *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.lblpice.text=[[[[FinalArrayCategory objectAtIndex:indexPath.section]objectForKey:#"food_list"] valueForKey:#"food_name"]objectAtIndex:indexPath.row];
// cell.lblType.text=[[FinalArrayCategory valueForKey:#"category_name"] objectAtIndex:indexPath.row];
// cell.lblBonus.text=[[FinalArrayCategory valueForKey:#"food_bonus"] objectAtIndex:indexPath.section];
// cell.lblFoodName.text=[[FinalArrayCategory valueForKey:#"menu_name"] objectAtIndex:indexPath.section];
//
// NSString *pickURL=[[FinalArrayCategory valueForKey:#"food_image"] objectAtIndex:indexPath.section];
// [cell.lblImage sd_setImageWithURL:[NSURL URLWithString:pickURL] placeholderImage:[UIImage imageNamed:#"itemplaceholder.jpg"] options:SDWebImageProgressiveDownload progress:^(NSInteger receivedSize, NSInteger expectedSize) {
// } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
// }];
return cell;
}
return [[[FinalArrayCategory objectAtIndex:0] objectForKey:#"food_list"] count];
change objectAtIndext from 0 to IndexPath.section
Please try this code..
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[[FinalArrayCategory objectAtIndex:section] objectForKey:#"food_list"] count];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [FinalArrayCategory count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSString *sectionName;
sectionName =[[FinalArrayCategory objectAtIndex:section] objectForKey:#"menu_name"];
return sectionName;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
MenuListCELL *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if ([[[FinalArrayCategory objectAtIndex:indexPath.section] objectForKey:#"food_list"] iskindOfClass:[NSArray class]]) {
NSDictionary *dictData=[[[FinalArrayCategory objectAtIndex:indexPath.section] objectForKey:#"food_list"] objectAtIndex:indexPath.row];
cell.lblpice.text=[dictData objectForKey:#"food_name"];
}else{
cell.lblpice.text=#"";
}
return cell;
}
And let me know its working or not.
Happy Coding!!
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
MenuListCELL *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if([FinalArrayCategory objectAtIndex:indexPath.section]objectForKey:#"food_list"].count>0){
NSString *foodName =[[[[FinalArrayCategory objectAtIndex:indexPath.section]objectForKey:#"food_list"] valueForKey:#"food_name"]objectAtIndex:indexPath.row];
if(foodName){
cell.lblpice.text=foodName;
}
}else{
cell.lblpice.text=#"";
}
return cell;
}
please try this

how to retrieve json data in table view in iOS

I don't know how to retrieve particular data from this JSON data and insert in tableview.
{
"error": "ok",
"data": [{
"facebook_id": "1068644546541665",
"user_id": "95590e92-6c74-44d1-9e5c-5a10c6341ba3",
"name": "Sunil",
"trackingallowed": 1,
"trackingpermission": 1
}, {
"facebook_id": "10311905002886663",
"user_id": "95ab5fc0-9c6d-4e3e-9cb2-bfa4d53e640f",
"name": "Saravanan",
"trackingallowed": 1,
"trackingpermission": 1
}, {
"facebook_id": "998936463528828",
"user_id": "cd6e3c89-bc2d-45a9-8436-9603e1b4724b",
"name": "Suresh",
"trackingallowed": 1,
"trackingpermission": 1
}]
}
Getting the values through List array.
-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[friendsconnection_data appendData:data];
NSError *localerror;
NSDictionary *parsedobject =[NSJSONSerialization JSONObjectWithData:data options:0 error:&localerror];
NSLog(#"parsedobject1 %#",parsedobject);
ListArray = [parsedobject valueForKey:#"data"];
NSLog(#"rrresults1 %lu",(unsigned long)ListArray.count);
NSLog(#"results1 %#",ListArray );
}
I am getting EXC_BAD_ACCESS. I need to know how to get particular data from JSON. e.g. I want to get only facebookid and name.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[self FriendsData];
static NSString *TableIdentifier =#"tableitem";
UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:TableIdentifier];
if(cell == nil)
{
cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableIdentifier];
}
cell.textLabel.text = [[ListArray objectAtIndex:indexPath.row]objectForKey:#"name"];
tableView.rowHeight = 300;
return cell;
}
plz use this code. I think it help you
NSError *json_parse_error;
NSDictionary *responseDictionary=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&json_parse_error];
NSArray *user_info_array=[responseDictionary valueForKey:#"data"];
in your table view delegate
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *TableIdentifier=#"tableitem";;
cell=[tableView dequeueReusableCellWithIdentifier:TableIdentifier];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:TableIdentifier];
}
cell.textLabel.text = [[user_info_array objectAtIndex:indexPath.row] objectForKey:#"name"];
cell.detailTextLabel.text = [[user_info_array objectAtIndex:indexPath.row] objectForKey:#"facebook_id"];
return cell;
}
//set height for table view cell
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 300.0;
}

How to move row to another Section while clicking on row?

I have Implemented multi select row but what i have to do is when we click on row it will move on another section , Here's my code what i have tried is ?
can anyone help me out from this ? Thanks in advance ...
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2; //assuming you have only two sections
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0)
return self.firstSectionDataSource.count;
else if (section == 1)
return self.dataArray.count;
else
return 0;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Here, Have to move row to another section while clcking ..
// other multiselect code
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Configure a cell to show the corresponding string from the array.
static NSString *kCellID = #"cellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
cell.textLabel.text = [self.dataArray objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
#try {
NSMutableArray *sourceArray = nil;
if (sourceIndexPath.section == 0) {
sourceArray = self.firstSectionDataSource;
}
else if (sourceIndexPath.section == 1)
{
sourceArray = self.dataArray;
}
NSMutableArray *destinationArray = nil;
if (destinationIndexPath.section == 0) {
destinationArray = self.firstSectionDataSource;
}
else if (destinationIndexPath.section == 1)
{
destinationArray = self.dataArray;
}
NSString *stringToMov = [sourceArray objectAtIndex:sourceIndexPath.row];
[sourceArray removeObject:stringToMov];
[destinationArray insertObject:stringToMov atIndex:destinationIndexPath.row];
}
#catch (NSException *exception) {
NSLog(#"exception = %# \n reason = %#",exception,exception.reason);
}
}
In cellForRowAtIndexPath
[cell setShowsReorderControl:YES];
And you need to implement the following UITableView delegate and data source methods properly
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2; //assuming you have only two sections
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0)
return firstSectionDataSource.count;
else if (section == 1)
return secondSectionDataSource.count;
else
return 0;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
{
#try {
NSMutableArray *sourceArray = nil;
if (sourceIndexPath.section == 0) {
sourceArray = firstSectionDataSource;
}
else if (sourceIndexPath.section == 1)
{
sourceArray = secondSectionDataSource;
}
NSMutableArray *destinationArray = nil;
if (destinationIndexPath.section == 0) {
destinationArray = firstSectionDataSource;
}
else if (destinationIndexPath.section == 1)
{
destinationArray = secondSectionDataSource;
}
NSString *stringToMov = [[sourceArray objectAtIndex:sourceIndexPath.row] retain];
[sourceArray removeObject:stringToMov];
[destinationArray insertObject:stringToMov atIndex:destinationIndexPath.row];
[stringToMov release];
}
#catch (NSException *exception) {
NSLog(#"exception = %# \n reason = %#",exception,exception.reason);
}
}
You can do the next:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView moveRowAtIndexPath:indexPath toIndexPath:[NSIndexPath indexPathForRow:row inSection:section]];
// other multiselect code
}
Try this -
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjects:[NSArray arrayWithObjects:[NSArray arrayWithObjects:#"a",#"b",#"c", nil],[NSArray arrayWithObjects:#"d",#"e",#"f", nil], nil] forKeys:[NSArray arrayWithObjects:#"firstSection",#"secondsection", nil]];
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [[dict allKeys] count]; //assuming you have only two sections
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[dict objectForKey:[dict allKeys][section]] count];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableArray *arr = [dict objectForKey:[dict allKeys][indexPath.section]];
NSString *str = arr[indexPath.row];
if (indexPath.row!=0) {
[arr removeObject:str];
}
NSMutableArray *arr1 = [dict objectForKey:[dict allKeys][0]];
[arr1 addObject:str];
[tableView reloadData];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSArray *arr = [dict objectForKey:[dict allKeys][indexPath.section]];
NSString *str = arr[indexPath.row];
static NSString *kCellID = #"cellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
cell.textLabel.text = str;
return cell;
}

Why won't my JSON array display in a UITableView object?

Here's my code:
- (void)viewDidLoad
{
[super viewDidLoad];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:#"http://www.domain.com/venues.php"]];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSError *error = nil;
NSArray *responseArray = [NSJSONSerialization JSONObjectWithData:response options:0 error:&error];
NSLog(#"%#", responseArray); // This logs fine
}
#synthesize responseArray;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 1; // temporary replacement for return [responseArray count] for testing purposes
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier =#"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text=[responseArray objectAtIndex:indexPath.row];
return cell;
}
For comparison, the following code does work:
- (void)viewDidLoad
{
[super viewDidLoad];
self.colors= [[NSArray alloc] initWithObjects: #"Red", #"Yellow", #"Green", #"Blue", #"Purple", nil];
NSLog(#"%#", self.colors); // logs fine
}
#synthesize colors;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.colors count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier =#"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text=[self.colors objectAtIndex:indexPath.row];
return cell;
}
Update
My cellForRowAtIndexPath now looks like this, but I'm still not getting any results. Is there a problem with my JSON?
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier =#"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text=[[self.responseArray objectAtIndex:indexPath.row]objectForKey:#"name"];
return cell;
}
JSON:
[{"name":"venue 1"},{"name":"venue 2"},{"name":"venue 3"}]
#interface YourTableViewController ()<BViewControllerDelegate>
#property (strong, nonatomic) NSArray *responseArray;
#end
#implementation yourTableViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.responseArray = [NSJSONSerialization JSONObjectWithData:response options:0 error:&error];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.responseArray count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier =#"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text=[[self.responseArray objectAtIndex:indexPath.row]objectForKey:#"yourKey"];
return cell;
}

Resources