uitableview

Detect when UITableViewCell did load

末鹿安然 提交于 2020-07-06 08:44:11
问题 I need to be able to detect when my custom UITableViewCell has been loaded on screen, so that I can programmatically do stuff to the view inside it. The only code I could get working was implementing layoutSubviews() inside the custom UITableViewCell , but this is bad practice because layoutSubviews() is called more than one time. Also, putting my code in awakeFromNib() doesn't work because I need to call a delegate property, which hasn't been set at that point. How can I achieve this? 回答1:

Unable to swipe to delete with tableview using diffable data source in iOS 13

旧时模样 提交于 2020-07-02 11:49:08
问题 I'm updating a UITableViewController to use the new UITableViewDiffableDataSource , I have everything working except Swipe to delete. This is an example of how I use swipe to delete func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { let lockedAction = UIContextualAction(style: .normal, title: "TEST") { (_, _, completion) in print("tapped....") completion(true) } return UISwipeActionsConfiguration(actions:

UICollectionView doesn't scroll inside UITableViewCell

北城余情 提交于 2020-06-29 06:19:51
问题 I'm having an issue with UICollectionView scrolling inside UITableViewCell. Unfortunately, the CollectionView doesn't scroll at all. When I'm trying to disable other UITableViewCells it works without any problem and vice versa. CollectionViewCell: import UIKit class CategoriesCollectionViewCell: UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) backgroundColor = .white layoutUI() } required init(coder adecoder: NSCoder) { fatalError("init(codeer:) has not been

Self Sizing CollectionView inside a Self Sizing TableViewCell

心不动则不痛 提交于 2020-06-29 04:44:16
问题 I have spent weeks trying to get this to work and have looked at many different suggestions on here, Apple developer forums, Google etc. and am still pulling my hair out. Any help would be greatly appreciated. I have a ViewController that contains a TableView. It is not a full-screen tableView. The tableView is built with customTableViewCells that each holds a CollectionView. The problem I have is that the self-sizing collectionView and the self-sizing tableView rows just don't seem to work.

Added Tableview data is not coming, why in swift?

怎甘沉沦 提交于 2020-06-28 04:14:31
问题 I am sending data to tableview from 3rd view controller to first view controller, now for the first time data is adding to tableview but if go from 1st view controller to other view controller and i come back to first view controller then the added data in table view is coming why? in 3rd view controller sending data to 1st view controller table view like below: var viewController: UIViewController? @IBAction func confirmBtn(_ sender: Any) { for controller in navigationController?

button inside column for each row in tableview

回眸只為那壹抹淺笑 提交于 2020-06-28 03:46:37
问题 In my TableView I have column with button for each row for update so I need when click the button to take all the values from the row to a new fxml window This is my contractor class: public class constractor { private String co_id; private String co_name; private String co_address; private String co_create_date; private String co_description; private String co_mobile; private String co_type_compile; private String co_status; private String co_type_model; private Button button; public

Combine UISwitch and UITableViewCell for VoiceOver interaction

丶灬走出姿态 提交于 2020-06-27 06:47:54
问题 In Calendar, when you create a new event, if you tap on the All Day cell with VoiceOver enabled, Siri says "All Day switch button on/off, double tap to change setting". And indeed double tapping will toggle the switch. Also, it's not possible to tap on just the toggle switch itself - you have to interact with the cell itself to toggle the switch, the switch itself is not an accessible element. In my app I have the exact same setup with a label and a switch. But when I tap the cell with

How to embed a UITableView in a custom view

左心房为你撑大大i 提交于 2020-06-26 07:19:18
问题 Goal I want to create a custom view that has a UITableView as a subview. The custom view creates the table view programmatically. To the outside world (i.e., the ViewController), though, the custom view itself would appear to be a table view. What I've tried import UIKit class CustomTableView: UIView { // Do I make outlets? //@IBOutlet var dataSource: UITableViewDataSource? //@IBOutlet var delegate: UITableViewDelegate? required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) }

UITableView scroll to bottom

随声附和 提交于 2020-06-25 09:32:25
问题 I have this line of code: tableView.contentOffset = CGPointMake(0.0f, 10000000.0f); The content size is a lot less than the 10000000.0f , but the UITableView still does not scroll to the bottom. How can I do it? 回答1: Scrolling to tableViewCell ? //for instance, you have 15 cells NSIndexPath *indexPath = [NSIndexPath indexPathForRow:14 inSection:0]; [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; 回答2: You can create an extension of

Wrong UITableViewCell height for some cells at first loading

↘锁芯ラ 提交于 2020-06-25 04:58:28
问题 I am using UITableViewAutomaticDimension to calculate height for my table view cell. It works fine for me. But for some cells, the height returned is 44 rather than dynamically calculating height. But on scrolling up an looking back to the same cell, the height is recalculated perfectly. So I guess I do not have any faulty constraints because, after I scroll and correct all cell heights manually, no constraint breaking warning are shown afterwards. Edit The below given is the screenshot of