FAQ Database Discussion Community


UICollectionView crashes when scrolling past first row

ios,objective-c,uicollectionview,uicollectionviewcell
I have an array of objects that I'm populating the label text of a custom UICollectionViewCell with. When I start the app, the cells show up fine, but as soon as I scroll past the first row of cells, the app crashes. I've enabled zombies, and the last line in...

Display button on UICollectionViewCell after UILongPressGestureRecognizer

ios,swift,uigesturerecognizer,uicollectionviewcell
I have a UILongPressGestureRecognizer on a Cell from a CollectionView and I want to display a button from that (and all the others) cells after a long touch happens. Here's my code: func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell: CellController = collection.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! CellController...

UILabel of custom UICollectionViewCell is nil

objective-c,uilabel,uicollectionviewcell
I try to make a custom UICollectionViewCell in storyboard. I have CustomCell.xib, CustomCell.h and CustomCell.m. In the .xib the Classname is linked and the identifier is set to "cell". The .xib contains 1 UIImage and 2 UILabels, all having IBOutlets to the .h class. In the ViewController where I'm using...

How to set cell spacing and UICollectionView - UICollectionViewFlowLayout size ratio?

ios,swift,uicollectionview,uicollectionviewcell,uicollectionviewlayout
I'm trying to add UICollectionView to ViewController, and I need to have 3 cells 'per row' without blank space between cells (it should look like a grid). Cell width should be one third of screen size, so I thought that the layout.item width should be the same. But then I...

UICollectionView: Waterfall layout with Drag & Drop

ios,drag-and-drop,uicollectionview,uicollectionviewcell,uicollectionviewlayout
I am using CHTCollectionViewWaterfallLayout as the layout for my collectionView, since my cells do all have different sizes. But I would also like to implement drag & drop in my collectionView. The libraries I have found would not allow me to implement both at the same time. Is there any...

Strange behavior when adding UIButton to UICollectionViewCell

ios,objective-c,uiimageview,uibutton,uicollectionviewcell
I'm trying to add aUIButton to aUICollectionViewCell. The main purpose of the button is to let users to select their favourites. When they click on theUIButton, the UIButton will display a glowing star image, showing that the item has been picked as favourite. Click on the UIButton again, and the...

UICollectionView cell is aligned off the screen?

ios,objective-c,uicollectionview,uicollectionviewcell
I am new to using UICollectionView since I've been using UITableView, so I apologize beforehand. Anyways, I have some simple code but for some reason that I'm not familiar with yet, some of the cells are placed off screen instead of being moved down to the next level. - (void)viewDidLoad...

MainPageCollectionViewConrtoller _setViewDelegate:]: unrecognized selector sent to instance 0x7faa7ae39160

ios,swift,core-data,uicollectionview,uicollectionviewcell
I'm writing a simple program that by now it only should show a simple uicollectionview. cells contain a label and an image view.The images stored in CoreData.There is also a code for times that no data is available. But it's giving me this Error: 2015-06-16 23:03:15.694 What Can I Wear[16167:2033274]...

about UICollectionView Horizontal Paging with pure code

ios,objective-c,uiscrollview,uicollectionview,uicollectionviewcell
In order to achieve auto Horizontal scrolling, I custom a collectionView with 100 sections, and there're 5 items in every section. And then add a NSTimer, the original position is set to the middle of collectionView(the 50th sections), it works at last. (ps: the collectionView is the headerView of a...

UICollectionView reloading not properly

ios,objective-c,uicollectionview,uicollectionviewcell
I have that kind of requirement, if user has selected 1 then I have to display images (which is in collection view cell) by rotating at 90 degree and if user had selected 4 then I have to display images as round. For selection 2 and 3 display image as...

UIView in UICollectiveViewCell can't hidden

objective-c,xcode6,uicollectionview,uicollectionviewcell
I got a UICollectionView that I have created programmatically. I would like to have a collection view to behave in the following direction: User touches cell hidden uiview that cover image User touches cell again show uiview to cover the image 1.) Before user touch image in cell it look...

Asynchronously load images from document directory into UICollectionView

