I'm having a strange problem. I created a class inheriting from UITableViewCell with a member UIView.
@interface MTReportPieChartTableViewCell : UITableViewCell {
UIView *_colorView;
}
@property (nonatomic, retain) IBOutlet UIView *colorView;
@end
In the implementation file, I want to access layer's properties of colorView, but xcode shows "no completion".
@implementation MTReportPieChartTableViewCell
@synthesize colorView = _colorView;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.colorView.layer.cornerRadius = 3.0f; // Error occurs in this line
}
return self;
}
@end
xcode says "Property 'cornerRadius' cannot be found in forward class object 'CALayer'". However, I can access cornerRadius in other class.
MTReportPieChartTableViewCell *cell = (MTReportPieChartTableViewCell *) [tableView dequeueReusableCellWithIdentifier:[MTReportPieChartTableViewCell identifier]];
cell.colorView.layer.cornerRadius = 3.0f; // This line works fine!
Why does this happen! I totally don't have any ideas where I did wrong in the code!
Have you imported <QuartzCore/QuartzCore.h>
in this class?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With