I want to put a centered image and bottom centered text in a UIButton.
How can i do this?
Thanks in advance.
Ok, figure out how to do this. Using methods:
[button1 setTitleEdgeInsets:UIEdgeInsetsMake(30.0, 0.0, 0.0, 0.0)]; [button1 setImageEdgeInsets:UIEdgeInsetsMake(-10.0, 29.0, 0.0, 0.0)];
If you have any specific solution, with UIButton with the image and text below. I made an extended class from UIButton to simplify it:
https://gist.github.com/jalopezsuarez/2c8f430636d89a58099b
You only need to use the UIButtonBox in Interface Builder and it will automatically display the text below.
[btn setTitleEdgeInsets:UIEdgeInsetsMake(btn.frame.size.height - 20, 1, 1, 1)];
: , , ,
. , .
Source: https://habr.com/ru/post/1736898/More articles:excel function to get the value of another cell - excelUsing jQuery to parse RSS feeds having firefox and chrome issues - jqueryPyYAML parsed into an arbitrary object - pythonHow to put jpanel in a dialog box? - javac / c ++ how to convert short to char - c ++How can I prove whether lunch philosophers suffer from dead end or hungry opportunities? When to start? - multithreadingHow to create an installer for Visual Studio 2008 addin? - c #Imgur and VB.NET API Help - Image POST - api.htaccess rewrite ssl redirect URL - sslHow to convert from System.Int32 to System.UInt16 to F # - .netAll Articles