uicollectionviewcell

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

陌路散爱 提交于 2019-12-22 09:21:03
问题 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

Initializing a custom UICollectionViewCell

霸气de小男生 提交于 2019-12-22 09:07:51
问题 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

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

倖福魔咒の 提交于 2019-12-22 08:38:44
问题 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

Why UICollectionView didSelect method does not work?

廉价感情. 提交于 2019-12-22 07:58:17
问题 I've created my UICollectionView programmatically and in this case my didSelectItemAtIndexPath method does not call at all. let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: CGRectGetWidth(self.view.frame), height: 360), collectionViewLayout: layout) collectionView.delegate = self collectionView.dataSource = self collectionView.userInteractionEnabled = true So, what is a problem? Why when I tap on the cells I do not get my response? func collectionView(collectionView:

UITableViewAutomaticDimension not working on iOS 8

风格不统一 提交于 2019-12-22 05:36:10
问题 I was following this tutorial to make self sizing cells. I registered custom cell into table view and in the cell xib I gave every subview constraints manually. Please refer to the source code in GitHub Arranging 3 labels vertically in one cell's content view worked fine in iOS 9 but not in iOS 8 (both tested in device and simulator). In iOS 8 one cell does not have fitting height and not every label shows all it's full text. iOS 8 not fitting: iOS 9 as I expected: Any advice would be

Using a UICollectionView to build a Monthly/Weekly calendar

被刻印的时光 ゝ 提交于 2019-12-22 01:28:03
问题 I want to build a calendar using a UICollectionView. The calendar should have two layouts: Weekly - 7 days with paging. Should be horizontally scrollable. Monthly - full month with paging. Should be horizontally scrollable. I want a "numbers only" calendar - something that works like the iOS native calendar (without the full daily schedule - just the numbers) The user should be able to move from layout to layout by dragging the bottom of the collection view (making the week bigger to see a

I have a UICollectionView and i want to show an image in a Cell, that goes to a normal ViewController. How do i do that?

馋奶兔 提交于 2019-12-21 23:12:12
问题 I have a UICollectionViewController (with a navigation controller) and i want to show an image in a Cell that 'pushes' to a normal ViewController (different by every image). How do i do that? 回答1: Seem you want to build photo gallery by UICollectionView. If use storyBoard, use segue - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showDetail"]) { NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems]

XCode 6 UICollectionview viewwithtag not working

老子叫甜甜 提交于 2019-12-21 14:59:17
问题 Seems XCode 6 is different in using viewwithtags then XCode 5 was. I am using the following code in XCode 6 with Storyboards. 50 cells are created but the label is not visible.Everything is set correctly like the tag etc. If I use the "old" XCode 5 way to do it with Register cell classed it seems to work for iOS 7 but in iOS 8 the data is not passed to the label until I start to scroll. static NSString * const reuseIdentifier = @"MyCell"; - (void)viewDidLoad { [super viewDidLoad]; // Register

UICollectionViewCell Auto Layout

两盒软妹~` 提交于 2019-12-21 10:41:39
问题 I have made up a simple custom UICollectionViewCell in my storyboard, I also did this programatically with identical results. It has a singular UIImageView and two UILabels , like so: <--UIIMAGEVIEW--> <--UILABEL--------> |-(10px)- | | -(10px)- -(10px)-| <---------------> <--UILABEL--------> The image is sat on the left, then to the right of it are two labels above and below each other. Each are spaced out with 10 pixel gaps, and all centred on the cells Y axis. The labels then have a

UICollectionView Cell Overlap

谁都会走 提交于 2019-12-21 09:12:24
问题 I have a horizontal UICollectionView. I want to make the cells overlap each other by a certain amount of 60 pixels so that the second cells overlaps the first by 60 pixels and the third overlaps the second by the same amount and so on. I tried sub classing UICollectionViewFlowLayout. But I am not able to place the UICollectionviewCell on top of one another. 回答1: Starting with this tutorial: https://web-beta.archive.org/web/20151116053251/http://blog.tobiaswiedenmann.com/post/35135290759