//
// MasterViewController.m
// Table_JsonDemo
//
// Created by apple on 19/02/13.
// Copyright (c) 2013 apple. All rights reserved.
//
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "SBJson.h"
@interface MasterViewController () {
NSMutableArray *_objects;
}
@end
@implementation MasterViewController
@synthesize jsonArray;
@synthesize jsonData;
@synthesize jsonUrl;
- (void)viewDidLoad
{
[super viewDidLoad];
self.title=@"Jon Data IN TableView";
jsonUrl=[NSURL URLWithString:@"http://localhost/App1/rac.php"];
jsonData=[[NSString alloc]initWithContentsOfURL:jsonUrl];
self.jsonArray=[jsonData JSONValue];
NSLog(@"%@",jsonArray);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return jsonArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
//NSDate *object = _objects[indexPath.row];
cell.textLabel.text = [self.jsonArray objectAtIndex:indexPath.row];
return cell;
}
@end
No comments:
Post a Comment