FAQ Database Discussion Community


iOS 7 - Layout advice

ios,objective-c,uiscrollview,autolayout,uicollectionview
I have the following layout in my view controller. I want to be able to scroll vertically with the header scrolling off the view and the UISegmentedControl sticking to the top of the view, beyond that the remaining scroll should be handled by the Collection View. However I'm a bit...

UICollectionView find center cell when content inset is used

ios,objective-c,uicollectionview
I'm trying to figure out how to find the center most cell of my UICollectionView, which is set to only scroll horizontally. I tried this SO: how to get indexPath for cell which is located in the center of UICollectionView but it isn't working out, I think because I'm using...

How to avoid the memory issue while scrolling an UICollectionView which loads lot of images from Remote server?

ios,multithreading,memory-leaks,uiimageview,uicollectionview
I'm displaying lot of images (5k images) in UICollectionView. These images has been download from remote server. When I scroll from top to bottom and vice versa of the UICollectionView for 5 to 6 times, my app get crashes and I received error "Terminating app due to memory pressure". Please...

How to scroll UICollectionView to the bottom programatically?

ios,objective-c,uiscrollview,uicollectionview
I have a UICollectionView. I want to scroll to the bottom when the view appears. How to do this? Can someone help me out on this?. Thanks in advance....

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_...

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...

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...

IOS - SWIFT - CollectionView With images, loading URLs from array

ios,image,url,uicollectionview
I have a collection view and array with URLs of different images. and when i launch the app, collection view starts to load images through the array: func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! CellView var url = arr[indexPath.row] var urls...

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 =...

UICollectionView layout issue on iphone 5

ios,objective-c,layout,uicollectionview,uicollectionviewlayout
I have a problem with my UICollectionView, I have 3 columns and everything works fine instead of iphone 5 and 4. In iphone 6 my collectionview looks that (width in cell): Iphone 5 with cells: The problem is, when in last row, I have 2 cells, and it looks like...

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...

ios UICollectionView slow scrolling and memory warning

ios,objective-c,uicollectionview,avassetimagegenerator
I am currently working on a project that involves a UICollectionView populated by AVAssets imported from a UIImagepickerController, after 10 or so item are in the collection, Scrolling becomes laggy and slow, and occasionally I receive memory warnings. I believe the problem to be in the thumbnail generation which happens...

Segue item info from CollectionView to ViewController

ios,objective-c,uicollectionview,segue
Good afternoon, I'm trying to make a Segue when the user touches an item from my CollectionView, but it's not working. First, I get the entries of the user from a database (and they are the full URL of the images) and then I display it in the Collection View....

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...

ios 8 swift double paging like facebook paper app

ios,facebook,swift,uicollectionview
I'm working on a iOS app and I would like to build something like I saw on the Facebook Paper. Here attached some design of what I want to achieve. Basically, in the upper half of the screen I have a paging. In the lower half, I would like to...

How to exclude header from reloading when using reloadData in UICollectionView

ios,header,uicollectionview,uicollectionviewlayout,uicollectionreusableview
I have an UICollectionView using CSStickyHeaderFlowLayout to mimic header behavior in UITableView. Inside the header there is SegmentedControl to control data on the UICollectionView. So what I want is to reload the data when I tap the segment (calling API) and perform the reloadData but it always called the -...

UICollectionView isn't scrolling to indexPath

ios,objective-c,uiscrollview,uicollectionview
I have a UICollectionView that I set the translatesAutoresizingMaskIntoConstraints to NO, and added some constraints. When I try scrolling it to an indexPath: [self.datesCollectionView selectItemAtIndexPath:selectedCellIndexPath animated:YES scrollPosition:UICollectionViewScrollPositionCenteredHorizontally]; Then it completely ignores that, and doesn't scroll. But when I remove translatesAutoresizingMaskIntoConstraints, then it scrolls, but the constraints are ignored. My question...

How to get cell atIndex in UICollectionView with swift?

