uicollectionviewcell

Keep UICollectionViewCell centered after Zooming with UIPinchGestureRecognizer

痞子三分冷 提交于 2020-01-03 02:51:05
问题 I'm having this issue. I change the scale and as well the transition of the view of a UICollectionViewCell , for doing zoom in the position of my fingers do the UIPinchGesture. But after that, the position of the view changes and the view go off the screen and its bounds. I want that the Gesture View get back to its correct position. This is what is happening: I have tried to assign a CGAffineTransformIdentity to the view if the center of the cell changes, but after the Scale and the

How to give width and height programatically for collection view cell in ios, swift 3

为君一笑 提交于 2020-01-03 02:01:06
问题 I tried to give the height and width for collectionViewCell , programatically. I used following method: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let viewWidth = self.deviceWidth/3 - 5 let viewHeight = viewWidth return CGSize(width :100,height: 100) } This didn't work. even this method didn't show as a hint. Help me with this. Is there any other delegate method to set the cell

Reuse of UICollectionViewCells during scrolling

别等时光非礼了梦想. 提交于 2020-01-02 23:15:42
问题 I'm having an issue, I have a simple UICollectionView with a static 200 cells that load images from Flickr. my CellForItemAtIndexPath looks like this: - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"FlickrCell" forIndexPath:indexPath]; cell.backgroundColor = [self generateRandomUIColor]; if(![[cell.subviews objectAtIndex:0] isKindOfClass:[PFImageView

nil label for custom UICollectionCell

不羁的心 提交于 2020-01-02 08:57:28
问题 EDIT : seems like same question as this I made collection view with custom layout and cell but my cell's positions were a little off so I decided to number them so that I could debug it easier. I followed this guy's answer to number my cell using labels. Somehow myLabel was nil and caused my app to crash. I believe I have connected the outlets correctly but maybe someone could provide a list for me to check if I am doing anything wrong. ViewController import UIKit class ViewController:

Set/Override Padding In UICollectionView Between Cells

随声附和 提交于 2020-01-02 08:10:59
问题 I have a UICollectionView and I'm running into an issue with getting the padding between cells. In theory, I should be able to divide the screen by 4, and I can get a cellsize that has 4 images which perfectly take up the screen width. But, it chooses not to do that. Instead it creates 3 images with HUGE padding as shown below: _cellSize = CGSizeMake(UIScreen.mainScreen().bounds.width/4,UIScreen.mainScreen().bounds.width/4) So I decreased the cell size a bit to create some padding, and this

How to insert images in uicollectionview programmatically?

守給你的承諾、 提交于 2020-01-01 20:49:20
问题 I'm pretty new to Objective-C so hopefully this all makes sense..I ran code provided in first answer Creating a UICollectionView programmatically..It is working fine .Now i want to add some pictures in cell that can expanded by mouse click .I searched many tutorial but all using nib files or storyboard files .How i can accomplish this task programmatically ? Any help would be greatly appreciated. Thanks in advance. 回答1: Beginner read tutroial and understand first everyting in below link and

Presenting a UIPopoverController from UICollectionViewCell

半城伤御伤魂 提交于 2020-01-01 10:04:54
问题 I'm looking to present a UIPopoverController from a button on a UICollectionViewCell. So far, everything is created ok, but the popover isn't visible. Is there a special way of doing this? The code works if I display it from anything else other than a collection view cell. The following code is in the UICollectionViewCell subclass. if (_infoPopover == nil) { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; GameInfoViewController *gameInfoVC =

UICollectionView - Horizontal AutoScroll with Timer

五迷三道 提交于 2020-01-01 07:22:44
问题 I am using Horizontal Auto Scroll using timer. I want it to scroll one by one. In my case it is scrolling continuos from left to right. and in last it also scroll white space after last cell. @interface AccountsVC ()<UICollectionViewDataSource, UICollectionViewDelegate,UICollectionViewDelegateFlowLayout> { CGFloat width_Cell; NSTimer *autoScrollTimer; } - (void)viewDidLoad { [super viewDidLoad]; width_Cell = 0.0; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self

collectionViewContentSize() vs contentSize

折月煮酒 提交于 2020-01-01 06:26:14
问题 What is the difference between collectionViewController.collectionViewLayout.collectionViewContentSize() and collectionViewController.collectionView.contentSize ? What do you prefer to use? 回答1: collectionViewContentSize() is a method you can override (in the layout) to generate the size dynamically. contentSize is a property of collectionView that is going to be used if there is no such override. It is similar to a UITableView 's rowHeight vs. the UITableViewDelegate 's

UICollectionView how to deselect all

让人想犯罪 __ 提交于 2020-01-01 04:23:06
问题 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