Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
421 views
in Technique[技术] by (71.8m points)

objective c - UICollectionView: How to define a UICollectionViewLayout that supports horizontally and vertically scrolling?

At the moment I'm trying to create an UICollectionView, that should display a simple excel-like-spreadsheet, with rows and columns. This should be an easy task with UICollectionViews, I believed. And I really would like to do the implementation in UICollectionView, not in any grid framework.

But at the moment I'm hanging a little bit. What I've figured out is, that I unfortunately can't use a UICollectionViewDelegateFlowLayout, because this only supports scrolling in either horizontally or vertically direction. But I need scrolling in both directions.

Therefore I have to use a UICollectionViewLayout, but for this I didn't find good examples, how to use it. Has anyone of you an example, how to subclass an UICollectionViewLayout to support rows and columns?

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

UICollectionViewFlowLayout definitely can't - "The grid layout scrolls along one axis only, either horizontally or vertically."

It is a subclass of UICollectionViewLayout. Seems like you could create your own subclass of UICollectionViewLayout and scroll in both directions.

What do you mean by page, you want to do paging like a scrollview? I'm wondering about using UICollectionViewFlowLayout in a UICollectionView for vertical scrolling, inside a UIScrollView for horizontal scrolling.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...