SlackTextViewController icon indicating copy to clipboard operation
SlackTextViewController copied to clipboard

Support for setting the right button's image

Open Nick-The-Uncharted opened this issue 10 years ago • 3 comments

Now I can only set button's title to a bunch of spaces as placeholder, and set my image.

    rightButton.setTitle("                 ", forState: UIControlState.Normal)
    rightButton.setImage(UIImage(named: "first"), forState: UIControlState.Normal)

Nick-The-Uncharted avatar Sep 16 '15 10:09 Nick-The-Uncharted

look forward to this feature

neil-wu avatar Oct 27 '15 02:10 neil-wu

I'm not sure exactly what you're trying to do but if you want the right button to be a custom image with no title you can set the title to nil. For example:

textInputbar.rightButton.setTitle(nil, forState: .Normal)
textInputbar.rightButton.setImage(UIImage(named: "sendButtonEnabled").imageWithRenderingMode(.AlwaysOriginal), forState: .Normal)
textInputbar.rightButton.setImage(UIImage(named: "sendButtonDisabled").imageWithRenderingMode(.AlwaysOriginal), forState: .Disabled)

soleares avatar Sep 22 '16 00:09 soleares

@soleares solution currently only works withs images and its intrinsic content size. Therefore the button is always the size of the image. Which is fine for non vector images.

But this solution is not satisfying for vector images because you cannot resize the buttons (or its image) size.

cornr avatar Nov 17 '17 09:11 cornr