查看每个事件所触发响应的方法、delegate等信息

来源:互联网 发布:淘宝卖虚拟产品 编辑:程序博客网 时间:2024/05/16 06:47

想要在类中查看每个事件以后所响应的方法,delegate等信息,就可以在方法中加入以下的方法

- (BOOL)respondsToSelector:(SEL)selector
{
    NSLog(@"%s respondsToSelector: %s", __FILE__, selector);
    return [super respondsToSelector:selector];
}

- (NSMethodSignature*)methodSignatureForSelector:(SEL)selector
{
    NSLog(@"%s methodSignatureForSelector: %s", __FILE__, selector);
    return [super methodSignatureForSelector:selector];
}

- (void)forwardInvocation:(NSInvocation*)invocation
{
    NSLog(@"%s forwardInvocation: %s", __FILE__, [invocation selector]);
    [super forwardInvocation:invocation];
}

原创粉丝点击