Catalin Cristian
Catalin Cristian

Reputation: 91

Swift: Set UITableViewRowAction button size

I have a short question: how can I programmatically set the UITableViewRowAction button size? Is there a specific native method or I have to make custom buttons for that? I have been struggling with this for many hours and search for an answer all over the internet.

Thanks!

Upvotes: 4

Views: 4567

Answers (2)

Maxim Firsoff
Maxim Firsoff

Reputation: 2296

For Width: You can add an empty string to:

UITableViewRowAction(style: .Destructive, title: "     ")

It can helps to setup width not exactly (non-pixels accuracy)

For Height: Set cell height in TableView.

Upvotes: 3

Chris Droukas
Chris Droukas

Reputation: 3196

Unfortunately, you can't. The button is the height of the containing cell and the width of the string, plus 15 points of padding on the left and right. The only customizable properties of UITableViewRowAction are

  1. backgroundColor
  2. style
  3. title

You can fake a wider button by adding whitespace characters to the title string.

UITableViewRowAction

Upvotes: 7

Related Questions