开发者

How to make UITextField and Round Rect Button transparent?

开发者 https://www.devze.com 2022-12-25 10:06 出处:网络
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 fun

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)];

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号