uitableview

Navigate from a ViewController to an another on didSelectRowAt programmatically

。_饼干妹妹 提交于 2020-12-15 07:07:24
问题 I have a UIViewController that contains a custom UITableView . The table has a custom UITableViewCell too. How to navigate from the first ViewController to an another when you select/click one of the rows? Note I have not used StoryBoard . Update This my code. Each one of the classes are external file. Let me know, if you need more code. class TestViewController: UIViewController, UITableViewDelegate { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white view

Stop repeating UIImage background pattern image - Swift

纵饮孤独 提交于 2020-12-13 04:52:06
问题 I'm using swipe to delete in UITableView. In swipe I need to add image. When I add image it repeats. How to stop repeating func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { let deleteButton = UITableViewRowAction(style: .default, title: "Delete") { (action, indexPath) in self.tableView.dataSource?.tableView!(self.tableView, commit: .delete, forRowAt: indexPath) return } deleteButton.backgroundColor = UIColor(patternImage:

Auto-sizing UITableViewCell which contains UICollectionView

南楼画角 提交于 2020-12-12 11:31:33
问题 I am having troubles with an autosizing UITableViewCell which contains a UICollectionView. The view hierarchy is roughly like this UITableViewCell -- Content View ---- Custom View ------ UIStackView (vertical) --------- UILabel --------- UICollectionView (vertical flow layout) When the UITableViewCell is created or reused, the collectionView receives a datasource which it then starts to process. I need all cells of the collectionView to show in the tableViewCell, so I observe changes to the

Auto-sizing UITableViewCell which contains UICollectionView

风流意气都作罢 提交于 2020-12-12 11:31:10
问题 I am having troubles with an autosizing UITableViewCell which contains a UICollectionView. The view hierarchy is roughly like this UITableViewCell -- Content View ---- Custom View ------ UIStackView (vertical) --------- UILabel --------- UICollectionView (vertical flow layout) When the UITableViewCell is created or reused, the collectionView receives a datasource which it then starts to process. I need all cells of the collectionView to show in the tableViewCell, so I observe changes to the

Get Switch State from specific cell

痞子三分冷 提交于 2020-12-06 16:55:49
问题 I am working on a iOS app that has two ViewControllers . The first is a TableView which creates a row for each index in a array. Each cell of this TableView shows the content in the array corresponding to the index and has a switch. The second ViewController has an image and a label and they are supposed to change depending the switch state. So, how can I get the switch state from a specific cell? import UIKit class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

Get Switch State from specific cell

霸气de小男生 提交于 2020-12-06 16:55:11
问题 I am working on a iOS app that has two ViewControllers . The first is a TableView which creates a row for each index in a array. Each cell of this TableView shows the content in the array corresponding to the index and has a switch. The second ViewController has an image and a label and they are supposed to change depending the switch state. So, how can I get the switch state from a specific cell? import UIKit class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

How to select multiple rows in UITableView in edit mode?

馋奶兔 提交于 2020-11-30 11:00:53
问题 I want to ask, how can I forward to edit mode, where I can to select multiple rows, as in Messages app, when you click on top right button "Select", when you can choose multiple messages by tapping on circles. Like this: I searched a lot, really, but couldn't find anything. Can anyone help me? Some advices 回答1: Set tableView.allowsMultipleSelectionDuringEditing = true Screenshot Demo code class TableviewController:UITableViewController{ override func viewDidLoad() { super.viewDidLoad()

How to select multiple rows in UITableView in edit mode?

最后都变了- 提交于 2020-11-30 10:59:07
问题 I want to ask, how can I forward to edit mode, where I can to select multiple rows, as in Messages app, when you click on top right button "Select", when you can choose multiple messages by tapping on circles. Like this: I searched a lot, really, but couldn't find anything. Can anyone help me? Some advices 回答1: Set tableView.allowsMultipleSelectionDuringEditing = true Screenshot Demo code class TableviewController:UITableViewController{ override func viewDidLoad() { super.viewDidLoad()

Swift Using a UISlider in a UITableViewCell the right way?

雨燕双飞 提交于 2020-11-29 03:55:30
问题 I am struggling to properly use UISliders in a UITableViewCell. Here is the Idea: The User can set different Jobs which he needs to fulfil tasks. The amount of different Jobs cannot be known in advance. Lets say for example User1 needs for his Band only Guitarists and Drummers, where someone else needs Guitarists, Drummers, Singers, Keyboarders and so on. What I want him to provide is that depending on which Jobs he needs, he can set the amount of people he needs for a specific job. I am

iOS: What is a difference between dequeueReusableCell(withIdentifier:for:) and dequeueReusableCell(withIdentifier:)?

霸气de小男生 提交于 2020-11-28 08:12:25
问题 According to the official documentation, there are two ways to get a reusable cell from a queue of a tableView. One is dequeueReusableCell(withIdentifier:for:) and another is dequeueReusableCell(withIdentifier:) . Assuming from the explanation of the document, I think the former is the method that returns the reusable cell and adds it to tableView . On the other hand, the latter is the method that just returns the reusable cell. Is this right? If it is right, I have another question. func