ios,swift,uicollectionview
I am making Collection view programatically. Here is the code in viewDidLoad func let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout() layout.sectionInset = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20) layout.itemSize = CGSize(width: 90, height: 120) collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout) collectionView!.dataSource = self collectionView!.delegate = self collectionView!.registerClass(CollectionViewCell.self, forCellWithReuseIdentifier: "CollectionViewCell")...

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]...

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.

Best approach to implement this design [ios]

ios,uitableview,design,grid,uicollectionview
What would be the best approach to implementing a design like the one below? Couple of things: Level cell can fall between any 4 cells on the grid Whole board is scrollable I'm leaning toward UICollectionView but I'm not exactly sure how to do the "level cell." One of the...

IOS Scrollable View inside another ScrollView

uitableview,swift,autolayout,uicollectionview,ios8.3
I need to implement this screen and I wonder if anyone can help me with ideas to solve some scenarios, basically the screen will contain a parallax effect in the top image, the entire screen must be scrollable, the problem I am faced when designing this screen It is the...

UICollectionView cells with Images inside UITableView prototype

ios,iphone,uitableview,swift,uicollectionview
UPDATE: I solved my primary issue of correct images not loading until scrolling on the collectionView. I added a collectionView.reloadData() to the tableView:cellForRowAtIndexPath. I also made some changes to pre-load the sequence array, instead of building it while scrolling through the table (tableView:cellForRowAtIndexPath). Added the updates to GitHub if you...

prepareForSegue UICollectionView not working (swift)

ios,swift,xcode6,uicollectionview,segue
I’ve tried to push segue by using UICollectionView (show image form MasterView to DeatilView) but is not working. Xcode also doesn’t show any error message. What’s wrong with my code. I need some advice. override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "showDetail" { if let indexPath =...

Swipe up to show button in UITableView?

ios,swift,uitableview,ios8,uicollectionview
I'd like to place a button at the top of a UITableView or UICollectionView, but only shown when swiped up beyond the first row. Usually you see scroll to refresh or a search bar there, but I'd like to put a button there for another functionality. How can I do...

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...

Proper way to highlight uicollectionviewcell

ios,swift,uicollectionview
I have a uicollectionview, with subclassed uicollectionviewcells. I want to change the color of the cell when touched, then return to the default when the touch is released. Also, if I could animate this color change it would be optimal. I have tried implementing the didHighlightItemAtIndexPath method and changing the...

UICollectionView header view auto layout messed up after rotation

ios,objective-c,autolayout,uicollectionview,uicollectionviewlayout
I have a simple UICollectionView using UICollectionViewFlowLayout. It also has a section supplementary view of kind UICollectionElementKindSectionHeader. When the section header is visible on screen and device is rotated, the constraints adjusts the sub-views of the header correctly. If I scroll away such that the section header is not visible...

How can I make both of these UICollectionViews appear in the same View?

ios,swift,uicollectionview
I have two UICollectionViews that I need in one View. They have two different CollectionViewCell classes. The first CollectionView cell class is ConfirmOffersCollectionViewCell and the second is ConfirmRequestsCollectionViewCell. I am able to have both CollectionViews appear and function if I set both cells to the same class, but they display...

Preventing crash in UICollectionView

ios,uikit,uicollectionview
Our app has UICollectionView and its dataSource dictionary is regularly updated. We never know when next update will happen. Collection View reload method could be called after user taps a button or it could happen asynchronous after network request success. Given above information we have the risk to have a...

adding UIKit Dynamics to a custom UICollectionViewFlowLayout. dynamicAnimator seems to use default layout

ios,uicollectionview,uicollectionviewlayout,uikit-dynamics
I am trying to add UIDynamics to a custom UICollectionViewFlowLayout I want the dynamicAnimator to animate every cell when scrolling. They should behave in a more realistic manner and just like the iMessage bubbles do. They seem to react to the physical forces applied to them while scrolling. I want...

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)....

Add segue to dynamically created cells

