开发者

Create table with multiple columns

开发者 https://www.devze.com 2023-03-03 16:01 出处:网络
Can anyone help me? I want to create a table with 5 columns and 8 rows in Xcode. Then i need to fill in table with data from Database. I\'m working o开发者_如何学Cn an application for Ipad. I\'ve sear

Can anyone help me? I want to create a table with 5 columns and 8 rows in Xcode. Then i need to fill in table with data from Database. I'm working o开发者_如何学Cn an application for Ipad. I've search a lot for this problems but no result. Can anyone give an example for this? Thank you so much!


It is a simple problem when you'll think of it. Since your columns is fixed, you will need to subclass UITableViewCell and create a custom UITableViewCell with 5 columns (or UIViews or whatever you need in those columns). Then simply use your custom UITableViewCell within the table and you can have as many rows as you want.

Tutorial for creating custom cells

You can use core data and NSFetchedResultsController for populating data (will need to map table indexpath to the core data manually since you have 5 objects in 1 row).

Also, see the previous question


You can try using UICollectionView. Here's a tutorial in which it is used to create a grid:

http://www.appcoda.com/ios-programming-uicollectionview-tutorial/

You can replace the code for adding images with the code for putting in your data from database.

0

精彩评论

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

关注公众号