I have a uitextfield subclass and in the init method and setDelegate I have this:
- (void) setDelegate:(id<UITextFieldDelegate>)paramDelegate{
[super setDelegate:paramDelegate];
MRAAdvancedTextFieldDelegate *limitedDelegate = [[MRAAdvancedTextFieldDelegate alloc] init];
self.delegate = limitedDelegate;
}
I am using ARC, but this results in a BAD_ACCESS. Any ideas?
You write
self.delegate = limitedDelgatewithin yoursetDelegate:method. This is exactly the same as calling[self setDelegate:limiatedDelegate]. Since you are within the-setDelegate:method itself, you are causing infitine recursion. Hope this helps!EDIT: per your comment about your intention, override it like this:
But I don’t believe it’s a good idea to do this – you should have your client code pass in instances of your delegate instead.