ios,uitableview,swift,uicollectionview,segue
I am dynamically creating 9 cells that will fit into a UICollectionView. When tapped, each button will load a different view controller. As the cells are generated by data from an array, so I do not have the ability to set a segue with an identifier in Interface Builder. 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...

Label in collection view cell won't show up

ios,objective-c,uicollectionview
I'm trying yo have a label and image show up in collection view cells, but only the image will here's my code The header File #import <UIKit/UIKit.h> #import "ComicMetadata.h" @interface ComicCell : UICollectionViewCell @property (nonatomic, retain) UIImageView *page; @property (nonatomic, retain) UILabel *name; @end The Body #import "ComicCell.h" @implementation ComicCell...

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...

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...

Using UICollectionView with CoreData and NSFetchedResultsController

ios,swift,uicollectionview,nsfetchedresultscontrolle,uicollectionviewdelegate
I recently started another project exploring Swift a little bit. I want to implement a Collection View using a NSFetchedResultsController to get the data out of my CoreData database. I wanted to use the example from https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController and implement something similar in Swift. I don't need any of the move...

IndexPath for Selected Cell UICollectionView

ios8,uicollectionview,nsindexpath
I'm currently working on a UICollectionView showing various cells ... So far so good, but I have problems with the selection of the cell ... For example, I implemented the method of selection like this: - (Void)collectionView:(UICollectionView *) collectionView didSelectItemAtIndexPath:(NSIndexPath *) indexPath {      UICollectionViewCell theCell * = (UICollectionViewCell *)...

Add UIToolbar to UICollectionView header?

ios,swift,uicollectionview
In my storyboard I have added a UIToolBar to the Header of my CollectionView Like so: I have created the header by selecting the section header box: However, when I run this, the toolbar does not appear at all. I get the a warning entitled "Unsupported Configurations: Title set but...

passing info from collectionView to gameScene

uiviewcontroller,sprite-kit,uicollectionview
I have created a game using SpriteKit (GameScene and GameViewController) and Objective-C. Everything there works fine. Within the same App I have created a UIViewController and a second viewController in storyboard that uses CollectionView. I have the collectionView loading the array. I want to be able to tap on a...

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...

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...

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...

How to download infinite number of images from remote server and display the images in UICollection View/UITableView?

ios,objective-c,uitableview,memory-leaks,uicollectionview
I want to display the infinite images in UITableView/UICollectionview, here the images will be received from remote server, I've done this by using GCD but it causes Memory issues and app got crash.Please help to fix it. Also I noticed some images aren't deallocated. Here is piece of code I've...

Resize images automatically in CollectionViewCell in CollectionView with Auto Layout

ios,swift,autolayout,uicollectionview
I have a collectionView with horizontal UICollectionViewFlowLayout. I am trying to achieve: If a device orientation is portrait, UIImageView width will be qual to view.width and let the height be calculated automatically (like it usually happens with Auto Layout). And the same for the landscape mode. Example - standard photo...

didSelectItemAtIndexPath of UICollectionView inside of a UIScrollView is not getting called

objective-c,iphone,uiscrollview,uicollectionview
I've implemented non scrollable UICollectionView inside a UIscrollview. The size of the scrollview is 100x100 and that of collection view is 100x200; And the content size of the scroll view is 100x200. My problem is, the didSelectItemAtIndexPath is not getting called when I touch some cells (the cells out of...

How to add auto layout on UICollectionView programmatically?

ios,objective-c,autolayout,uicollectionview
I create a uicollectionview programmatically, and I want to add auto layout constraint on the collection view so that I can change the frame later. But the following code is not work. I am trying to initialize the collectionview like this: self.rootCollectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 100, self.bounds.size.width, self.bounds.size.height - 100)...

'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! }...

Keeping UITableView and UICollectionView scroll position in sync

