开发者

Grid of images in iOS

开发者 https://www.devze.com 2023-03-05 17:42 出处:网络
I want to create a TabItem in a TabBarController containing a grid of images which a user can select. I know I could use a TableViewController, but that would just show a long list, rather than rows o

I want to create a TabItem in a TabBarController containing a grid of images which a user can select. I know I could use a TableViewController, but that would just show a long list, rather than rows of (for example) 3x4 images.

开发者_Go百科

Is this possible?


Apple has sample code TiledScrollView.m that demonstrates how to do what you want to do. The guts of the tile reuse is in layoutSubviews. Obviously you will need to tweak it to your own tasks... but it's always nice to have some working code to start with ;-) Hope this helps.


I eventually went with an excellent control from CocoaControls called DTGridView, but it was a close second to GMGridView, which was a close second. I found GMGridView a tad too powerful.

One of the things I found relatively easy to do with DTGridView was to override -(void)drawRect to add a stacked stack effect using CoreGraphics.

0

精彩评论

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

关注公众号