2012-04-23 6 views
0

私はプロトコルと一致するデリゲートを作成しました。 私が定義したメソッドは起動しないようですが、エラーは発生しません。View Controllerのプロトコルは定義されたメソッドを起動しません

ResourceScrollView.h

//Top of File 
@protocol ResourceScrollViewDelegate 
    - (void)loadPDFWithItem:(NSString *)filePath; 
@end 
//Within Interface 
id<ResourceScrollViewDelegate> _scrollViewDelegate; 
//Outside Interface 
@property (nonatomic, retain) id<ResourceScrollViewDelegate> scrollViewDelegate; 

ResourceScrollView.m

//Inside Implementation 
@synthesize scrollViewDelegate=_scrollViewDelegate; 
//Within a button tapped method 
[_scrollViewDelegate loadPDFWithItem:filePath]; 

ResourcesViewController.h

//Top of File 
#import "ResourceScrollView.h" 
@interface ResourcesViewController : UIViewController <ResourceScrollViewDelegate> 

ResourcesViewController.m

//Inside Implementation 
- (void)loadPDFWithItem:(NSString *)filePath{ 
    NSLog(@"PDF %@",filePath); 
} 

何らかの理由でNSLogが取得できません。 エラーやクラッシュはなく、単に起動しません。

この現象を説明できるエラーはありますか?

答えて

4

ResourcesViewControllerオブジェクトをscrollViewDelegateに設定するのを忘れましたか?

+0

どういう意味ですか?どうすればいい? –

+0

ああ、私はそれを持っている心配しないでください! '[resourceScrollView setScrollViewDelegate:self];' –

関連する問題