Dan Hanly
Dan Hanly

Reputation: 7839

Protocol to View Controller doesn't fire any defined methods

I've created a protocol and matching delegate. The methods I've defined don't seem to fire, but throw up no errors.

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);
}

For some reason I'm not getting the NSLog. There are no errors or crashes, it simply does not fire.

Have I made any errors that could account for this behaviour?

Upvotes: 0

Views: 147

Answers (1)

Alex.BIG
Alex.BIG

Reputation: 422

Have you forgotten to set the ResourcesViewController Object to scrollViewDelegate property?

Upvotes: 4

Related Questions