ios,objective-c,image,uicollectionview,uicollectionviewcell
I am trying to load images from document directory into UICollectionView. It works: smooth, fast....(lol). But I get one issue: when I call [collectionView reloadData], images flicker(once time). Here is my code: - (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView_ cellForItemAtIndexPath:(NSIndexPath *)indexPath { NSString *cellIdentifier = NSStringFromClass([AFMyRecentCollectionViewCell class]); AFMyRecentCollectionViewCell *cell = (AFMyRecentCollectionViewCell*)[collectionView_...

Animated Image animationRepeatCount CollectionViewCell

ios,swift,animation,uicollectionview,uicollectionviewcell
I have a pretty neat animation that basically draws out a border for a collection view cell. I have the animation working well, I'm unable to keep it from repeating indefinitely. In: func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { I have set up the cell this way: var...

Custom UICollectionViewCell not loading

ios,objective-c,uicollectionview,uicollectionviewcell
I'm using a storyboard and my custom UICollectionViewCell is not appearing. I played around with it for a few hours and have googled a ton of different solutions but none worked. Just to clarify, the data exists, and the UICollectionView is appearing, but the cell is not. Here is my...

Follow a UICollectionViewCell

ios,uicollectionview,uiimagepickercontroller,uicollectionviewcell
I have a UICollectionView that is populated by a UIImagePickerControl button that is in a Cell, I want the cell that is on the end of the collection view to be followed by the screen, but still enable user scrolling - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { NSString* imageString...

UICollectionView Scroll Freeze with NSData (imageView)

ios,uicollectionview,nsdata,uicollectionviewcell,sdwebimage
I've UICollectionView with UITableView in the same page. I'm using SDWebImage with UITableView and it is working fine. I'm trying to use SDWebImage with UICollectionView but couldn't make it. So I have used NSData but it is freezing with it. How I can solve this issue? UPDATE: Is there a...

Remove UICollectionView cells on edit button

objective-c,uitableview,parse.com,uicollectionview,uicollectionviewcell
I am using a UICollectionView to retrieve images and labels stored in the Cloud database Parse. I now need an option that will let me delete a certain image and its corresponding label. I am looking for something such as the typical iPhone "Edit" button on the top right hand...

Why won't UICollectionViewCells that are offscreen update?

ios,swift,uicollectionview,uicollectionviewcell
I have a UICollectionView displaying custom cells in a horizontal flow layout; in other words, some content is placed outside the screen bounds. Additionally, I have a gesture that fires an NSNotification leading to a color change of some of the elements of my cells (i.e. a theme). Everything works...

Unable to create bottom border on UICollectionView Cell

objective-c,uicollectionview,uicollectionviewcell
I need to add a 1px bottom border to my UICollectionView cells but I can't get it working, I tried the following code but the border doesn't show: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; // Configure the cell cell.backgroundColor = [UIColor whiteColor]; cell.titolo.text...

UICollectionViewCell change position

ios,objective-c,uicollectionview,uicollectionviewcell,collectionview
By default, when you create a collection view , items are top and bottom margins are generated. I want to move the cell position. (Center to bottom) Is there any way to solve ? - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return CGSizeMake(collectionView.frame.size.width / 2.2, collectionView.frame.size.height-60); } ...

Why are UICollectionViewCells no longer visibile after assigning a UICollectionViewLayout to the UICollectionView?

ios,swift,uicollectionview,uicollectionviewcell,uicollectionviewlayout
My app has a UIViewController class; inside this class I connect a UICollectionView loaded from a Storyboard. I'm creating a custom layout with the UICollectionViewLayout class. Here's what it looks like: class MyLayout: UICollectionViewLayout { override func prepareLayout() { super.prepareLayout() } override func collectionViewContentSize() -> CGSize { let attributes =...

How can I have multiple Collection Views in one View Controller?

ios,swift,uicollectionview,uicollectionviewcell
I want one View Controller to have seven horizontal button scrolls. I've set up the first Collection View, and I repeated the exact process for a second Collection View directly underneath, but I keep getting Thread 1: SIGABRT error. My code for the functional Collection View is here: class xyViewController:...

iOS collectionView: how to scroll a cell to the top of the screen

ios,objective-c,swift,uicollectionview,uicollectionviewcell
I am wondering if there is a way to scroll a certain UICollectionViewCell to the top of the view? I tried the collectionView.scrollToItemAtIndexPath() method, but instead of scrolling the cell to the top of the view, it scroll the cell to the center of the view.

Is there a way to get a collectionViews frame from a collectionviewcell

ios,uicollectionview,uicollectionviewcell
I want to use -preferredLayoutAttributesFittingAttributes inside the UICollectionviewCell subclass we are writing. Currently we already had a weak pointer to out parentViewController and I try to set the collectionViewcell frame width to be the same as parentViewcontroller.view.frame.size.width. I don't want to have a pointer to the parentViewController from the CollectionViewCell...

iOS: UICollectionViewCell auto adjust size according to screen size

ios,objective-c,swift,uicollectionview,uicollectionviewcell
I am trying to create 10 cells in the collection view(same size as the screen). When I run my app in iphone5s simulator, the view contains exactly 5 cells. But when I switch to iphone6p simulator, the view contains more than 5 cells. How should I adjust the cell size...

Cells not appearing in UICollectionView?

swift,uicollectionview,uicollectionviewcell
I have a UICollectionViewController in a storyboard which has been linked to a file called XCollectionViewController.swift which is a subclass of UICollectionViewController. My code is as follows: super.viewDidLoad() // Register cell classes self.collectionView!.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier) } override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { //#warning Incomplete method implementation -- Return the...

Base UIViewController with UICollectionView

objective-c,uiviewcontroller,uicollectionview,uicollectionviewcell,xcode-storyboard
I am having UIViewController which I want to use as a base controller for other view controllers. Base controller has a UICollectionView which has all the UICollectionViewCell prototype and some other stub views designed in storyboard. All the child view controllers have one thing in common which is UICollectionView and...

Pan Gesture in UICollectionViewCell AND UICollectionView

ios,swift,uicollectionview,uicollectionviewcell,uipangesturerecognizer
I have a collection view of bars that can slide up and down. Each cell in the collection view is using a UIPanGestureRecognizer to control the blue bar sliding up and down. The collection view does not scroll here. There is an "edit mode" which disables the pan gesture controlling...

UICollectionView Headers Overlapping

ios,objective-c,uicollectionview,uicollectionviewcell,uicollectionviewlayout
I have a collectionView with the following relevant methods: - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { if (kind == UICollectionElementKindSectionHeader) { Scoreboard *thisScoreboard = [self.scoreboards objectAtIndex:indexPath.section]; ScoreboardReusableView *view = nil; view = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader...

How to pass values to new UIViewController from UIButton of Child UICollectionViewCell in nested UICollectionViews in iOS Objective C

ios,objective-c,uiviewcontroller,uibutton,uicollectionviewcell
i have UICollectionViewController with custom UICollectionViewCell which contains child UICollectionView and custom childUICollectionViewCell. UICollectionViewController UICollectionViewCell (parentCell) UILable UICollectionView UICollectionViewCell(childCell) UILable (valueLable) UIButton (Submit) UICollectionViewCell(childCell) UILable (valueLable) UIButton (Submit) i want to send text of "valueLable" on click "Submit" button to new UIViewController. Please help me.......

UICollectionView adding image and button

xcode,uicollectionview,uicollectionviewcell
I used UICollectionView for displaying the images from CameraRoll, it is working fine, now I want to add the Camera button in the collectionview cell. I had written the code like this, button is not getting displayed. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"collectionCell" forIndexPath:indexPath];...

Use custom init method when programmaticly creating a uicollectionview

ios,objective-c,uicollectionview,uicollectionviewcell
Due to the limitations of Storyboard I am creating a UICollectionView programmatically. This is working all fine and when I want to add a UICollectionViewCell I do the following: [collectionView registerClass:[Cell class] forCellWithReuseIdentifier:@"ID"]; What I was wondering is how can I use a custom init method from the class "Cell",...

UICollectionViewCell has a not the same size on iOS7 and iOS 8

ios,iphone,uicollectionview,size,uicollectionviewcell
I'm building a UICollectionView where each cell has size of 159x159. When the app runs on ios8 it gives (whatever the simulator i choose : iPhone 4S, 5, 5S, 6, 6 Plus) : But it has not the same size on iOS7 : WTF ? Note that even my SearchBar...

Unable to update label in UICollectionView cell (Swift)

swift,uicollectionview,uicollectionviewcell
My app has a UICollectionViewController in a ContainerView that I am unable to change/update a label in any of the custom cells. My viewDidLoad function loads simply loads an array with 5 instances of a custom object that holds an image and label. This will be used later as my...

Swift: different xibs layouts for one UICollectionViewCell

ios,swift,uicollectionview,uicollectionviewcell
Is it possible to use more then one xib Layout for a UICollectionViewCell. Let's say i have a xib Layout with textfields only, let's call it "textfield.xib" and one xib with only images, "image.xib". In the collectionViewDelegate function cellForItemAtIndexPath I declare two Cells like the following Code: cell:ImageCell=collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath)...

UITextView inside UICollectionViewCell insists on growing horizontally

ios,ios8,autolayout,uicollectionview,uicollectionviewcell
I have a UITextView inside my UICollectionView cell, and it keeps getting growing horizontally depending on its content. My collection view is set to be vertically scrolling, and the cells calculate their own size. I want my text view to grow vertically depending on its contents, not horizontally. Here is...

How to save text field value in uicollectionviewcell

swift,uitextfield,uicollectionviewcell
hi i have text field in uicollectionviewcell so what i need it example : when i edit text filed value in row 5 and i done it and go to text filed in row 20 to edit value the collectionview has reloaded and forget value in row 5, so i...

Get correct button from custom UICollectionViewCell

objective-c,uicollectionview,uicollectionviewcell
I have a custom UICollectionView with custom UICollectionViewCell, I have a like button on my cell (that has been connected to the CustomCVCell.h file) and I need to change the background of this button when it gets pressed. What I did was declaring the action for the button on the...

collectionView re-usable cells causing bugs

ios,objective-c,uicollectionview,uicollectionviewcell
I am creating a collectionView whose cells are of different sizes and have different content. I am using a cell prototype for these cells, however, when I am adding more than one cell I get weird UI bugs: This is what it is supposed to look like This is what...

Add inner effect when item selected in collection view

ios,objective-c,uicollectionview,uicollectionviewcell
I have a collection view and i want to add an image , with inner effect when one item is selected . I made this but when i do scroll another item has the same effect and i don't want. How can i change this ? - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout...

Calling removeFromSuperview on subview in UICollectionViewCell does not work on first load, only when cell is reused

ios,uicollectionview,uicollectionviewcell
I have a collection view cell with a number of subviews. One of the subviews I want to remove altogether so the adjacent subview can expand to fill that space via constraints. This constraint configuration set up within the prototype cell in storyboard, and the subview is already in place...

UICollectionView Max Cell Spacing?

ios,objective-c,uicollectionview,uicollectionviewcell
I have a simple UICollectionView setup in my storyboard with a prototype cell. I have set all section insets to 10, top, left, bottom and right. The important bit, I have set the minimum spacing for cells and lines to 5. When I run the app and have for example...

UICollectionViewCell Only Updates After Scrolling

ios,objective-c,uicollectionview,uicollectionviewcell
I've got an issue with my UICollectionView where my cells are always initiated blank/in a default state with no data. The data only appears in the cells after scrolling them in and out of view. Thoughts? Thanks. CODE: -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"EquipmentCell"; APInventoryCollectionViewCell...

UICollectionView cell height/scrollable content behaving strange/incorrect

ios,ios8,autolayout,uicollectionview,uicollectionviewcell
I'm trying to make UICollectionView work like UITableView (I want the extra flexibility of collection view instead of just going with table view, both for some current and possible future feature extensions); having a fixed width (screen width) and dynamic cell height (just like iOS 8's new table view feature)....

How to achieve scrolling animation in UITableViewCell?

ios,objective-c,uitableview,animation,uicollectionviewcell
I have a necessity in my app which requires the following animation in uitable cell. The animaton can be easily seen in the following link. UITableCell animation sample How to achieve this animation?...

Inserting a new cell into a collectionview

ios,uicollectionview,uicollectionviewcell
I try to add a new cell in my UIcollectionView but it doesn't work. In fact I send a post request to my API, I wait for the response, when I get the response, I put de JSON content into an NSDictionnary. My CellForItemAtIndexPath Datasource method loads cell content from...

Full screen horizontally scrolling UICollectionView cells shift downwards when used in first displayed UIViewController

ios,uinavigationcontroller,uicollectionview,uicollectionviewcell,uicollectionviewlayout
I'm creating a series of help pages that display when the user first starts the app. To do this, I have a programatically set up UIViewController that initializes a (programatically set up) UICollectionView the size of the view controller bounds. Each cell contains a fullscreen sized image. When this view...

iOS - How to dynamically update UICollectionViewCell size after label text changed

ios,swift,uicollectionview,uicollectionviewcell
So I have a cell in UICollectionView func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { var cell: myCell = collectionView.dequeueReusableCellWithReuseIdentifier("myCell", forIndexPath: indexPath) as! myCell // cell.descrption is an UILabel cell.description.text = newText return cell } and func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { return...

UICollectionView setting the last cell a section

ios,uicollectionview,uicollectionviewcell
I'm currently working on a carousel view which works with a UICollection which has this form: [cell1][cell2][cell3] ... [cell n][ + ] So my UICollection has only one section. Each cell has content except the last one. The last cell (n+1) have a plus button inside which allows the user...

Subclass UICollectionViewCell in Swift 1.2

swift,uicollectionviewcell
Given the following UICollectionViewCell subclass: class MJCollectionViewCell: UICollectionViewCell { var MJImageView: UIImageView! var image = UIImage() override init(frame: CGRect) { super.init(frame: frame) } required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } // MARK: - Setters func setImage(image: UIImage) { self.MJImageView.image = image } } I receive the following error on...

UICollectionViewCell UIImageView ignores contentMode, overflows image

ios,swift,uiimageview,uicollectionviewcell
A rather frustrating dilema where a UICollectionViewCell is rendered with a UIImageView as it's only subview. The frame is loaded when an async call to load the image completes the call and calls the setImage() method. So usually the cell is in view already before an image may have been...

How can we use two types of UICollectionViewCell for a single UICollectionView?

ios,uicollectionview,uicollectionviewcell
I have two types of UICollectionViewCell : one is gallery cell and another is recipe cell. There is a toggle button. First time the view loads, gallery cell is used to display in collection view. But on clicking the toggle button, I tried to load another cell:(recipe cell) but it...

How to fetch images from NSDictionary to UICollectionView iOS?

ios,objective-c,uicollectionview,uicollectionviewcell
I have a dictionary with few images. It's structured like following. NSDictionary |__ bed | |__ 351.jpg | |__ 352.jpg |__ pillow | |__ pillow1.png |__ pillow2.png I tried to add it to the colloectioview like following. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return self.imagesDictionary.count; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return...

UiviewControllers inside UICollectionViewCell

ios,objective-c,uiviewcontroller,uicollectionview,uicollectionviewcell
I have a UICollectionView inside a UIViewController. The collectionView holds an array of 8 identifiers of view controllers from the storyboard. Each view controller in the array inherited from the UIViewController that holds the collectionView. Here is the code: - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return _contentPageRestorationIDs.count; } - (UICollectionViewCell *)collectionView:(UICollectionView...

iOS: Image view aspect fit with corner radius

ios,uiimageview,uicollectionviewcell
I want to set corner radius with content mode as aspect fit using following code: cell.imgvAlbum.contentMode = UIViewContentModeScaleAspectFit; cell.imgvAlbum.clipsToBounds = YES; cell.imgvAlbum.layer.cornerRadius = 5.0f; but i am getting output only for content mode as aspect fit. I have also tried for: cell.imgvAlbum.layer.masksToBounds = YES; What to do for corner radius?...

Set/Override Padding In UICollectionView Between Cells

ios,swift,uicollectionview,uicollectionviewcell
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...

Adding subviews to only one UICollectionViewCell on button tap

ios,swift,uicollectionview,uicollectionviewcell,subview
Each UICollectionViewCell has its own button hooked up to the following action: @IBAction func dropDown(sender:UIButton){ var pt = sender.bounds.origin var ptCoords : CGPoint = sender.convertPoint(pt, toView:sender.superview); var ptCoords2 : CGPoint = sender.convertPoint( ptCoords, toView: collectionView!); var cellIndex: NSIndexPath = self.collectionView!.indexPathForItemAtPoint(ptCoords2)! //var i : NSInteger = cellIndex.row; //var i2 : NSInteger...

How to avoid UICollectionView repeating cells?

ios,objective-c,uicollectionview,uicollectionviewcell
Hello I have a UICollectionView. I load data from a NSMutableArray and it has 4 objects. But my problem is its repeating the same cells again. ` - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return mutArrayArtists.count; } - (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView { return 2; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ static...

Prevent UICollectionView subview scrolling

ios,uicollectionview,uicollectionviewcell,subview,sticky-footer
I am working with UICollectionView. Never worked with this before. So,I am facing lots of issues. One is am trying to add UIView as subview on UICollectionView ,for the purpose of showing UIView as Pop-Up view on tap of UICollectionViewCell. I am able to add subview to collectionView. But problem...

AutoLayout for UICollectionView Cells

objective-c,iphone,resize,autolayout,uicollectionviewcell
I have an uicollectionview in my app which shows the photos from the camera roll (using AssetsLibrary) in small square cells by using an uiimageview. My problem is that it all looks fine on an iPhone5/5S but there is huge spacing between the cells when running it on an iPhone...

How can I change the background color of an specific UIViewCollectionCell?

objective-c,uicollectionview,uicollectionviewcell,nslog
I have a UIViewCollection with three sections, and I would like to change the background color of a UIViewCollectionCell which has a specific text. For get some idea, this is what I want: And here is my code, on Objective-C: BOOL isExactHour = [_working_dayArray containsObject:@"07:00"]; if (isExactHour) { NSInteger indexValue...

IOS Collection view cell first time click and removing selection when view appears

ios,swift,uicollectionview,uicollectionviewcell
I am using collection view, after collection view loaded if you click on any cell first time, click is not working.. If you click on another cell then the click is working.. It is happening when collection is loaded freshly. I am using navigation controller and loading anther view using...

Animating a UICollectionViewCell: Scroll To And Resize At The Same Time

animation,uikit,uicollectionview,uicollectionviewcell,uicollectionviewlayout
I'm trying to get a UICollectionViewCell to do an animated resize and at the same time have the collection view scroll the cell to the top of the collection view's viewport. When I do - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { [self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionTop animated:YES]; [collectionView performBatchUpdates:nil completion:nil]; } with -...

What should I subclass UICollectionViewLayout or UICollectionViewFlowLayout

ios,objective-c,uicollectionview,uicollectionviewcell,uicollectionviewlayout
I have the sketch of the layout as follows :- Above Image, has fixed layout structure as follows -> First Row has item no.1 and takes all the width of the collection view. ->Second row has item no. 2 and 3 and shares the width equally. ->third row onwards we...

'UICollectionViewCell' does not have a member named 'image' [Swift]

ios,swift,uicollectionview,uicollectionviewcell
I'm setting up a project with a UICollectionView that displays an image with a label. I created the ViewController and the CellViewController, just like its supposed to. In the CellViewController the code is the following: class CellController: UICollectionViewCell { @IBOutlet weak var image: UIImageView! @IBOutlet weak var label: UILabel! }...

Access main class from UICollectionViewCell class

ios,objective-c,class,uicollectionview,uicollectionviewcell
I have 3 classes. I implemented a UICollectionView programmatically - collectionViewClass.m. The configuration for the cells of the collectionView - myCells.m I have a class myClass.m that calls UICollectionView. There is a label in myClass.h that I want to access in myCells.m How can I do that? I tried: myClass...

custom checkbox in uicollectionviewcell swift ios

ios,swift,checkbox,uicollectionviewcell
hi i working on food app, the app has foods in collectionviewcell and i added checkbox in cell so how i can select some foods from cell by checkbox , i add the checkbox in collection view cell and add class for button but when i click on checkbox in...

UICollectionViewCell disappears while scrolling

ios,objective-c,uicollectionview,uicollectionviewcell
I'm using a uicollectionview to create a carousel like scroll view. I think the uicollectionview is the best approach with this use case. I was able to render uicollectionviewcell inside uicollectionview but the problems is, when I scroll the uicolectionview the later cells will disappear and all the cells went...

iOS Swift: animating CollectionViewCell elements from a button on the CollectionView

ios,swift,uicollectionview,uicollectionviewcell
I have a button on a CollectionView that animates the labels on the CollectionView (slides them back & forth). I'm wondering if it's possible to also animate the labels on the cells using the same button. I was considering collectionView:performAction as a possible solution, but I wanted to get some...

How to add checkbox to uicollectionview in swift

swift,checkbox,uicollectionviewcell
some time ago someone already asked this question and a few answers were given but i didn't really understand any of them. So i was wondering if anyone could please write an easy to understand tutorial on how to do the things shown on the image below: http://i.imgur.com/BzIBOkH.jpg?1 I would...

UICollectionViewCell Auto Size?

ios,objective-c,uicollectionview,uicollectionviewcell
Example, we have a UICollectionView with full width of the screen. This has 3 100 x 100px cells. On my iPad it will spread these across the full width leaving large gaps between each cell, naturally smaller gaps on a device with a smaller screen, i.e. an iPhone. Is it...

Steps involving in resizing UICollectionCell in swift

swift,uicollectionviewcell
I working on auto layout and size class enabled project.I tried to resize UICollectionViewCell width to make sure it fit for entire screen. code: screenSize = UIScreen.mainScreen().bounds screenWidth = screenSize.width func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize{ recentCollection.collectionViewLayout.invalidateLayout() return CGSizeMake(screenWidth, 200.0) } I do not know...

How can I calculate the size of a UICollectionViewCell loaded from a xib with autolayout aspect ratio constraints?

ios,objective-c,autolayout,xib,uicollectionviewcell
I have a UICollectionViewCell that is loaded from a xib and stored in a property to help with calculating cell sizes for my collection view. The collection view always has only one column, so the cells vary in their widths based on the phone the user has (iphone 5/6/6+). The...

Loading of images from Photos to collection view results in error message “Connection to assetsd was interrupted or assetsd died”

ios,swift,uicollectionview,uicollectionviewcell,photokit
I am trying to load all the images from the user's Photo album into my app's Collection View but after a loading a few of them, the app will close itself and return back to the main menu. The connection with XCode is also disconnected. This does not happen in...

iOS, UICollectionViewCell malformed UILabel

ios,objective-c,uicollectionviewcell
I've got a UICollectionViewController which displays blocks of telephone numbers (see image). When the view loads they all appear fine however when i either begin scrolling, changing rotation, or execute a search function which alters the (mutable) array in which the data is sourced, i see these malformed labels. I...

UICollectionView showing cells with multiple sizes?

ios,swift,uicollectionview,uicollectionviewcell
I have a UICollectionView in my storyboard which has a UICollectionViewCell of which I have clicked and dragged to make its size 100w 100h. I also have a swift file controlling this. The code is as follows: override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { //#warning Incomplete method implementation -- Return...

How do I make individually self-sizing UICollectionViewCells with multiple labels in Swift?

swift,uicollectionview,uicollectionviewcell,uicollectionviewlayout
Here is my view controller: // ReadArticleViewController.swift // // Created by Nathan Cain on 11/26/14. // Copyright (c) 2014 Nathan Cain. All rights reserved. // import UIKit import Realm class ReadArticleViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource { var pronunciationArray: [String] = [] var wordArray: [String] = [] @IBOutlet var collectionView: UICollectionView! @IBOutlet...