【发布时间】:2014-05-29 09:08:09
【问题描述】:
我正在构建一个应用程序,在该应用程序中,我从 php 文件中获取数据,并且已经在 xcode 中对其进行了 NSLoging,它正在以这种格式显示数据:
jsonObject=(
(
1,
abc,
"abc@xyz.com",
"501 B3 Town"
),
(
2,
sam,
"sam@xyz.com",
"502 B3 Town"
),
(
3,
jhon,
"jhon@xyz.com",
"503 B Town"
)
)
这是我的viewdidload
- (void)viewDidLoad
{
[super viewDidLoad];
statuses=[[NSMutableArray alloc]init];
NSURL *myURL = [NSURL URLWithString:@"http://url/result.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:myURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
NSLog(@"Finished with status code: %i", [(NSHTTPURLResponse *)response statusCode]);
id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
NSLog(@"jsonObject=%@",jsonObject);
statuses = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
}];
}
现在我想在 uitableview 中显示所有记录。谁能告诉我我该怎么做。谢谢
【问题讨论】:
-
你知道如何创建
UITableView吗? -
yupi 确实知道这一点,但我如何将这些数据加载到 uitableview 中,这是我的问题。谢谢
-
创建一个模型NSObject模型类,并使用这个模型本身展示。
-
你能分享你的json响应数据吗?
标签: ios iphone objective-c xcode uitableview