I have created a custom UIView, and attached a delegate to it – it all works beautifully!
However, 60 of these UIViews are created in an array, in a loop.
And when I try to attach the delegate to one of these beauties, I get this Analyze warning: Property ‘delegate’ not found on object of type ‘__strong id’
Hopefully this is some simple syntax issue?
This works great:
myUIView *aSimpleTest = [[myUIView alloc] init…];
aSimpleTest.delegate = self; //nice!
...
This doesn’t:
for (i=0; i<60; i++){
[arrayOfItems addObject:[[myUIView alloc] init…];
[arrayOfItems objectAtIndex:i].delegate = self;//error, as above
...
}
Would appreciate some help. (Hopefully I don’t have to spend another day learning something new!)
Try this:
EDIT:
You get the error because
[arrayOfItems objectAtIndex:i]returnsidthat doesn’t havedelegateproperty. You also could do the following:or: