How to get the current collectionview cell size in swift2? - ios

I am not like to get the cell size inside cell for row at indexpath
Please anybody help me to get the cell size.
UICollectionView IBOutlet name is collectionData;

UICollectionView is data driven, like all iOS GUI classes. Which means - you do not ask the collection view for the cell size but you tell the collection view the cell size. So, where did you tell the collection view the cell size? In the storyboard, programatically in the layout? Or in a delegate func? There you have it - your cell size.

Related

How to populate Dynamic UITableview Inside dynamic UITableviewCell in swift?

I need to implement the dynamic UITableView inside dynamic UITableviewcell like the below screenshot. Also, all values are dynamic which is coming from the server.
yes exactly you need inner tableview to do this.
first you have main tableview with card layout cell this should be dynamic cell height.
in this cell you have topview, inner tableview, bottom view all this view you can take fix height as your layout i see e.g top view is 80 height, bottom view is 80 height and tableview has dynamic height based on number of cell like cell height is 100 and you have total 3 cell so table height is 300 you need to make outlet of tableview height and update it programmatically.
hope this helps you!

nested tableview with automatic dimension

I have a TableView that its cell contains a second TableView (Nested TableView).
Inner tableView shows comments that have variable cell height. Calculate this height with UITableView.automaticDimension.
But main tableView cannot calculate it's cell height properly.
Main tableView use UITableView.automaticDimension for calculating cell height. but innerTableView doesn't show in the main tableView.
My test project download link:
dropbox.com/s/woieoi71t5kt66d/NestedTableViewTest%202.zip?dl=0

UICollectionView display previous cell content in next cell while scroll horizontally

I am using a UICollectionView to show an array of images, horizontally and zoom in/out that image in the cell with the help of scroll view using constraints. But when I scroll horizontally it shows me previous cell content in the current cell. I am and not able to identify what is the problem.
CollectionView datasources
CollectionCell Class
try this when you reuse the Cell in cellForItem at
cell.imageView.Image = nil
Please share some code so that we can help you better. Meanwhile, make sure you have the following parts working correctly in your code:
Register correct UICollectionViewCell subclass with correct reuse identifier
Use the method [self.collectionView dequeueReusableCellWithReuseIdentifier:itemIdentifier forIndexPath:indexPath] and pass both the parameters correctly.
In UICollectionViewCell subclass, override prepareForReuse and reset the UI parameters there.
Override prepareForReuse in imageCell class, and set imageView.image to nil.
The contentSize of the scrollView should be as big as imageView.image.size, or just use MWPhotoBrowser

How to solve TablviewCell Content Overlapping Issue

In tableview I have customcell reusable cell which overlap content of privious cell or last cell content overlap with first cell when scroll Tableview
You should set properties that depend on indexPath in viewForCell function, always.

UiCollectionView in UITableViewCell

I'm trying, with no success yet, to add a UiCollectionView to a static UITableViewCell and have it resize the tableViewCell vertically as the numbers of items in the collection grows. Is this even possible or is there a better solution to this problem?
Add height constraint in collectionview through storyboard and declare an iboutlet of class NSLayoutconstraint in tablecell for that constraint. In your tableview cell data configuration code change the constant value of that property to collectionview's contentsize.height. This will force the collectionview to increase its height which interns will force the cell to increase its height.
You can call .contentSize on the collection view to get is't size, and set that size for the UITableViewCell size.

Resources