uicollectionviewcell

UICollectionView inside an UITableViewCell

感情迁移 提交于 2021-02-19 07:04:00
问题 I've noticed iOS it's very mean when using UICollectionView inside an UITableViewCell . What I'm trying to achieve, it's to have a Collection of Images ( UICollectionView approach) inside a UITableViewCell . I'm trying to mimic Facebook post style, I think, they have an UITableView , with custom cells and so on, but here's the Problem... I've managed to put the UICollectionView inside an UITableViewCell , and It worked correctly and perfectly, no problem, everything showing fine, it's

UICollectionView Cell Shadow

孤者浪人 提交于 2021-02-17 19:47:10
问题 I am trying to add shadow to my custom UICollectionViewCell , This is the code I am using in my custom collection view cell class: self.layer.shadowOffset = CGSizeMake(1, 0); self.layer.shadowColor = [[UIColor blackColor] CGColor]; self.layer.shadowRadius = 5; self.layer.shadowOpacity = .25; This is giving shadow to the components of the collection view cell. 回答1: Don't forget to add these 2 lines self.clipsToBounds = false self.layer.masksToBounds = false 回答2: Swift 4.2 and xcode 10 here's

UICollectionView Cell Shadow

狂风中的少年 提交于 2021-02-17 19:45:08
问题 I am trying to add shadow to my custom UICollectionViewCell , This is the code I am using in my custom collection view cell class: self.layer.shadowOffset = CGSizeMake(1, 0); self.layer.shadowColor = [[UIColor blackColor] CGColor]; self.layer.shadowRadius = 5; self.layer.shadowOpacity = .25; This is giving shadow to the components of the collection view cell. 回答1: Don't forget to add these 2 lines self.clipsToBounds = false self.layer.masksToBounds = false 回答2: Swift 4.2 and xcode 10 here's

UICollectionView inside UITableViewCell how to set the selection to pass data from the current view to another one

情到浓时终转凉″ 提交于 2021-02-11 06:16:12
问题 I have a view controller with a tableview inside it , in the table view i implemented a collection view with horizontal scrolling, the data appears correctly but i want to go to another view controller when i click on the collection view cell passing a string to that view , how can i handle this process . thanks in advance 回答1: You have two choice 1) Implement Collection view delegate & datasource inside view controller. You can do this in tableview's cellForRowAt method like cell

Dynamic width size problem in UICollectionView Cell

回眸只為那壹抹淺笑 提交于 2021-02-10 17:27:35
问题 I dynamically set width of each cell of UICollectionView according to text inside it. The problem is that most of the time the width size is correct but sometimes cell size is not correct. These are strings i displayed in cell let tabs = ["1st tab", "Second Tab Second", "Third Tab", "4th Tab", "A"] func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let text = tabs[indexPath.row] let font

UIcollectionView cellForItemAtIndexPath returns Null in iOS 10 only. Works fine in iOS 9 and iOS 8

故事扮演 提交于 2021-02-07 09:21:06
问题 I have an app that been happily shipping for a couple of years. It retrieves RSS Feeds in a UICollectionView. The cellForItemAtIndexPath method sets text and calls a datasource method to load an image from a link specified in the feed. If none exists it loads the web page data and searches for <img> tags to get an image. Once the image is found/loaded the delegate method is called to add the image to the cell. (below) When running in iOS 8 and 9 everything is happy, but when running in iOS 10

UIcollectionView cellForItemAtIndexPath returns Null in iOS 10 only. Works fine in iOS 9 and iOS 8

本秂侑毒 提交于 2021-02-07 09:19:03
问题 I have an app that been happily shipping for a couple of years. It retrieves RSS Feeds in a UICollectionView. The cellForItemAtIndexPath method sets text and calls a datasource method to load an image from a link specified in the feed. If none exists it loads the web page data and searches for <img> tags to get an image. Once the image is found/loaded the delegate method is called to add the image to the cell. (below) When running in iOS 8 and 9 everything is happy, but when running in iOS 10

Horizontal scrolling collection view cells not resizing based on content width

前提是你 提交于 2021-01-29 15:41:10
问题 I have initialized the collection view like this: override init(frame: CGRect){ let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal layout.itemSize = UICollectionViewFlowLayoutAutomaticSize layout.estimatedItemSize = CGSize(width: 100, height: 30) countryCollectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout) viewTitleLabel = UILabel() super.init(frame: frame) setupTableView() sortedDummyData = dummyData.sorted(by: <) } And I return size

Swift -AVPlayer' KVO in cell's parent vc causing Xcode to freeze

耗尽温柔 提交于 2021-01-28 03:55:42
问题 I have a cell that takes up the entire screen so there is only 1 visible cell at a time. Inside the cell I have an AVPlayer. Inside the cell's parent vc I have a KVO observer that listens to the "timeControlStatus" . When the player stops playing I call a function stopVideo() inside the cell to stop the player and either show a replay button or a play button etc. 3 problems: 1- When the video stops/reaches end if I don't use DispatchQueue inside the KVO the app crashes when the cell's

Swift -AVPlayer' KVO in cell's parent vc causing Xcode to freeze

冷暖自知 提交于 2021-01-27 22:43:56
问题 I have a cell that takes up the entire screen so there is only 1 visible cell at a time. Inside the cell I have an AVPlayer. Inside the cell's parent vc I have a KVO observer that listens to the "timeControlStatus" . When the player stops playing I call a function stopVideo() inside the cell to stop the player and either show a replay button or a play button etc. 3 problems: 1- When the video stops/reaches end if I don't use DispatchQueue inside the KVO the app crashes when the cell's