0
@interface RecentPhotosViewController () <PhotoViewControllerDelegate>

- (void)viewDidLoad
{
    [super viewDidLoad];
    [[self.tabBarController.viewControllers objectAtIndex:1] setDelegate:self];
}

The RecentPhotosViewController is a tableviewcontroller which implements a delegate.

I want to set self(RecentPhotosViewController) as the delegate in vieDidLoad(), but when i tried to type:self.setDelegate it turned out self doesn't have this setDelegate method, then i tried this:[[self.tabBarController.viewControllers objectAtIndex:1] setDelegate:self];(this tableview is one of the viewcontrollers of the tabBarControllers.

Then i got an error:[RecentPhotosViewController setDelegate:]: unrecognized selector sent to instance 0xc939960. I don't know how to fix this.

dsfdf
  • 106
  • 2
  • 7

1 Answers1

0

Do this:

@interface RecentPhotosViewController

//etc.

@property (nonatomic, assign) id delegate;

@end

@implementation RecentPhotosViewController

// etc.

@synthesize delegate;

@end