uicollectionviewcell

Autolayout is not resizing Uicollectionviewcell items when animating between layouts

旧巷老猫 提交于 2019-12-21 06:36:31
问题 I have a uicollectionview cell with an image view inside that I want to resize when I switch to a larger 'zoomed in' layout. I have placed constraints inside the cell that does resize the image view when the zoomed in layout is displayed. I am using uicollectionview setLayout animated method. The problem is the image does not scale with animation only the collection view cell does. The image seems to just jump into its end size with no interpolation. So the animation looks extremely choppy.

Expanding UICollectionView and its cell when tapped

拜拜、爱过 提交于 2019-12-21 06:28:26
问题 I am trying to make a transition animation like the demonstration in the link here. So when I clicked the cell, it expands and covers the whole screen. Here are my codes(I have to admit that I am not familiar with CollectionView)` import UIKit class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { @IBOutlet weak var mainDesLabel: UILabel! @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var secDesLabel: UILabel! let searchBar =

Swift - Call self.navigationController into custom cell class

半世苍凉 提交于 2019-12-21 05:11:26
问题 Swift: I have UICollectionViewController with another file/class UICollectionViewCell The goal is to push UIViewController from my custom cell class. something like this: self.navigationController?.pushViewController(vc, animated: true) I have no problems to implement push from didSelectItemAtIndexPath in UICollectionViewController but i want to do this from custom cell class registered into my UICollectionViewController . When i try to push view from custom cell class unfortunately i don't

Swift, Change width of UICollectionViewCell and UILabel(inside the cell) programmatically

那年仲夏 提交于 2019-12-21 04:13:28
问题 I've set the width of a cell(UICollectionViewCell) to be equal to the width of the UICollectionView and I'm trying to do exactly the same thing with the UILabel that is included inside that cell. I think the code below explains exactly what I'm trying to achieve. So i've read some question here in SO and also a couple of tutorials but I'm still not sure how I can achieve this. In a couple of questions it was saying about using collectionViewLayout but I'm really struggling on how to use it

UICollectionView: different size items is not calculated on reused items

廉价感情. 提交于 2019-12-21 03:42:26
问题 I have a collection view with varied item sizes which i declare in - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { FeedItem *item = [_imagesLinkArray objectAtIndex:indexPath.row]; return CGSizeMake(250, 200*item.sizeFactor); } When the cell is being reused in collectionView:cellForItemAtIndexPath: the item is being rendered with the reuesed item size and not the one specified in

Swift: UICollectionViewCell didSelectItemAtIndexPath Change backgroundColor

雨燕双飞 提交于 2019-12-21 02:42:19
问题 I'm easily able to change the background color of a cell in the CellForItemAtIndexPath method func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { cell.backgroundColor = UIColor.blackColor() } However, when I attempt to change the color in the DidSelectItemAtIndexPath it does not work. func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { let cell: ButtonCollectionCell

Populating UICollectionView in reverse order

。_饼干妹妹 提交于 2019-12-20 23:22:14
问题 I would like to populate UICollectionView in reverse order so that the last item of the UICollectionView fills first and then the second last and so on. Actually I'm applying animation and items are showing up one by one. Therefore, I want the last item to show up first. 回答1: I'm assuming you are using UICollectionViewFlawLayout, and this doesn't have logic to do that, it only works in a TOP-LEFT BOTTOM-RIGHT order. To do that you have to build your own layout, which you can do creating a new

UICollectionViewCell dynamic sizing for 4.4 and 5.5 inch

穿精又带淫゛_ 提交于 2019-12-20 18:58:10
问题 I have UICollectionView with cells in the storyboard. The size of each cell is set to 145x145. They look good on the iPhone 4 - 5s, but the size doesn't increase proportionally on the iPhone 6 and 6+. Rather than manually setting a different cell size for each device, how can I do it dynamically? See examples here: iPhone 5S: http://prntscr.com/55vy7q, iPhone 6: http://prntscr.com/55vyy2 回答1: If you want your cells to adjust their width, you'll need to calculate the flow layout's itemSize

Perform a segue programmatically

帅比萌擦擦* 提交于 2019-12-20 18:32:23
问题 Hi I'm trying to perform a segue programmatically without the Storyboard. Currently I have this as my code: override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "popOutNoteExpanded" { let vc = segue.destination as! ExpandedCellViewController let cell = sender as! AnnotatedPhotoCell sourceCell = cell vc.picture = cell.imageView.image print("button pressed") } } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

Perform a segue programmatically

假装没事ソ 提交于 2019-12-20 18:31:27
问题 Hi I'm trying to perform a segue programmatically without the Storyboard. Currently I have this as my code: override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "popOutNoteExpanded" { let vc = segue.destination as! ExpandedCellViewController let cell = sender as! AnnotatedPhotoCell sourceCell = cell vc.picture = cell.imageView.image print("button pressed") } } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {