Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CALayer does not seem to be defined

I wanted to add rounded Rects to a UITextView as explained in How to style UITextview to like Rounded Rect text field?. However when I do this I receive an error message that the methods used there are not found. I think this is weird as they are also still in the documentation. On the other side XCode does not show anything in autocomplete on the field layer. Is this field somehow deprecated or where could be the problem?

Here the two code snippets I was using:

@interface AddItemViewController : UIViewController {    
    IBOutlet UITextView *detailsTextView;
}
@end

Hier will ich dann die Eigenschaften aendern.

    - (void)viewDidLoad
{
    [super viewDidLoad];
    // add rounded rects to detailsTextView
    //first leads to warning that method is unknown
    [detailsTextView.layer setCornerRadius:8.0f];
    // displays error that property is not found on object of type CALayer *
    textView.layer.cornerRadius = 8.0f;
    detailsTextView.clipsToBounds = YES;
}
like image 825
gebirgsbärbel Avatar asked Dec 01 '22 02:12

gebirgsbärbel


1 Answers

Add the QuartzCore framework in your project

Include this in your .h file

#import <QuartzCore/QuartzCore.h>
like image 139
ipraba Avatar answered Dec 05 '22 09:12

ipraba