uicollectionview

collectionView:cellForItemAtIndexPath: never gets called

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 11:02:04
问题 I have a UICollectionView and I simply want it to show up. I have the delegate and datasource attached to the file's owner in the interface builder. collectionView:numberOfItemsInSection: Gets called just fine. I have been messing with this for a few hours and just can't figure it out... Any help would be great, Thanks in advance! Here is the full source. Sorry if its kinda messy. .h File #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import "PinAnnotation.h" #import "Jot.h" @interface

UICollectionViewCell not calling updateConstraints automatically when dequeued?

♀尐吖头ヾ 提交于 2019-12-23 09:33:30
问题 I have a UICollectionViewCell subclass. I wrote an updateConstraints method as I've done a hundred times before. For some reason that is never called when the cell is dequeued. I had to add a manual call to [cell setNeedsUpdateConstraints] after dequeueing it. Any idea what could be going on here? 回答1: Implement this method and return YES. This could probably help. + (BOOL)requiresConstraintBasedLayout For details: https://stackoverflow.com/a/23616469/1300262 来源: https://stackoverflow.com

How to stack UICollectionView sections

泄露秘密 提交于 2019-12-23 08:29:28
问题 I originally tried doing this with two UICollectionViews stacked on top of each other. However getting it to scale right was nightmare with Auto-layout (I'm a novice iOS developer so that is more a critique of my skill than Auto-layou t). I'd like to stack two sections of UICollectionView cells on top of each other like this: +----------------------+ |+-Section 0---------->| | +-------+ +-------+ | | | | | | | | | | | | | | |Cell 0 | |Cell 1 |+-> | | | | | | | | | | | | | +-------+ +-------+

How to stack UICollectionView sections

£可爱£侵袭症+ 提交于 2019-12-23 08:29:08
问题 I originally tried doing this with two UICollectionViews stacked on top of each other. However getting it to scale right was nightmare with Auto-layout (I'm a novice iOS developer so that is more a critique of my skill than Auto-layou t). I'd like to stack two sections of UICollectionView cells on top of each other like this: +----------------------+ |+-Section 0---------->| | +-------+ +-------+ | | | | | | | | | | | | | | |Cell 0 | |Cell 1 |+-> | | | | | | | | | | | | | +-------+ +-------+

Check whether cell at indexPath is visible on screen UICollectionView

与世无争的帅哥 提交于 2019-12-23 07:27:37
问题 I have a CollectionView which displays images to the user. I download these in the background, and when the download is complete I call the following func to update the collectionViewCell and display the image. func handlePhotoDownloadCompletion(notification : NSNotification) { let userInfo:Dictionary<String,String!> = notification.userInfo as! Dictionary<String,String!> let id = userInfo["id"] let index = users_cities.indexOf({$0.id == id}) if index != nil { let indexPath = NSIndexPath

PAC Fetch failed with error [NSURLErrorDomain:-1003]

こ雲淡風輕ζ 提交于 2019-12-23 07:26:43
问题 I see this error in my logs and I don't know what it means: PAC Fetch failed with error [NSURLErrorDomain:-1003] 2017-06-08 17:07:56.157874+0200 xxxxxx[27059:7093559] [] nw_proxy_resolver_create_parsed_array PAC evaluation error: NSURLErrorDomain: -1003 At the same time I have a problem with a collectionView in my app. Don't know if it's related to the error or not: Sometimes, and only if the app is used in one remote office of our Company, both with the simulator and a real device, a

Does the UITableView “beginUpdates” and UICollectionView “performBatchUpdates” have the same behavior?

混江龙づ霸主 提交于 2019-12-23 06:51:26
问题 I was browsing the documentations, when I started wondering if "beginUpdates" in a UITableView and "performBatchUpdates" in a UICollectionView have the same behavior. If so, is there a reason, that they're called differently, even though they're virtually the same thing? Thanks! 回答1: UITableView 's beginUpdates must be matched with a call to endUpdates . UICollectionView 's performBatchUpdates:completion method does not require you to call back to the collection view when you are doing with

Does the UITableView “beginUpdates” and UICollectionView “performBatchUpdates” have the same behavior?

别来无恙 提交于 2019-12-23 06:51:09
问题 I was browsing the documentations, when I started wondering if "beginUpdates" in a UITableView and "performBatchUpdates" in a UICollectionView have the same behavior. If so, is there a reason, that they're called differently, even though they're virtually the same thing? Thanks! 回答1: UITableView 's beginUpdates must be matched with a call to endUpdates . UICollectionView 's performBatchUpdates:completion method does not require you to call back to the collection view when you are doing with

UICollectionView selected cells issue

∥☆過路亽.° 提交于 2019-12-23 05:16:17
问题 I have UICollectionView, i am selected cell with didSelectItemAt and deselect with didDeselectItemAt but selected cells are replaced https://im4.ezgif.com/tmp/ezgif-4-2715e62591.gif func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let cell = collectionView.cellForItem(at: indexPath) // print(indexPath) let collectionActive: UIImageView = { let image=UIImageView(image: #imageLiteral(resourceName: "collectionActive")) image.contentMode =

How to show different view controller on did select of collectionv view cell

给你一囗甜甜゛ 提交于 2019-12-23 04:55:11
问题 I have 3 view controllers called firstvc , secondvc , thirdvc . And I have one collection view which will scroll horizontally. I have done that. And if I select any cell, it will print which index path it was. It's fine, no problem. So in my mainviewcontroller I have one collection view which will scroll horizontally. And there is one UIView called myview . Whenever I press any cell, I get its indexPath . I need to show my 3 view controllers as subviews of myview in my mainviewcontroller . My