开发者

CALayer does not seem to be defined

开发者 https://www.devze.com 2023-03-18 18:24 出处:网络
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 ar

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;
}


Add the QuartzCore framework in your project

Include this in your .h file

#import <QuartzCore/QuartzCore.h>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号