我创建了一个协议和匹配的委托。我定义的方法似乎没有触发,但没有抛出任何错误。
资源滚动视图.h
//Top of File
@protocol ResourceScrollViewDelegate
- (void)loadPDFWithItem:(NSString *)filePath;
@end
//Within Interface
id<ResourceScrollViewDelegate> _scrollViewDelegate;
//Outside Interface
@property (nonatomic, retain) id<ResourceScrollViewDelegate> scrollViewDelegate;
资源滚动视图.m
//Inside Implementation
@synthesize scrollViewDelegate=_scrollViewDelegate;
//Within a button tapped method
[_scrollViewDelegate loadPDFWithItem:filePath];
资源视图控制器.h
//Top of File
#import "ResourceScrollView.h"
@interface ResourcesViewController : UIViewController <ResourceScrollViewDelegate>
资源视图控制器.m
//Inside Implementation
- (void)loadPDFWithItem:(NSString *)filePath{
NSLog(@"PDF %@",filePath);
}
出于某种原因,我没有收到 NSLog。没有错误或崩溃,它根本不会触发。
我是否犯了任何可能导致这种行为的错误?