[英]outer shadow effect to textfield in iOS
while i am trying to implement a round edge to textfield at login screen to my application when i gave shadow effect to it using Quartzcore framework, white rectangular edges comes to the front. 当我尝试使用Quartzcore框架给它的阴影效果时,在我的应用程序的登录屏幕上实现文本字段的圆角边缘时,白色矩形边缘位于最前面。
Ihave written below code in viewDidLoad in viewcontroller.m file :- 我已经在viewcontroller.m文件的viewDidLoad中编写了以下代码:
txt_PhoneNo.layer.cornerRadius = 14;
txt_PhoneNo.layer.borderColor = [[UIColor grayColor] CGColor];
[txt_PhoneNo.layer setBorderWidth:1.0];
txt_PhoneNo.layer.shadowColor = [UIColor grayColor].CGColor;
txt_PhoneNo.layer.shadowOffset = CGSizeMake(4.0f,4.0f);
txt_PhoneNo.layer.masksToBounds = NO;
txt_PhoneNo.layer.shadowRadius = 4.0f;
txt_PhoneNo.layer.shadowOpacity = 1.0;
How to remove these white edges from my textfield? 如何从我的文本字段中删除这些白色边缘? I am new to iOS development.Any help would be greatly appreciated.
我是iOS开发的新手,任何帮助将不胜感激。
You can achieve it in two ways:- 您可以通过两种方式实现它:
1) Inside your Interface builder ->Attribute Inspector-> Border Style->None:- 1)在“界面”构建器内->“属性检查器”->“边框样式”->“无”:-
2) If you want to do programmatically then follow @Rashad answer. 2)如果您要以编程方式进行操作,请按照@Rashad的回答进行操作。
Just set the border style before changing layers 只需在更改图层之前设置边框样式
[_txt_PhoneNo setBorderStyle:UITextBorderStyleNone];
This will work. 这将起作用。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.