uicollectionviewcell

How to adjust UIView height according to the Collection View Content Height in swift 3?

﹥>﹥吖頭↗ 提交于 2019-12-04 05:39:38
问题 I have a problem of adjusting the UIView height in my project. I illustrated the project. Let me explain about my project image. Each Orange UIView has trailing, leading , top and bottom constraints and vertical spacing to each UIView. But, I add "Height" to each UIView because if I don't add, it gives error and add the "Height" warning. In UIView2, I add 3 Container Views. Each Container Views has 3 View Controllers. (Data 1 View, Data 2 View, Data 3 View) I embed Collection View inside in

Why won't my Collection View Cells display in the iPhone Simulator?

☆樱花仙子☆ 提交于 2019-12-04 05:37:50
问题 I am trying to programmatically create a Collection View with six cells. The iPhone Simulator in Xcode 8 told me that my build was successful. There is still an error though. Any help spotting the bug or bugs that are causing my cells not to display in the Simulator is greatly appreciated. (I put the Collection View directly into the IB from the Object Library. Also, I want each cell to occupy the entire size of the Collection View, hence displayedCellDimensions , because the user will segue

Load many gif to UICollectionView

岁酱吖の 提交于 2019-12-04 05:19:30
I am facing problem when I download gif images and add in to collection view. gif images are download well, but when i try to scroll very very quickly it's crash Please help. I have two solutions /* cellForGif.layer.borderColor = [[UIColor colorWithRed:54.0/255.f green:56.0/255.f blue:67.0/255.f alpha:1.0]CGColor]; cellForGif.layer.borderWidth = 0.7; FLAnimatedImage __block *gifImage = nil; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ gifImage = [[FLAnimatedImage alloc] initWithAnimatedGIFData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle]

viewWithTag returns nil when initializing a UICollectionViewCell

落花浮王杯 提交于 2019-12-04 05:17:28
Just getting started with UICollectionView . I've used IB to create a simple UICollectionView in a UIViewController . It scrolls horizontally with paging. I placed a simple UICollectionViewCell inside the UICollectionView . I set the reuse identifier for the cell. I placed a UILabel with a tag of 100 inside the UICollectionViewCell . In viewDidLoad , I call: [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Thing"]; Later I attempt to initialize the cell like so: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView

UICollectionView reload data Issue

假如想象 提交于 2019-12-04 03:57:17
问题 I have a problem with data reloading using UICollectionView . I have this array on the viewDidLoad to fill the UICollectionView. array = [[NSMutableArray alloc] init]; [array addObject:@"1"]; [array addObject:@"2"]; [array addObject:@"3"]; [array addObject:@"4"]; [array addObject:@"5"]; [array addObject:@"6"]; and the method: -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { NSString *cellIdentifier = @"Cell"; //cell =

looping through all cells in UICollectionview

会有一股神秘感。 提交于 2019-12-04 03:33:50
I have UICollection in which there will be number of Students items and each item having switch inside it used for recording attendance. I am loop through all visible cells like this. for(attendancecollectionViewCell* cells in [[self collectionView] visibleCells]){ NSLog(@"The switch value : %c",cells.attendanceSwitchLabel.isOn); } But, I wanted to loop through all the cells for attendance, not just the visible cells. You cannot loop through non-visible cells because those cells don't exist. UICollectionView, like UITableView, reuses cells as soon as they are offscreen. I.e., if you scroll

How make a collectionViewCell auto size only by height?

喜夏-厌秋 提交于 2019-12-04 03:15:05
I use feature of autosizing flow layout of collectionView self.flow = [[UICollectionViewFlowLayout alloc] init]; self.flow.scrollDirection = UICollectionViewScrollDirectionVertical; self.flow.sectionInset = UIEdgeInsetsZero; self.flow.estimatedItemSize = CGSizeMake(320, 48); I want to cells will fill by width full width of CollectionView (widthCell=widthCollectionView) But i got what autosizing work for whole size. I try playing with Content Compression/Hugging Priority - not effect. With width of CollectionView equals 320px, i got cell size for label content size. My cell looks like

Setting corner radius on a cell kills UICollectionView's performance

好久不见. 提交于 2019-12-04 00:28:44
问题 I have a UICollectionView that has only a few cells (about 20). Performance for this collection works great. However, as soon as I try to round the corners of the UICollectionViewCells that are being rendered by this view, my performance takes a significant hit. In my cell's init method, this is the only line I add to cause this: [self.layer setCornerRadius:15]; Since this is in the init method and I am reusing the cells properly, I don't see why this should be causing me issue. I have tried

Specify row and column number for UICollectionView

老子叫甜甜 提交于 2019-12-04 00:16:31
I want to show a UICollectionView which contains exactly 2 rows and 100 cells in each row. // 1 - (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section { return 100; } // 2 - (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView { return 2; } // 3 - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath { MyCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath]; cell.lbl.text = @"Data"; return cell; } I am getting this: How can I specify a row

UICollectionView - Horizontal AutoScroll with Timer

最后都变了- 提交于 2019-12-03 21:53:14
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 configAutoscrollTimer]; } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated];