uitableview

UITableView height equal to contentSize height

安稳与你 提交于 2021-01-29 14:08:07
问题 I have a scroll view and inside of if couple labels and a tableView. I would like for that tableView to be scrolled by a outer scrollView and not the tableView's scrollView, so what I did is to set constraint for tableView height to be equal to contentSize height. But I have this problem that it is sized correctly only when push animation is completed (and viewDidLayoutSubviews gets called, I guess) override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() tableHeightConstraint?

swift: button.isUserInteractionEnabled = false stops working when scrolling tableview

北战南征 提交于 2021-01-29 13:45:33
问题 I am using a tableview where the first cell contains two buttons. When the first button is activated, the second should be disabled (you should not be able to press it). It all works fine until I start scrolling down the tableview. If I scroll down as far as possible while still being able to see the buttons in first cell, and I activate the first button, I am still able to press the other one. Other things also stops working, but I guess that it is cause by the same thing. Do you have any

Issue with UITableViewCells Repeating Content

我是研究僧i 提交于 2021-01-29 11:00:52
问题 My app shows the user local bus departures however when Night Buses start to show the red 'N' shows in other services after scrolling as shown in the screenshots below, additionally the route numbers start to be wrong. The route numbers are correct the rest of the time when scrolling, it is only when the Night Buses appear This is the code I have executed for setting the route number case "N3", "N7", "N11","N16","N22","N25","N26","N30","N31","N34", "N37","N44","N98", "N106","N113","N124": var

Interacting with UITableView in a subview

谁说我不能喝 提交于 2021-01-29 10:51:32
问题 I embedded a tableView to the superview of a Custom UITextfield. The tableview is to display results on the view which means I want to be able to scroll and select a cell in the tableView. The tableview shows but I am unable to scroll or select the tableView cell. Here is how the tableView is rendered with the UITexfield. UITexfield extended override init(frame: CGRect) { super.init(frame: frame) shared() commonInit() if let superview = superview { setupAutocompleteTable(superview) } } public

Xcode: AccessoryType.checkmark pushes other views to the left

ぐ巨炮叔叔 提交于 2021-01-29 10:23:07
问题 Xcode 10, Swift 5, iOS 12 My app contains 3 ViewControllers : Login TableView Detailed info about data of single row in TableView If you edit and save the data in ViewController 3 and use the "back" button (through a NavigationController ) to go back to ViewController 2, a checkmark is added to the corresponding row in the TableView. The problem is that this checkmark pushes everything else to the left, even though I left some space for it: Setup: Horizontal StackView with 2 subviews with 1

Refresh pagination data in UITableView

点点圈 提交于 2021-01-29 08:46:48
问题 I have implemented pagination in UITableView with WillDisplay method. Pagination process is working fine but if I need to reload a list on button click, then data is appending in the list. How to work around with this ? func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { if (indexPath.row + 1 == playlistViewModel.numberOfRowsInSection()) { if playlistViewModel.isReload != false { pageIncrement += 1 playlistViewModel.playListingApi

Swift - display specific data for each tableview section

久未见 提交于 2021-01-29 08:33:45
问题 I'm working with CocktailDB. By creating a request I get a JSON file, parse it with Decodable protocol. From JSON I get all drinks' categories and display them as the sections of my tableview. In each tableview section I want to display drinks from specific category (section's header). One drink per section cell from the category (drink's strDrink (name) and strDrinkThumb (image)). I have a method that creates a request to get drinks from specific category - getDrinksFrom(category: String).

How to SORT Tableview rows according to Date Ascending order in swift

对着背影说爱祢 提交于 2021-01-29 07:09:57
问题 I have eventsTableView.. here all row are adding one by one no matter what the date is.. but here i need to display tableview according to its date orderedAscending and the total code is: class EventsViewController: UIViewController { var eventList : EventsModel? = nil @IBOutlet weak var eventsTableView: UITableView! override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) getAllEventsList() } func getAllEventsList() { //URLs and code.. do { let jsonObject = try

Change editing control image for UITableViewCell

纵饮孤独 提交于 2021-01-29 05:28:02
问题 Is it possible to change the editing control image for multiple row selection for UITableViewCell. If it is possible via any default function of UITableViewCell or we have to customize it on our own, if so could anyone give me any reference to do it. Thanks in advance. 回答1: The OP is actually wanting to change the editing control. That is the plus or minus that appears to the left of the cell when you change it to editing mode. You can't actually change the image, but what you can do is fake

Circular Image in UITableViewCell

空扰寡人 提交于 2021-01-29 05:18:17
问题 I'm trying to create circular Images inside of my TableViewCell but something is going wrong. I guess that the cornerRadius is to big because there is not any Image displayed with this Code. If I set the cornerRadius on 30 for example, I can see the Images rounded but not in a clear circle .Why is this not working ? override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCell(withIdentifier: "QuestionLine")