Code copied from one file to another will not

I have code that sets a border around a UITextView. It is correctly built in one class; when I take this code and copy it to another class (changing the name of the object), it no longer builds, saying: "The borderWidth property" cannot be found in the object of the direct class CALayer * "(same message for two other lines of code). I did a clean, rebuilt and nothing helps. Why is this happening? And how to fix it?

- (void)viewDidLoad  {
[super viewDidLoad];

//--  draw box around notes field
orderNotes.layer.borderWidth = 1.0f;
orderNotes.layer.borderColor = [[UIColor blackColor] CGColor];
orderNotes.layer.cornerRadius = 4; 

}

The OrderNotes object is defined as a UITextView. There are no other errors.

+3
source share
1 answer

You need:

#import <QuartzCore/QuartzCore.h>

Otherwise, the property is layernot displayed to you.

+11
source

All Articles