TimSim
TimSim

Reputation: 4036

How to set UITableViewCell accessory size?

I'm setting the accessory in code like

cell.accessoryType = .Checkmark

but I'd like it to be a bit larger on some devices. I'm already changing cell height in code, but the size of the checkbox stays the same.

Upvotes: 0

Views: 4748

Answers (1)

Ike10
Ike10

Reputation: 1595

You can subclass UITableViewCell and override layoutSubviews and in layoutSubviews adjust the accessory like so:

if self.accessoryView != nil {
   let accessory = self.accessoryView
   accessory.frame = CGRectMake(x, y, width, height)
}

Where x, y, width, and height can be anything you want really as long as they are CGFloats.

Upvotes: 9

Related Questions