I have a very simple STC VC that contains a single SCArrayOfStringsSection configured with all Allow XXX checkbox in IB unchecked. I am using the SCArrayOfStringsSection as a menu really and I am handling the selection by providing an implementation to self.tableViewModel.cellActions.didSelect. All works great with one exception, when each item is tapped, there is no selection to visually indicate that it is tapped. I tried all options I could think of, but I cannot get the items to show a selection. Any help would be greatly appreciated.

Cell in SCArrayOfStringsSection not showing selection
#1
Posted 08 March 2016 - 06:02 PM
#2
Posted 08 March 2016 - 06:39 PM
This did the trick for me (code from VC's viewDidLoad):
self.tableViewModel.cellActions.didSelect = { (cell, indexPath) in self.tableView.deselectRowAtIndexPath(indexPath, animated: false) } self.tableViewModel.sectionAtIndex(0).cellActions.willConfigure = { (cell, indexPath) in cell.selectionStyle = UITableViewCellSelectionStyle.Default }
I am not sure if willConfigure is the right place to set cell.selectionStyle, though.
Edited by RaduGrama, 08 March 2016 - 06:40 PM.
- Tarek likes this
#3
Posted 08 March 2016 - 07:55 PM
Hi Radu,
You can set the cell selection right from IB. Simply select the cell in your SCArrayOfStringsSection and set its style from the object navigator on the right.
Hope this helps.
#4
Posted 09 March 2016 - 09:20 PM
Hi Tarek,
That's what I tried initially and it didn't work. The "Selection" attribute in the "Table View Cell" section of the custom cell in the SCArrayOfStringsSection is set to default, but if I check the value in any action, it is changed to None somewhere and I cannot figure out where. I am assuming it is because I have unchecked "Allow Edit Detail View" for the SCArrayOfStringsController, but I'm not certain. For now the code above does the trick, although it feels a bit like a hack.
Thanks,
Radu
#5
Posted 10 March 2016 - 10:29 AM
Yes, you are correct. Unchecking "Allow Edit Detail View" will prevent the cells from being selected, since developers usually mark that when they simply need some static cells. Since that's not the case for you and all you need is a simple static menu, you could simply use a standard Apple section inside your STV table view and add your static cells there.
As for using cellActions.willConfigure, that's also perfectly fine and isn't a hack at all.
Also tagged with one or more of these keywords: cells
Sensible TableView Forum →
STV Cells →
Change Highlighted Color on Touch DownStarted by wizgod , 12 Mar 2017 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Model →
SCTableModel's boundObject's dealloc method not calledStarted by tommy@ageet , 12 May 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
Sensible Table View Controllers →
DetailViewController cells too narrowStarted by Dennis , 11 Dec 2015 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Cells →
Formatting numbers when using curly brace bindingStarted by Laeger , 25 Nov 2015 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Cells →
Two cell types in one tableStarted by mehdzor , 26 Oct 2015 ![]() |
|
![]()
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users