Sohan
Sohan

Reputation: 1287

UITextField customization

I need a UITextField to look like this as per the client's request

https://i.sstatic.net/mLh4Q.png

I've used a normal UITextField and even tried a cornerRadius to get it look the same but mine looks like this:

https://i.sstatic.net/ZVDrP.png

One noticeable difference between the two is that in the standard UITextField there is a slight blackish line that acts as a shadow at the top part of the horizontal border of the button. How do i get rid of that?

Thanks for your time and help!

Upvotes: 0

Views: 1402

Answers (3)

iGautam
iGautam

Reputation: 121

You can use textField borderStyle as UITextBorderStyleNoneand textField.backgroundColor = [UIColor clearColor].

and then use image what you want to put in the background. Keep in mind that UIImageView on which you are placing your image should be the lower view and UITextField should be your upper view.

Upvotes: 2

uadnal
uadnal

Reputation: 11445

I'm fairly certain you must use a background image.

Here is a related post. Custom UITextField

Upvotes: 1

Rocco
Rocco

Reputation: 91

hide the border completely and use a custom background image (containing your desired border)!

Upvotes: 1

Related Questions