How to change background color with rounded UIbutton rectangle

How to change background color of UIbutton? I try this on IB, but it will not work. only changes it for a custom button.

I want to change the white color on a rounded rectangular button.

Or instead of making a custom button with rounded corners

thanks!

+4
source share
6 answers

It may be difficult for you to configure the default button. However, you can use any view using a special button.

Here's an article about creating rounded views: http://iphonedevelopment.blogspot.com/2008/11/creating-transparent-uiviews-rounded.html

You can also look at a program called "Opacity", which allows you to create many customizable standard iOS interfaces / buttons.

http://likethought.com/opacity/

+2
source

The color of a rounded rectangle can be changed to any color using the background color property in IB, as well as using coding, but cannot easily change its color to a transparent color. To do this, you better use a custom button with a rounded image or set a layer, as shown in the example, and do not forget to add the Quartz Core structure project to the project, as well as import it into your class.

UIBUtton *myBtn = [UIButton buttonWithType:UIbuttonTypeCustom]; myBtn.frame = frame; //your desired size myBtn.clipsToBounds = YES; myBtn.layer.cornerRadius = 5.0f; [self.view addSubView:myBtn]; 
+18
source
 UIButton *tagButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 

and look at this ... that I am doing the trick. I did it for myself.

+1
source

You can use a custom UIButton with custom images for backgroundimage for each state. Just make various states of your rounded button in Photoshop, for example.

0
source

You can use the "User" button, but for this use the image of the button with white rounded corners so it will look like a white round rectangle button

0
source

You should use UIButtonTypeCustom instead of others.

0
source

Source: https://habr.com/ru/post/1381502/


All Articles