-setCornerRadius not found in custom view

て烟熏妆下的殇ゞ 提交于 2019-12-08 16:47:32

问题


I am making a custom uitableviewcell class and inside this cell I have a square label. I would like to round the corners of the label(dateBox) using this:

[dateBox.layer setCornerRadius:4.0f];
[dateBox.layer setMasksToBounds:YES];

I do this is other classes and it works fine, but for some reason in the uitableviewcell subclass, I get the warning "setCornerRadius method not found". Does anyone know why this might be?


回答1:


You need to import QuartzCore and make sure it is an included framework in your project.

#import <QuartzCore/QuartzCore.h>

or

#import <QuartzCore/CALayer.h>


来源:https://stackoverflow.com/questions/6443453/setcornerradius-not-found-in-custom-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!