adrian
adrian

Reputation: 4594

error with UITableView

I have the following things:

in header file

 UITableView *catalogTable;
 UIScrollView *scrollView;

implementation file

 - (void)viewDidLoad
{
    [super viewDidLoad];
    catalogTable.backgroundColor = [UIColor clearColor];
    catalogTable.separatorColor = [UIColor colorWithRed:171/255.f green:171/255.f blue:171/255.f alpha:220/255.0];

    catalogTable.layer.cornerRadius=15;
    scrollView.layer.cornerRadius = 15;
    [scrollView setShowsVerticalScrollIndicator:NO];
    scrollView.layer.borderWidth = 2;
    scrollView.layer.borderColor = [UIColor colorWithRed:109/255.f 
                                                   green:114/255.f 
                                                    blue:114/255.f 
                                                   alpha:0.65/1.0].CGColor;
}

The problem is that I can't run this as I have error at these lines:

catalogTable.layer.cornerRadius=15;
scrollView.layer.cornerRadius = 15;

saying that:Property cornerRadius not found on object of type CALayer.

I don't know what to do with this...and can't figure out what I'm doing wrong. The strangest thing is that I copied the code from another class where it worked.I copied the whole thing and out of no where came this error.Anyone has any idea?

Upvotes: 2

Views: 430

Answers (2)

EXC_BAD_ACCESS
EXC_BAD_ACCESS

Reputation: 2707

As like @Vladimir said,add the following line

#import <QuartzCore/QuartzCore.h>

Upvotes: 2

Vladimir
Vladimir

Reputation: 170829

To eliminate that error you need to import <QuartzCore/QuartzCore.h> header in your file. Without that header compiler can't access information about CALayer class and the properties it has.

P.S. just in case - you'll also need to link with QuartzCore.framework to make things work

Upvotes: 7

Related Questions