开发者

Displaying array in uitableview

I have an array created like this:

[currentQuizArrayQuestions insertObject:[quizArrayQuestions objectAtIndex:randomIndex] atIndex:0];

How do I access its data to display in the table?

I'm trying this:

 NSString *cellValue = [currentQuizArrayQuestions objectAtIndex:indexPath.row];

cell.textLabel.text开发者_运维百科 = cellValue;

I know it's wrong, but how do I get to the data array object stored in the currentQuizArrayQuestions array.


You need to implement the cellForRowAtIndexPath method. See this tutorial on UITableViews: http://adeem.me/blog/2009/05/19/iphone-programming-tutorial-part-1-uitableview-using-nsarray/

That one uses a UITableViewController, but the idea is the same.

Edit:

To use a different array, do the same thing with the cell for row at index path method, changing the array that the cellValues come from according to what you need. Then call [tableView reload]; which will run through cellForRowAtIndexPath with the contents of the new array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