While working on a today widget I stumbled on a bug in iOS. Since I was using multiple rows I had changed my widget to be table view-based with multiple rows showing a label and a value. Oddly, this setup caused my table view cells to no longer highlight when being touched between the labels.
You can use a table view as base for a Today Widget. iOS will magically do some setup, like remove the background color and set the correct effect on the separators.
BUT: Some of this magic causes cells to no longer responds to taps outside of the areas which are covered by textLabel and detailTextLabel.
This is even more of a problem if you use the “Right Detail” cell because then a large space opens up between the labels which is not responsive. Also we are supposed to left-align the table view contents with the widget title, which causes a large unresponsive area in the left margin.
A workaround is to set a background color on the cells with an alpha of at least 0.01 – but you should be required to do that.
Steps to Reproduce
- Launch the Today Widget of the provided sample app in Simulator
- You see three rows.
- On the first row you see that the selection highlight shows if you tap inside the text label, but not if you tap outside left or right of it
- On the second row, which is a .Value1 style, the area in the middle does not react to touches
- On the third row I have added a 99% translucent background color as a workaround, this way you can tap anywhere and the selection highlight shows
All rows should highlight regardless of where you touch them
Without the workaround the cells only highlight if you tap in the areas covered by labels.
Categories: Bug Reports