So, I have a UITextField
subclass which is it\'s own Delegate
and is crashing when keyboard shortcuts are used. It maxes out on CPU
an
I encountered the same issue today when working with a self-delegating UITextField
subclass. If it is not possible to change the delegate to something other than self, I would recommend overriding respondsToSelector
rather than implementing a customOverlayContainer
method that may return an invalid object (are you sure it's supposed to be an instance of UITextField
? How do you know iOS isn't asking for a UIView
or a CGLayer
or any other type of object?)
-(BOOL) respondsToSelector:(SEL)aSelector {
NSString * selectorName = NSStringFromSelector(aSelector);
if ([selectorName isEqualToString:@"customOverlayContainer"]) {
NSLog(@"preventing self.delegate == self crash");
return NO;
}
return [super respondsToSelector:aSelector];
}