Below is a snippet where I am getting the error:
-(IBAction)rateButtonClick:(id)sender{
NSMutableArray *starImage = [[NSMutableArray alloc]initWithObjects:starImage1, starImage2, starImage3, starImage4, starImage5, nil];
NSArray *halfRateButton = [[NSArray alloc]initWithObjects:halfRateButton1, halfRateButton2, halfRateButton3, halfRateButton4, halfRateButton5, nil];
int buttonClicked = (((UIButton *)sender).tag);
int i;
for (i = 0; i < buttonClicked; i++) {
**starImage[buttonClicked].image = [UIImage imageNamed:@"rate.png"];**
}
if (lastButtonClicked != buttonClicked) {
**starImage[buttonClicked].image = [UIImage imageNamed:@"star-half-full.png"];**
}else
**starImage[buttonClicked].image = [UIImage imageNamed:@"rate.png"];**
lastButtonClicked = buttonClicked;
for (i = 0; i <= buttonClicked; i++) {
**halfRateButton[i].hidden = YES;**
}
}
The error comes in the marked lines. Changing them as
**[starImage objectAtIndex:i].image = [UIImage imageNamed:@"rate.png"];**
doesn’t work out. I get an error:
image property not found on object of type (id).
Here, satrImage1 to starImage5 are UIImageViews. halfRateButton1 to halfRateButton5 are buttons.
I dont know exactly what u want, but I think below answer can help you to get rid of error.
Try this
or