uicollectionviewcell

UICollectionViewCell Protocol is not working correct

老子叫甜甜 提交于 2019-12-11 16:42:51
问题 I have a Protocol inside my CellClass which is detect the function 'editCommentInFeed'. I have create an 'editButton' inside my Cell and define the handler with 'editCommentField' which is calling per Delegate the function and over give the 2 Parameters. This 2 Parameters are important I need this Informations from the cell to detect in future actions which will be provided. For example I had tried to print something when the Button ist Pressed inside the Cell. But even this Statement is not

How to load image with SDWebImage correctly in UICollectionView in swift

放肆的年华 提交于 2019-12-11 16:39:32
问题 I'm facing the following problem, well I have a custom collection view, where I upload an image from the URL I get from a service, everything works fine at the moment but sometimes when scrolling or when I leave the screen and return, my collection view customized it is altered, it does not load correctly, I have seen several posts where they present the same problem in different cases, but trying to conclude that my problem is at the moment of using the SDWebImage library. I have seen that

Margins around cell like in Android GridLayout

陌路散爱 提交于 2019-12-11 16:31:22
问题 In Android it's easy to create a grid list with the next margins: I found this solution for iOS but it doesn't add margins between cell and parent view, only between cells let itemSpacing: CGFloat = 3 let itemsInOneLine: CGFloat = 2 flow.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) let width = UIScreen.main.bounds.size.width - itemSpacing * CGFloat(itemsInOneLine - 1) //collectionView.frame.width is the same as UIScreen.main.bounds.size.width here. flow.itemSize = CGSize

How to update UICollectionViewCell's UILabel every second (swift)

允我心安 提交于 2019-12-11 16:23:59
问题 I have a UICollectionViewCell with a UILabel showing the day difference between two dates. I want to update it every second. I have tried using NSTimer to reload the data of the UICollectionview , but it makes the UI very slow. How do I go about achieving this? Thanks. 回答1: You do not reload the whole CollectionView or even the individual cells just to update the label. You have 2 options: Write a NSTimer in the ViewController and just refresh the content of the visible cells. Schedule a

UICollectionView shouldShowMenuForItemAt Not Called

青春壹個敷衍的年華 提交于 2019-12-11 16:12:56
问题 I have a stock standard UICollectionView in a UIViewController that is its delegate. However the shouldShowMenuForItemAt func is not called for a long press. I have added a didSelectItemAt func which does get called on clicking a cell to make sure the delegate is indeed wired up correctly. I also implemented the canPerformAction to return true and performAction in the delegate along with the canPerformAction and canBecomeFirstResponder to return true in my UICollectionViewCell subclass. None

How to access a collectionView that is embedded in a parent collectionViewCell in the main UIViewController?

久未见 提交于 2019-12-11 15:49:32
问题 How to access a collectionView that is embedded in a parent collectionViewCell in the main UIViewController? My main ViewController is a UICollectionView which houses a UICollectionViewCell called BannerCell. BannerCell has a collectionView which contains 3 cells: Headlines cell Image cell Posts Cell Within PostsCell, there is a collectionView of cells which contains posts. I want to access the collection view within the postCell, but I can't seem to get the reference of this collectionView

UICollectionView Vertical Paging With Code In Objective-C

一世执手 提交于 2019-12-11 15:26:39
问题 I have a ViewController mycollectionview and create a UICollectionView collection view in it and set size to the frame size. I have a Custom UICollectionViewCell CollectionViewCell class. Images sizes are different and I want to just show a one cell and full fitted to screen at the same time (when not scrolling). Here is mycollectionview code : - (void)viewDidLoad { [super viewDidLoad]; imgnum = @[@"1.jpg",@"2.jpg",@"3.jpeg",@"4.jpg"]; UICollectionViewFlowLayout *layout =

CollectionView Cell dynamic height for all screensizes

狂风中的少年 提交于 2019-12-11 15:19:38
问题 In my project, my collectionview cell comprises of the entire screen width and height, i've set it to horizontal scrolling and for making it dynamic for all screensizes, i am using this method func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let height: CGFloat = view.frame.size.height let width: CGFloat = view.frame.size.width return CGSize(width: collectionView.bounds.size.width,

How to tell if I am using the same item to populate more than one UICollectionViewCell?

◇◆丶佛笑我妖孽 提交于 2019-12-11 15:16:24
问题 I am developing a music app whereby users can browse from a selection of tracks and save them into a playlist. I am having an issue where if a track is saved into a playlist twice, once after the other, the play controls do not act as desired i.e. 2x track1 is added at the beginning of the playlist - if selecting 1st track1 - plays and pauses just fine, then if I select 2nd track1 (if 1st track1 has already been selected, or vice versa) it carries on playing/pausing as if it were the the 1st

ios - Swift - dequeueReusableCellWithReuseIdentifier, Cells of collectionViewController (in UIView) won't load after scrolling

只愿长相守 提交于 2019-12-11 15:06:42
问题 I have a ViewController with 3 views : Header (UIView) TabBar (UIView) UIView3 (UIView) In my UIView3 I have a collectionViewController. A key element is that I put my collectionViewController.scrollEnable = False because otherwhise, when I'm scrolling, only the UIView3 is scrolling and I want my entier screen to scroll (so that if we scroll enough my Header and Tabbar are hidden. So this is what I have : And this is how my screen looks like : Which is perfect. But , when I'm scrolling down,