When I do this, the disclosure shows up fine. I'd personally do insertSubview(atIndex: 0)
rather than addSubview
and sendSubviewToBack
if I wanted to manually add the background image view in the view hierarchy manually. Or, I would just set the cell's backgroundView
(and selectedBackgroundView
). But all of these approaches have the disclosure indicator visible (assuming that the disclosure indicator was turned on) for me. I'd run the app and then use the view debugger and carefully examine the view hierarchy and confirm that the disclosure indicator is really there:
![enter image description here]()
You can then select the debug navigator in the left panel and choose the "View UI Hierarchy" from the button in the top right corner of the debug navigator:
![enter image description here]()
This way you can confirm that the disclosure button is really there, or whether the disclosure indicator is simply not visible (e.g. its color might be too close to your sand-colored background to stand out).
If the problem is that the color of the accessory view is too similar to the background color, you can change the accessory view (see https://stackoverflow.com/a/27971576/1271826). For some accessory types (namely the details or checkmarks), you can change the color simply by changing the tintColor
of the tableview. If you want to change the color of the disclosure indicator, you may have to replace the accessory view with a disclosure image that you created yourself, e.g.:
cell.accessoryView = UIImageView(image: accessoryImage)
You can either build this accessory image and add it as an asset to your project, or you can define an accessory image that you build dynamically. For example, here is a yellow disclosure accessory image:
lazy var accessoryImage: UIImage = {
let rect = CGRect(x: 0, y: 0, width: 10, height: 43.5)
let insetRect = CGRectInset(rect, 2, 15)
UIGraphicsBeginImageContextWithOptions(rect.size, false, 0)
UIColor(red: 1, green: 1, blue: 0, alpha: 1).setStroke()
let path = UIBezierPath()
path.moveToPoint(CGPoint(x: insetRect.origin.x, y: insetRect.origin.y))
path.addLineToPoint(CGPoint(x: insetRect.origin.x + insetRect.size.width, y: insetRect.size.height / 2.0 + insetRect.origin.y))
path.addLineToPoint(CGPoint(x: insetRect.origin.x, y: insetRect.size.height + insetRect.origin.y))
path.lineWidth = 2
path.stroke()
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}()
That yields:
![enter image description here]()