NSArray
中有如下数据。使用AFHTTPRequestOperation
来获取结果,然后执行` [ListOfName addObject:
[responseData valueForKey:name]];,想要下面的结果显示在
tableView`中,但是不知道怎么实现?
(
(
"Richard Conover",
"Richard Conover",
"Kaitlyn Matheson",
"Andrea Wannemaker",
"Andrea Wannemaker",
test,
james,
test,
gaurav,
sdfsdfs
)
)
如果用NSArray.count
返回。如何在tableView
中分开打印?
1.设置UITableView
的delegate,datasource
self.tableView.delegate=self;
self.tableView.datasource=self;
2.实现协议方法
-(NSInteger)numberOfSectionsInTableView {
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection {
return [ListOfName count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier=@"cellIdentifier";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if (cell==nil) {
cell=[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
}
cell.textLabel.text=[ListObName objectAtIndex:[indexPath row]];
return cell;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。