简体   繁体   中英

Table with rows and columns in Objective-C for iOS

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM