问题
How can I implement a table with rows and columns in Objective-C? I need to show a timetable: columns for week's day and rows for hours. I have no idea. TableView
makes rows. Would UICollectionView
be right for this?
回答1:
You can use UITableView
. But instead of using the default UITableViewCell
, you have to create a custom cell with 7 labels equally spacing horizontally. Then you add 24 rows, each for one hour. And I think that's all you need, simple and straight forward.
回答2:
That depends on how you want to eventually display it. What I usually do is create an array ( or two, or three if needed) and then pull from that when I want to display parts of it. The reason I said I might need one or two is that one might be for strings and another might be for for integers or float values. It all depends on the situation and you have to make sure you keep them synchronized programmatically.
来源:https://stackoverflow.com/questions/33324786/table-with-rows-and-columns-in-objective-c-for-ios