How to make UITextField and Round Rect Button transparent?
I have a view with a button and three开发者_JS百科 UITextFields. The view's background is an image. I want UITextField's and Round Rect Button's backgrounds to be transparent, so the have their functions and display text, but there are no backgrounds. Adding a transparent image as a background doesn't help.
Thanks in advance!
As pheelicks said for UIButton
can create it with type UIButtonTypeCustom
.
For UITextField
set its border style to UITextBorderStyleNone
.
For the button you need to change the button type to:
button.buttonType = UIButtonTypeCustom;
See this question
As for the textfields, I don't think you can make them transparent. One solution would be to set the background image of each textfields to the image that would be showing through if the textfields were transparent. If you get it pixel perfect then it'll look as if the textfields are transparent
[[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(0, 0, 100, 100)];
精彩评论