uicollectionviewcell

Perform Segue from UICollectionViewCell Button different from Cell Click

扶醉桌前 提交于 2019-12-03 14:02:29
问题 I have a UICollectionViewCell , with a UIButton . And I have two different actions. The first one, when the user presses the cell, it will segue to another view with didSelectITemAt ; the second one, when the users presses the UIButton inside the cell. My problem is that on Swift Code of MyCollectionViewCell , I cant perform a segue, When I write the Code: self.performSegue(withIdentifier: "toStoreFromMyDiscounts", sender: nil) it says the error: Value of Type MyCollectionViewCell has no

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

左心房为你撑大大i 提交于 2019-12-03 12:57:24
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 within my code. Any ideas? Thank you! func collectionView(collectionView: UICollectionView,

Dynamically change cell size according to image in a UICollectionView

白昼怎懂夜的黑 提交于 2019-12-03 12:53:57
I am displaying dynamic images recieved from server in a horizontal collection view. When I set up the collectionview I set this: -(void)setupCollectionView{ [self setupPageControlView]; self.screensCollectionView.delegate=self; self.screensCollectionView.dataSource=self; [self.screensCollectionView registerNib:[UINib nibWithNibName:@"FGAppScreensCollectionViewItemCell" bundle:nil] forCellWithReuseIdentifier:@"screenCell"]; UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; [flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal]; [flowLayout

Resizing UICollectionViewCell After Data Is Loaded Using invalidateLayout

回眸只為那壹抹淺笑 提交于 2019-12-03 12:46:19
This question has been asked a few times but none of the answers are detailed enough for me to understand why/how things work. For reference the other SO questions are: How to update size of cells in UICollectionView after cell data is set? Resize UICollectionView cells after their data has been set Where to determine the height of a dynamically sized UICollectionViewCell? I'm using MVC but to keep things simple lets say that I have a ViewController that in ViewWillAppear calls a web service to load some data. When the data has been loaded it calls [self.collectionView reloadData] The self

Cell of UICollectionView not always refreshed after a scroll

允我心安 提交于 2019-12-03 11:51:57
I have defined in my Storyboard (iPad) a view that contains a UICollectionView , at the bottom of the view there's also a UIToolbar . In the UICollectionView I have added a UICollectionViewCell (implemented by an iPadCellCollectionViewCell class) that contains a another view that is a Core-Plot Graph (a CPTGraphHostingView class). I have a class called X that implements the UICollectionViewDelegate and UICollectionViewDataSource . In the class X, I build for each cell of my view (in ViewDidLoad ) the Core-Plot Graph and I have the following code to link the graph to the cell of the

UICollectionView with dynamic height not getting same space between cell

可紊 提交于 2019-12-03 11:39:48
I am having similar problem like this I am generating height of view at run time.Here is my code @interface CollectionViewController () { NSMutableArray *arrMain; } @property(nonatomic,strong) NSMutableArray *arrMain; @end @implementation CollectionViewController @synthesize arrMain, - (void)viewDidLoad { [super viewDidLoad]; [cView registerNib:[UINib nibWithNibName:@"CViewCell" bundle:nil] forCellWithReuseIdentifier:kCellID]; CViewFlowLayout *fl = [[CViewFlowLayout alloc] init]; self.cView.collectionViewLayout = fl; NSString *strJson = MY FUNCTION WHICH RETURNS JSON STRING; SBJSON *parser = [

UICollectionView how to deselect all

╄→尐↘猪︶ㄣ 提交于 2019-12-03 11:15:09
I have a FollowVC and FollowCell Setup with collection View. I can display all the datas correctly into my uIcollection view cell using the following code with no problem. func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { if let cell = collectionView.dequeueReusableCellWithReuseIdentifier("FollowCell", forIndexPath: indexPath) as? FollowCell { let post = posts[indexPath.row] cell.configureCell(post, img: img) if cell.selected == true { cell.checkImg.hidden = false } else { cell.checkImg.hidden = true } return cell } }

is possible to zoom in/out a UIImageView in custom cell of a UICollectionView only when pinch the cell's imageView?

女生的网名这么多〃 提交于 2019-12-03 10:20:54
问题 I have a CollectionView that have one custom cell. I want to zoom in/out imageView in cell, so i add pinch gesture at CollectionView.m when i add gesture to self.collectionView, like this: [self.collectionView addGestureRecognizer:pinchGesture]; it works! my cell.imageView can zoom in/out, but when i pinch other place(not in cell's imageView, my cell.imageView still zoom in/out with the gesture, I want the cell.imageView zoom in/out just when user pinch the cell.imageView, so i try to add

Xcode Interface Builder 9.1 Collection View Cells have too small “expected height”

£可爱£侵袭症+ 提交于 2019-12-03 10:20:45
Recently, I encountered a problem with the Interface Builder which I failed to solve. I'm using a UICollectionViewController and whenever I add a Cell it immediately shows a orange rectangle (indicating a auto-layout update). Updating the frame/cell doesn't change anything. The warning associated with the orange marking reads "Expected: height=Y, Actual: height=X" where Y is always exactly X-100. That is: When I set a custom cell height of 193, it says "Expected: height=93". This happens no matter which size I enter. The problem with this is that I have many difficulties with the subviews and

UICollectionView - Scrolling to first cell

心不动则不痛 提交于 2019-12-03 10:10:38
I'm making use of UICollectionView and I need to scroll to first cell after click in a button. The button is located in a (big) header section in my collection view... when clicking int it, I need scroll to my first cell located bellow of this button. I created a action of this button, but I don't know how to scroll to first UICollectionViewCell. Can someone help me? Use this delegate method, setting the indexPath at the first position: Swift self.collectionView?.scrollToItemAtIndexPath(NSIndexPath(forItem: 0, inSection: 0), atScrollPosition: .Top, animated: true) Swift 3 self.collectionView?