uicollectionviewcell

iOS how know which button is pressed CollectionView with custom delegate

荒凉一梦 提交于 2019-12-01 00:04:05
So I have a cells in a collectionview with 3 buttons in it. To trigger code with these buttons I have implemented a custom delegate. Now the code is being triggered, but I don't know from which cell the code triggered. How can I best implement this? Here is some of my code. Protocol: protocol OverViewDelegate { func registerButtonClicked() func evaluateButtonClicked() func overviewButtonClicked() } cellForItemAt: func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier

Adding a UIButton to a UICollectionView cell programmatically

我只是一个虾纸丫 提交于 2019-11-30 21:25:34
I have a UIViewController with a UICollectionView created inside it programmatically. I want to add a button to the cell: viewDidLoad: UICollectionViewLayout *layout = [[UICollectionViewFlowLayout alloc]init]; _collectionView = [[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:layout]; [_collectionView setDataSource:self]; [_collectionView setDelegate:self]; [_collectionView registerClass:[EMCell class] forCellWithReuseIdentifier:@"Cell"]; [self.view addSubview:_collectionView]; And then: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView

How to add custom view to JSQMessagesViewController cell so that it includes one view with some buttons and text view?

无人久伴 提交于 2019-11-30 19:02:53
问题 I am using https://github.com/jessesquires/JSQMessagesViewController/issues/1820 this library for chat application. By using this libary I am able to send images and video, but my app needs to send one view with some button and text. Like when user sends some text it will appear to others as text and button and then when somebody clicks the button one push notification will be generated. I am not able to figure it out how can I achieve this. Here is screen shot how I want my custom view to be

Static or Prototype UITableViewCell subviews are resized incorrectly in Storyboard on Xcode 6.1.1, iOS 8.1 SDK

和自甴很熟 提交于 2019-11-30 19:02:46
问题 So I updated to Xcode 6.1 earlier and 6.1.1 today . I notice that there's an issue while using Static / Prototype UITableViewCell (or Prototype UICollectionViewCell) in Storyboard. All the subviews with certain Autoresizing masks will be resized incorrectly when running on device / simulator. UISlider as a subView of the Static UITableViewCell Autoresizing rule is Flexible Width. Or Flexible LeftMargin also causes the problem. Observing the Slider is too long, went off the screen the the

iOS how know which button is pressed CollectionView with custom delegate

爷,独闯天下 提交于 2019-11-30 18:55:20
问题 So I have a cells in a collectionview with 3 buttons in it. To trigger code with these buttons I have implemented a custom delegate. Now the code is being triggered, but I don't know from which cell the code triggered. How can I best implement this? Here is some of my code. Protocol: protocol OverViewDelegate { func registerButtonClicked() func evaluateButtonClicked() func overviewButtonClicked() } cellForItemAt: func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath:

Adding a UIButton to a UICollectionView cell programmatically

走远了吗. 提交于 2019-11-30 17:16:01
问题 I have a UIViewController with a UICollectionView created inside it programmatically. I want to add a button to the cell: viewDidLoad: UICollectionViewLayout *layout = [[UICollectionViewFlowLayout alloc]init]; _collectionView = [[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:layout]; [_collectionView setDataSource:self]; [_collectionView setDelegate:self]; [_collectionView registerClass:[EMCell class] forCellWithReuseIdentifier:@"Cell"]; [self.view addSubview:

UICollectionViewCell change cell size while scrolling

岁酱吖の 提交于 2019-11-30 15:34:03
问题 I'm trying to create a UICollectionView where the UICollectionViewCell is getting scaled down when "leaving" the visible area at the top or bottom. And getting scaled up to normal size while "entering" the visible area. I've been trying some scale/animation code in: scrollViewDidScroll() , but I can't seem to get it right. My complete function looks like this: func scrollViewDidScroll(scrollView: UIScrollView) { var arr = colView.indexPathsForVisibleItems() for indexPath in arr{ var cell =

Deleting cell at edge of UICollectionView - cells not appearing immediately after scroll

假如想象 提交于 2019-11-30 15:27:00
问题 Consider an standard, vertically scrolling flow layout populated with enough cells to cause scrolling. When scrolled to the bottom, if you delete an item such that the content size of the collection view must shrink to accommodate the new number of items (i.e. delete the last item on the bottom row), the row of cells that scroll in from the top are hidden. At the end of the deletion animation, the top row appears without animation - it's a very unpleasant effect. In slow motion: It's really

UICollectionViewCell change cell size while scrolling

回眸只為那壹抹淺笑 提交于 2019-11-30 15:18:11
I'm trying to create a UICollectionView where the UICollectionViewCell is getting scaled down when "leaving" the visible area at the top or bottom. And getting scaled up to normal size while "entering" the visible area. I've been trying some scale/animation code in: scrollViewDidScroll() , but I can't seem to get it right. My complete function looks like this: func scrollViewDidScroll(scrollView: UIScrollView) { var arr = colView.indexPathsForVisibleItems() for indexPath in arr{ var cell = colView.cellForItemAtIndexPath(indexPath as! NSIndexPath)! var pos = colView.convertRect(cell.frame,

UICollectionViewCell using prototype sizes

穿精又带淫゛_ 提交于 2019-11-30 14:11:19
I have an UICollectionView with three different prototype cells, each of which with different heights set via Storyboard. During runtime, the Collection View uses its own cell size, ignoring my Storyboard ones. I am currently using collectionView:layout:sizeForItemAtIndexPath: with a couple conditionals to set each CGSize straight. Is there a better way to set the cell sizes? I don't seem to be able to retrieve the Storyboard size each cell has, and CGSizeMake seems too hardcoded and not really flexible. Markus Rautopuro It seems that there's currently no easy way to: Fetch