uicollectionview

UICollectionView estimatedItemSize - last cell is not aligned

别来无恙 提交于 2019-12-30 01:36:13
问题 I want to make a usual horizontalScrolling flowLayout UICollectionView with estimatedItemSize and preferredLayoutAttributesFittingAttributes in cell. But there is something wrong with last cell. Any idea where is the issue? Project itself @implementation RowCollectionView - (instancetype) initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout { if (self = [super initWithFrame:frame collectionViewLayout:layout]) { [self configureRowCollectionView]; } return self; } -

Add UICollectionView in UICollectionViewCell

倖福魔咒の 提交于 2019-12-30 01:31:06
问题 I am using Swift to build an iOS application for the Hospital I work at. Somehow, in a specific feature I have to put a UICollectionView inside the UICollectionViewCell . The one I want to achieve was for every content of the parent UICollectionView (vertical scrolling) would have several children (Which can be scrolled horizontal) depending on the parent row. For illustration, I have to display list of doctors (name & photo) and then I have to display each of the practice schedule of them

UICollectionView shows only the first item

試著忘記壹切 提交于 2019-12-29 09:38:10
问题 I'm working on a project similar to a video album. In that I'm using UICollectionView to display the thumb images of those videos. The worst part is that I should not use storyboard or xib files. I have tried to do this programatically. I'm currently working on this code: - (void)viewDidLoad { i = 0; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; [layout setItemSize:CGSizeMake(self.view.frame.size.width/2.5,self.view.frame.size.width/2.5)]; collectionView = [

UICollectionView images not showing

夙愿已清 提交于 2019-12-29 09:11:47
问题 I have an issue with the images not showing, even though they are loading. I have tried this several different ways and the same result... no images. I do get white rectangles that are the size and color specified in the Storyboard. I get the correct number of rectangles in the popover. The log shows the names and ids correctly. If I call the array directly, I get the same result... white rectangles. My target is iOS7. Running Xcode 5.0.2. Images are coming from a SQL database. This is a live

Error: UICollectionView must be initialized with a non-nil layout parameter

蹲街弑〆低调 提交于 2019-12-29 08:40:08
问题 I am trying to create a Facebook messenger like application from a youtube tutorial. I have a home page where the user click BarButton to open the chats. The Home page works fine, until I click on the BarButton to open the chats, it crashes with the following error message "UICollectionView must be initialized with a non-nil layout parameter". I am new to iOS development so can't really understand what the problem is exactly because I already have the init method. Am I missing something in

In a UICollectionView, the cells will not sit on the bottom

我怕爱的太早我们不能终老 提交于 2019-12-29 08:01:38
问题 Note it turned out it was a simple mistake the cells would not "sit on the bottom". However, it's an interesting question: "how to move the cells up and down." Below a brute force solution: writing your own flow layout. I was amazed that the only way to do it is entirely subclass UICollectionViewFlowLayout and write some tricky code in layoutAttributesForElementsInRect . It's possible this will help someone in the future, as there is very little example code for

UICollectionViewCell shadow color

夙愿已清 提交于 2019-12-29 06:14:28
问题 In the new UICollectionView I do not see how to add a shadow to a UICollectionViewCell. How would I go about this. Would I add another view? [self.collectionView cellForItemAtIndexPath:[self.collectionView indexPathForItemAtPoint:[recognizer locationInView:[self view]]]].layer.shadowPath = [UIBezierPath bezierPathWithRect:rect].CGPath; [self.collectionView cellForItemAtIndexPath:[self.collectionView indexPathForItemAtPoint:[recognizer locationInView:[self view]]]].layer.shadowColor = [UIColor

How to show a collectionView like facebook upload image using swift 4?

穿精又带淫゛_ 提交于 2019-12-29 05:36:07
问题 Hello i want to show the collectionView exactly as the above image. I know that it responsible for UICollectionViewFlowLayout, but unable to do it. Help is much appreciated. Here is my code func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let yourWidth = (collectionView.bounds.width - 4) / 3.0 let yourHeight = yourWidth return CGSize(width: yourWidth, height: yourHeight) } 回答1: Your

Assertion Failure in UICollectionViewData indexPathForItemAtGlobalIndex

只愿长相守 提交于 2019-12-29 04:30:24
问题 I am using performBatchUpdates() to update my collection view, where I am doing a complete refresh, i.e. delete whatever was in it and re-insert everything. The batch updates are done as part of an Observer which is attached to a NSMutableArray ( bingDataItems ). cellItems is the array containing items that are or will be inserted into the collection view. Here is the code: - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *

Expandable UICollectionViewCell

对着背影说爱祢 提交于 2019-12-29 03:31:11
问题 I'm trying to program an expandable UICollectionViewCell. If the user presses the topbutton, the cell should expand to a different height and reveal the underlying content. My first implementation features a custom UICollectionViewCell, which can be expanded by clicking the topbutton, but the collectionview does not expand too. Atm. the cell is the last one in the collectionview and just by swiping down enough, you can see the expanded content. If you stop touching, the scrollview jumps up