简体   繁体   中英

Can I make UITextField invisible?

I checked out iPhone: How can I make a UITextField invisible but still clickable? , but the OP has something else going on and the answers didn't seem to help me out of my fix.

I have a UITextField in which the user has to enter text. Instead of the standard UITextField graphic, I want to use a lovely graphic that's been designed for that purpose. The user would still need to be able to enter text and see the text s/he's entering, but I need the textfield to be invisible so that the graphic can show from underneath it.

How can I do this? Or is there another way to do what I'm after?

Adding my comment as an answer. You can try this,

[textField setBackgroundColor:[UIColor clearColor]]; 

And then set the border style as UITextBorderStyleNone .

something like:

yourTextField.borderStyle = UITextBorderStyleNone;

should do it

Another solution would be hiding the UITextView itself and just adding a transparent button that will call the keyboard to display.

Otherwise, the other answers should work.

Easiest option is to do it in interface builder. Choose the first uitext field style with no border and that's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM