DHSmartScreenshot icon indicating copy to clipboard operation
DHSmartScreenshot copied to clipboard

Support for UICollectionView

Open ipranay opened this issue 10 years ago • 3 comments

First of all... This library is awesome! Thanks for creating it. Is their any chance you plan on supporting UICollectionView as well?

I understand, that it might be way more complicated than a UITableView, due to the different custom layouts you could build.

ipranay avatar May 12 '15 14:05 ipranay

I have tried this, in one of my tests:

self.collectionView.reloadData()
var origFrame = self.collectionView.frame

var frame = self.collectionView.frame
frame.size.height = self.collectionView.contentSize.height
frame.size.width = self.collectionView.contentSize.width
self.collectionView.frame = frame

UIGraphicsBeginImageContext(self.collectionView.bounds.size)

self.collectionView.layer.renderInContext(UIGraphicsGetCurrentContext())
var saveImage = UIGraphicsGetImageFromCurrentImageContext()

UIGraphicsEndImageContext()

self.collectionView.frame = origFrame

I'm not sure if it is the best way to go about it.

ipranay avatar May 12 '15 14:05 ipranay

Hi @ipranay, thanks for your comments, really glad to hear that :] Right now, I am not planning to add support for collection views, at least not in the near future. But, I think we can create a feature branch to do just that, so you can start with something and maybe others can join too. Thoughts? What you have done in the snippet above looks good, it could be the starting point to build upon it.

davidman avatar May 12 '15 15:05 davidman

I need to support UICollectionview,but there is bugs in my code ,Can you help me ?

denghuihua avatar Nov 17 '15 02:11 denghuihua