This is a sample getData method in my viewController.m file
-(void) getData {
// Create new SBJSON parser object
SBJsonParser *parser = [[SBJsonParser allo
In getData function gather all the data in an array. say it statusArray. Now, derived a viewcontroller from UItableViewController. Make a member in this class of NSArray type and assign above array to it. Write below functions into the controller class.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return statusArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [statusArray objectAtIndex:indexPath.row] objectForKey:@"user"];
return cell;
}
Implement the UITableViewDataSource protocol:
tableView:numberOfRowsInSection:
- return the number of "statuses"tableView:cellForRowAtIndexPath:
- return a UITableViewCell whose textLabel.text is set to your text.There are plenty of examples in Apple's docs, including the project you get when you create a new app using Xcode's "Master-Detail App" template.