在UITableView中显示数据
原问题来自于CSDN问答频道,更多解决方案见:http://ask.csdn.net/questions/2335问题描述:
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]];
}
好高光环个 --------------------编程问答-------------------- 多人投入提供对方提供梵蒂冈地方 --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- learning --------------------编程问答-------------------- 可以下载吗? --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 这个资源不错,呵呵 --------------------编程问答-------------------- budonga --------------------编程问答-------------------- zenme nong a --------------------编程问答-------------------- 好好学习天天向上
--------------------编程问答-------------------- --------------------编程问答-------------------- 太高了 --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 当然是好样的,支持。 --------------------编程问答-------------------- 除 --------------------编程问答-------------------- learning --------------------编程问答-------------------- --------------------编程问答-------------------- 学习一下,其实不太懂 --------------------编程问答-------------------- 以后都分享过
改成
以前都分享过 --------------------编程问答-------------------- 走过路过,以后都分享过
改成
以前都分享过 以后都分享过
改成
以前都分享过 以后都分享过
改成
以前都分享过 以后都分享过
改成
以前都分享过 --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 为啥俺都看不懂呢,,,,,哎 --------------------编程问答-------------------- 非常好 非常好 --------------------编程问答-------------------- 不明巨额里啊 --------------------编程问答-------------------- --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 进来学习一下.谢了!
补充:移动开发 , iPhone