I was wondering how to make a UITable have columns. Or, is there a better way to create an actual table that looks like a grid. I want 开发者_如何学Pythonto have 3 columns. How can I do this?
The UITableView doesn't have support for more than one column. However, this can be easily fixed if you create your own custom UITableViewCell-s. You would need to stash three different views into the cell and then add whatever you want in them.
If you don't mind the fact that you cannot scroll horizontally you can just use a custom UITableViewCell
to give the illusion of columns. If you really want columns (like a spreadsheet) you need to subclass UIScrollView
and implement UITableView
-like view caching. Luckily Apple has some sample code which shows how to do this, see TiledScrollView.m
精彩评论