user1452248
user1452248

Reputation: 767

Missing expected Identifier warning message

Getting red warning message that expected identifier for this statement

CALayer = ImageView.layer;

Using the above statement in the below code

// load all the frames of our animation
ImageView.animationImages = [NSArray arrayWithObjects:    
                             [UIImage imageNamed:@"2a.png"],
                             [UIImage imageNamed:@"2b.png"],
                             [UIImage imageNamed:@"2c.png"],
                             nil];

// all frames will execute in 28 seconds
ImageView.animationDuration = 28;
// start animating
[ImageView startAnimating];
[CALayer = [ImageView.layer]];
ImageView.layer.borderWidth = 2;
ImageView.layer.borderColor = [[UIColor whiteColor]CGColor];   
[ImageView.layer setMasksToBounds:YES];
[ImageView.layer setCornerRadius:15.0f];
[self.view addSubview:ImageView]; 

What i m missing here. Any ideas will be appreciated.

Thanks.

Upvotes: 0

Views: 134

Answers (2)

Andrew Hagner
Andrew Hagner

Reputation: 804

[CALayer = [ImageView.layer]]; 

Should be something like:

CALayer *myLayer = ImageView.layer;

Because you can't just assign to the class itself, you need an object of that class. Also you don't need the brackets for assignment.

Upvotes: 1

Phillip Mills
Phillip Mills

Reputation: 31016

1) It's an assignment, so the square brackets around it are wrong.

2) CALayer isn't a variable so you can't assign to it anyway.

3) The property reference ImageView.layer doesn't need square brackets either.

Upvotes: 1

Related Questions