uicollectionviewcell

Custom Triangular UICollectionviewCell In collectionview

谁都会走 提交于 2019-12-06 04:50:41
Normally UICollectionviewcell is of rectangular box shaped and we can modify the appearance in custom UICollectionViewCell , But in my case i want the cell to be of shape triangular or any shape other than simple rectangular, How can i achieve this function? override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) var path = UIBezierPath(); var mask = CAShapeLayer(); path.moveToPoint(CGPoint(x: 0,y: 0)) path

Add UILabel Under UICollectionView Cell

删除回忆录丶 提交于 2019-12-06 01:37:31
问题 I have a UICollectionView that shows images, similar to cover art, or iBooks. I would like for it to show the title of the audio clip underneath the UIImageView. I have in my MainWindow.xib a View Controller with a UICollectionView inside it. I also built a NibCell.xib for the cell itself. In the Cell, I have a UIImageView that fills up all but the bottom 30 px of the cell. In this area I add a UILabel. I give the UIImageView a tag of 100 and UILabel a tag of 200, and in my code I put: -

viewWithTag returns nil when initializing a UICollectionViewCell

别说谁变了你拦得住时间么 提交于 2019-12-06 01:31:14
问题 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

Load many gif to UICollectionView

折月煮酒 提交于 2019-12-05 23:40: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 = [

How make a collectionViewCell auto size only by height?

你说的曾经没有我的故事 提交于 2019-12-05 21:35:07
问题 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

Can't set shadow on UICollectionViewCell and have rounded corners. Can only make one work at a time

吃可爱长大的小学妹 提交于 2019-12-05 21:32:57
I have a UICollectionViewCell subclass and I need to round its corners and add a shadow as well. The cell looks like a square card, and the cells have a good amount of space in-between them. So "underneath" every cell, I would like to add some shadow. I can successfully do this, but then my cell only has rounded corners on the bottom. The top just has normal corners. I need rounded corners for all four corners. I have found solutions on here for UIViews that recommend adding a separate UIView as a subview , but I would prefer to avoid this for performance reasons. I did find one solution which

looping through all cells in UICollectionview

梦想的初衷 提交于 2019-12-05 19:01:19
问题 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. 回答1: You cannot loop through non-visible cells because those cells don't

Initializing a custom UICollectionViewCell

Deadly 提交于 2019-12-05 18:50:22
I have a custom UICollectionViewCell that has a custom background view which is drawn using one of several colour schemes. The colour scheme for the background view is set in my custom initializer -(id)initWithFrame:andColourPalette: for the View. I have a similar custom initialiser in my UICustomViewCell subclass but I can't figure out how to call this initialiser when I am setting up the cell in cellForItemAtIndexPath: Can anyone help me do this? Or offer alternative solution for passing this Dictionary of colours into the Cell to pass on to the subView? EDIT to show more detail: This is

UICollectionView last cell not aligned

浪子不回头ぞ 提交于 2019-12-05 15:02:31
I am new to iOS and I now have an issue. My goal is to get a sliding bar with filtering buttons on it. I have a UICollectionView as a subview in some other view all is displaying well except for the last cell. Here is the delegate and datesource of the uicollectionview class PmtCategoryCollectionViewController: UICollectionViewController { var categories = ["Mediterranean", "Italian", "French", "Chinese", "American", "Indian"] var buttonDistanceToEachOther: CGSize = CGSize(width: 20, height: 60) var fontOnCategoryButton = UIFont.systemFontOfSize(15.0) override func viewDidLoad() { super

What is the correlation between bounds.size and frame.size when animating UICollectionViewCell

妖精的绣舞 提交于 2019-12-05 14:36:09
I've read on several posts (like https://stackoverflow.com/a/5340339/1084822 and https://stackoverflow.com/a/15582466/1084822 ) that to resize a UIView with animation, we can't animate the frame and we must do it with a mix of bounds.size, bounds.origin and position. However, I can't find what is the correlation between those properties and those of the frame. I have a UICollectionView with a custom layout. When a cell is deleted, the layout is refreshed and every cell gets its new frame through the prepareLayout and layoutAttributesForElementsInRect: methods. Then, the