Table with rows and columns in Objective-C for iOS

跟風遠走 提交于 2019-12-25 03:54:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!