ios,objective-c,iphone,uitableview,uicollectionview
I have a UIViewController that is able to show its content via a UICollectionView (cv) or via aUITableView (tv). Both views are added to the view hierarchy via storyboard and I'm just hiding the one that should not be shown. Both the UICollectionView and the UITableView have the same data...

UICollectionView cells overlapping swift

ios,swift,uikit,uicollectionview
I am creating a UICollectionView, but when a new cell is added to the view it is partially overlapping the previous cell. Below is my code: override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier("CustomCell", forIndexPath: indexPath) as! CustomCell cell.frame.size.width = self.view.frame.width / 3 cell.frame.size.height...

UICollectionView image flickering

swift,uicollectionview
I have a UICollectionView that shows cells at fullscreen (i.e. a gallery). Sometimes, when swiping for the new image, an image other than the right one is displayed for less than a second, than the image is updated. Other times, the wrong image is shown, but if you swipe left...

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...

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:...

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...

How to edit a UICollectionView item in another UIViewController?

ios,swift,uicollectionview,edit,master-detail
I'm using a Master Detail View Controller with Swift. When I click on a master cell, I see a collection view containing a list of pictures. Each picture represent data stored inside Core Data. Each picture data has also a timestamp and all picture taken the same day are stored...

What's the difference between a UIStackView And A UICollectionView in Xcode 7?

swift,user-interface,uicollectionview,ios9,uistackview
What's the difference between a UIHorizontalStackView and a Collection View(Also Vertical stackview)? Can't a collectionView be horizontal and vertical? Why would people use both? What does a UIStackView do that a Collection View can't?...

How do I change the background image of a UICollectionViewCell that has been tapped?

ios,swift,uicollectionview
I have multiple UICollectionViewCells. When the user taps on a specific cell, I would like my app to change the background image of the touched cell. My approach is to focus on the didSelectItemAtIndexPath method. When a cell is touched, this method will be called. func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath:...

How to display images that in photo gallery that were just selected?

ios,swift,uicollectionview,uiimagepickercontroller,elcimagepickercontroller
Goal: The user selects photos from her photo gallery > Tap "Done" > Photos show up. Problem: The photos don't show up immediately after "Done". They do show up if I open the picker again and tap "Cancel." This worked fine (photo showed up instantly) when I was using UIImagePickerController,...

UICollectionView design flow layout for attached image

