I'm trying to create a custom view UITextField
that will render in Interface Builder.
I want to be able to adjust the border colour and width.
I understand that I need to implement IBINSPECTABLE
and IBDESIGNABLE
in order to make these changes and see them in my Storyboard.
My header file is as follows:
#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface BorderTextField : UITextField
@property (nonatomic) IBINSPECTABLE UIColor borderColor;
@end
which isn't working for the border colour. I know I'm doing something wrong I'm just not sure what.
why don't you try the Layer Property of UITextField
Try like below.
UITextField *txtField = // Initialize your txtField
txtField.layer.borderColor = [UIColor redColor].cgcolor;
txtField.layer.borderWidth = 2.0
Hope this solve your problem
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.