1

I've been trying (for weeks) to set uitextfield/view border color in xcode 6 but still not working. I already tried any solutions I found on stackoverflow and other forums too but still not working. I use Objective-C Any help? Thanks

StephenKing
  • 36,187
  • 11
  • 83
  • 112
rick261
  • 15
  • 3
  • 1
    Welcome to StackOverflow. Please include at least the state where you are with your code currently, show that you've really done something. – StephenKing Jan 27 '15 at 21:51
  • possible duplicate of [UITextField border color](http://stackoverflow.com/questions/1861527/uitextfield-border-color) – Rahul Jan 28 '15 at 12:57

2 Answers2

0

First You Need to import Core Graphics File in your implementation file:

#import <QuartzCore/QuartzCore.h>

then use this code to change color of border:

 txtPass.layer.borderColor=[[UIColor redColor]CGColor];
 txtPass.layer.borderWidth= 1.0f;

If You want to give border then use

 txtPass.layer.cornerRadius=8.0f;
 txtPass.layer.masksToBounds=YES;
Rahul
  • 5,594
  • 7
  • 38
  • 92
  • it's still not working, and I checked but there is no duplicate of UITextField border color. My code is the same as that, I didn't forget to import: #import – rick261 Jan 28 '15 at 14:51
  • can you update your question and ahow your code what you have written as this code is working fine on my xcode – Rahul Jan 28 '15 at 16:19
  • it worked after i did smthing like this. _txtPass.layer.cornerRadius and stuff. Thanks a lot :) – rick261 Jan 28 '15 at 18:19
0

Here is how I made it! And thanks a lot guys
I made it

Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
rick261
  • 15
  • 3
  • please edit your answer to include the code inside the answer, with the proper format. – jungledev Oct 15 '15 at 14:50
  • Please **[edit]** your post and show the actual code as text instead of screenshots. Others can't copy and paste from your images. [See here](https://meta.stackoverflow.com/a/285557/1402846) for details. Thank you. – Pang Mar 31 '17 at 04:56