I want to know how to center a UIImage on a UIButton. I am using the setImage UIButton method to place a UIImage ..
You can use the contentMode property:
button.imageView.contentMode = UIViewContentModeCenter;
Remove text from UIButton before setting content mode
Sometimes you may have misaligned content. Make sure they are in the center with:
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
Source: https://habr.com/ru/post/1347084/More articles:How to list all tables in MSSQL? - databaseSystem.Runtime.InteropServices.COMException (0x88980406) - wpfOEM machine workflow in VS 2010 - c #https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1347082/is-the-volatile-the-correct-way-to-inform-the-compiler-about-concurrent-access-to-a-variable&usg=ALkJrhiUFtRmmQhRH_jKuM43v2kOhN04vgC ++ COM: common errors - c ++Different database connections in rails based on user parameters - databaseHow do two related constructors of type w60> type refer to each other as type parameters? - genericsupload large file in php - phpCodeRush - create a SELECT CASE structure - coderushInstalling textColor from a theme does not work only on HTC Desire HD - androidAll Articles