I want to display multiple columns in a UITableView.
For Example:
TableView
FName LName Age
----- ----- ---
Abby Michale 34
I want to display multiple columns in a UITableView.
For Example:
TableView
FName LName Age
----- ----- ---
Abby Michale 34
I think the correct way of doing this is UICollectionView. Started with UITableView and finally failed at some point due to unexpected behavior while trying to implement scrolling both left-right and up-down.
Please check this awesome post for a complete and up-to-date solution: http://www.brightec.co.uk/blog/uicollectionview-using-horizontal-and-vertical-scrolling-sticky-rows-and-columns
Result will be like this:
Create a custom
UIView
subclass containing, say, threeUILabel
elements as subviews. Then set the cell'scontentView
property to this custom view.add three labels as sub viewsinto uitableview cell's content.then assign apprrpriate values to it eg:
You can define a custom cell in IB, which will contain 3 labels and in function:
when you define the cell in IB give each label a tag, so when you need to put a text there you can retrieve it by tag like this:
and repeat this with other 2 labels. The tag is a unique number.
Put this code instead //setup your cell comment
Bit late to the party, but we've open sourced our fully featured table component:
https://github.com/flexicious/iOSDataGrid
Some screenshots:
http://www.ioscomponents.com/Home/IOSDataGrid
Feel free to use!
I have created UIGridView. I believe your problem can be solved using the same technique.
You can learn the source code of UIGridView. The code is really short.