![]() ![]() With the following code you can disable selection for a single cell: lectionStyle = UITableViewCell.SelectionStyle. If you only want to disable the selection of some of the UITableViewCells in your UITableView you can define this for each cell in the tableView function with the cellForRowAt parameter. What I am stuck in is when user touches cell of tableview, then I want to show the background color of the cell other t. This will look like this: override func viewDidLoad() Disable selection for specific UITableViewCells You have to set the following code in for example the ViewDidLoad function of your ViewController: tableView.allowsSelection = false Under Separator you will see a drop down like as seen in the image below: If you click on the drop down, you will see the following: This will allow you to pick a color from the list provided, or select a custom color from the bottom of the list. ![]() To disable selection for all UITableViewCells in your UITableView. Now that we have selected the UITableView, we need to go to the Attribute Inspector. Disable selection for specific UITableViewCells.ĭisable selection for all UITableViewCells in the UITableView.Disable selection for all UITableViewCells in the UITableView.If you want to disable that you can do this in 2 ways: For now, when you select a row, that row will be highlighted in blue color. ![]() After you tap a row, it’ll show you a check mark. The second link updates the accessory view of the cell with a check mark. ![]() In other words, the cell gets colored when the user clicks on it. The first line retrieves the selected table cell by using the indexPath. Below is a one liner that will help you remove the cell highlighting.By default UITableViewCells in a UITableViewCell are selectable. This is one of those annoying default behaviours that iOS has. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |