开发者

How to make a UITable with columns?

开发者 https://www.devze.com 2023-03-06 12:01 出处:网络
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 UITab

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

0

精彩评论

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

关注公众号