ios,xcode,uicollectionview,uicollectionviewlayout
I attached images what I have done and what I have to achieve. Please guide me to achieve this. I have done till now: I want to achieve the following: Here is my code: - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGSize size; if (indexPath.row == DIGIT_INT_2 || indexPath.row...

CollectionView grid with images. Images don't fit in the grid

ios,objective-c,uicollectionview,uicollectionviewlayout
I'm trying to create a Grid layout that shows some pictures. Now I'm using a FlowLayout and I create my CollectionView like this: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; Gop *g = _images[(NSUInteger) indexPath.row]; @weakify(self); [[self.imageService fetchImageFromURLAsString:g.imageUrl] subscribeNext:^(UIImage *img) {...

UICollectionView received layout attributes for a cell in ios 7

ios,objective-c,ios7,uicollectionview
I'm using custom UICollectionView on my app. However, I have a problem that make my app crash. The log for the crash: Note: This bug doesn't occur on iOS 8 2015-05-29 11:49:26.316 app9to5[1834:607] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionView recieved layout attributes for a cell with an...

Load CKAssets into UICollectionView async

ios,uicollectionview,cloudkit,ckasset
Is there a way to load CKAsset photo into UICollectionView asynchronously ? At the moment, inside queryCompletionHandler from CKDatabase performQuery, I get list of CKRecords with CKAssets, and then set UICollectionView images to CKAsset.fileURL.path, which I then do [UICollectionView reload] The reload takes a long time because it seems like...

Draw gantt chart using UIcollectionviewcontroller?

ios,objective-c,uicollectionview
I have research in forum satackovzrflow and I have found(Using a UICollectionViewController and my own UICollectionViewLayout subclass, I've put together a view that shows a Gannt style time chart. Using that framework to do the bands has been really easy of Travis Griggs) So How can I draw gantt chart...

iOS Swift: Fatal error with unwrapping optional in UICollectionView

ios,swift,uicollectionview
I am trying to create a custom collection view. This is my first time using this view type and also my first time using Swift after a few years hiatus from iOS programming. Here is the code for the cell: override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {...

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 can I stop reuse cells from imitating style changes of other cells?

ios,swift,uicollectionview
I have a UICollectionView where the cells are given a blue border when tapped. The problem is that when I scroll down to more cells, some of the new cells imitate the blue border without ever having been tapped. Anybody know how to fix this? Code: func collectionView(collectionView: UICollectionView, numberOfItemsInSection...

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...

Hide/show sections in UICollectionView from code (swift)

swift,ios8,uicollectionview
I am new to iOS development and developing my first app for iOS 8, XCode 6.3, Swift 1.2. I have a small problem with hiding and showing sections in the UICollectionView. So I have a main ViewController.swift, SettingsViewController.swift. My task is to hide/show sections, one switch control for every section...

IOS - Sticky UICollectionView Header (like Apple App Store)

ios,uicollectionview,uicollectionviewlayout,uicollectionreusableview
I am trying to create a header like the one in the App Store. Where when the user drags down, the header stays in place and only the cells scroll down. But when the user drags up, both the header and cells scroll up. What I have done so far...

How can I highlight selected UICollectionView cells? (Swift)

ios,swift,uicollectionview
I have a UICollectionView, and the user is able to select multiple cells. It's a bit difficult to keep track of which cells have been selected, so I need some way to go about highlighting/creating a border when the cell is tapped. Code: func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) ->...

UICollectionView is not scrolling to position

ios,objective-c,uicollectionview
I have a UICollectionView in a static UITableView. I'm trying to make the collectionView scroll to an indexPath in viewDidLoad. It's not scrolling to position on startup, when I select an indexPath it scrolls to that position. I made a clean project that produces the problem. I thought the simplest...

iOS Collection View End Detection and refreshing

ios,uicollectionview
I have a collection view with image views inside, and every time when I come to the last cell I need to call the function to put more images in array with names of images. so how can I detect exactly last cell or the actual end of collection view?...

UICollectionView inside Static TableViewCell

ios,uitableview,swift,uicollectionview
I've seen many tutorials online pertaining to embedding UICollectionViews inside dynamic table view cells and subclassing the collection view to set the delegate but I was wondering if the process is any different for static table view cells. I tried following the example here but I couldn't quite follow it...

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...

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 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...

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...

How to hide scroll bar of UICollectionView

ios,swift,uicollectionview
i m working on an UICollectionView class, and it will display scroll bar when i scroll on the list, it's possible to hide scroll bar when scrolling?

UICollectionView not showing images from CameraImage - Objective C

objective-c,camera,uiimageview,uicollectionview
Searched the forum and could not find a suitable answer that works. I suspect something is wrong with the code. I am taking pictures with a camera and trying to show them in a UICollectionView. The collectionView has a cell with a UIImageView inside of it. Even when setting a...

Collection View automatically handles large amounts of records?

ios,swift,core-data,ios8,uicollectionview
I have a variable that holds a collection of records from Core Data. Sometimes it can be thousands of records. If I feed this variable into a collection view, does it automatically handle large amount? What I am hoping is that the collection is lazy loaded into the variable from...

iOS - Asynchronous requests and UI interactions

ios,swift,asynchronous,uicollectionview,alamofire
I have a page that uses Alamofire to retrieve images from Google Image Search API and display them inside a collectionView. Everything works, but when the request is still loading I can't interact at all with the UI, whether it's clicking a button or scrolling the collectionView. Is this normal...

configure UICollectionView cell on initial lookup

ios,objective-c,uicollectionview
I am getting cells for a UICollectionView by calling dequeueReusableCellWithReuseIdentifier:. I want to set some specific configuration information the first time my cell is returned from this method and not subsequently when it gets reused. Is there a hook somewhere where I can run "one time" code on collection view...

UICollectionViewController halts scrolling when inserting new cells

swift,uicollectionview,restkit,nsfetchedresultscontrolle
I have a UICollectionView that is endlessly scrolling. As the user scrolls, the controller makes API requests for new pages, usually loading the next page before the user gets to the bottom of her feed. However, when the UIViewController updates with new data via a fetchedResultsController, the scrolling stops, even...

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...

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); } ...

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...

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 -...

Swift | UICollectionView without storyboard shows incorrect data

ios,swift,uicollectionview
I am building an app that has a UICollectionView with three items. Each item takes up the complete width of the screen and shows a timer that counts down to the next departure times for our busses in each location. Each item contains 1) the departure address, 2) a string...

UICollectionView layout change when frame size changes

ios,swift,uicollectionview,uicollectionviewlayout
I'm working with a UICollectionView but I have a weird behaviour. I want a horizontal scroll, small cell height (more smaller than the UICollectionView height). Tapping a button will increase even more the height of the collection. The problem is that the layout of my cells is changing also. I...

UIView Animation not shown after segue

swift,uiview,uicollectionview,uilabel,uiviewanimation
I have 2 View Controllers. The first one is a Collection View Controller, the second a plain View Controller. When clicking a cell in the Collection View Controller, the second View Controller appears. When the view starts to load in the 2nd view controller, I want to show a UILabel...

Why my cellForItemAtIndexPath doesn't works but numberOfItemsInSection works better in swift?

ios,swift,uicollectionview
I am trying to make UICollection view programmatically, actually I already made 2 UICollection using storyboard successfully but the third I want to make it programmatically and it seems doesn't works well, I already did UICollectioanViewCell with the name TesCollectionViewCell. cellForItemAtIndexPath doesn't works but oddly the numberOfItemsInSection works better Here...

UICollectionView didSelectItemAtIndexPath effects multiple cells - swift

swift,uicollectionview
Swift, no storyboard, UICollectionView from xib file I am running very simple code to update cell's background color but, more then one cells are updating. override func viewDidLoad(){ super.viewDidLoad() // getting images from library images = PHAsset.fetchAssetsWithMediaType(.Image, options: nil) collectionView.allowsMultipleSelection = false var nipName2 = UINib(nibName: "CollectionViewCell", bundle:nil) collectionView.registerNib(nipName2,...

How to adjust UICollectionView contentSize.height based on number of rows in swift

ios,swift,uicollectionview
I'd really appreciate if someone can light up some ideas here. I've been trying to fix this for weeks now (not kidding). I have a "to do list" using a collectionView where I hide the rows that were completed and move them to the end of the list. I then...

iOS CollectionView Help (saving current state)

ios,uicollectionview
I am making an iOS app in Swift and I am running into a obstacle I seem to be stuck on. I have a collectionview populated by an string array, which are the names of the images I am populating the image within the collectionview cells: var tableData: [String] =...

Handle Touch in UiCollectionView - SWIFT?

ios,swift,touch,uicollectionview
i have this big UICollectionView occupying major part of screen and there is a UIButton that shows menu. i want to hide the menu when user taps on any side of the screen which becomes unfortunately any part of UICollectionView for me. Tried on other view the below code, it...

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...

UICollectionView is not displaying - bug?

ios,swift,uicollectionview,uicollectionviewlayout
I am a bit of a novice with swift. I am trying to simply create a collection view that is placed within a specific region of the screen (landscape iPad iOS). It is possible that there is actually a collectionView bug... The following code produces the attached image. The problem...

UICollectionView Custom Cell to fill width In Swift

ios,swift,uicollectionview,uicollectionviewlayout
I've been trying to figure-out how can i make the cell fill the width, as you can see in the picture the width between the cells is too big. i am using custom cell with only one imageView. I tried to customize it from the storyboard but i guess there...