0

Could someone please help me with the following code:

    - (IBAction)addCellButton: (UIBarButtonItem *)sender
{
    if(!self.imagePopover)
    {
        AlbumPicker *albumPicker = [self.storyboard instantiateViewControllerWithIdentifier:@"MultipleImagePicker"];
        self.imagePopover = [[UIPopoverController alloc] initWithContentViewController:albumPicker];
        albumPicker.delegate = self;
        NSLog(@"%@", albumPicker.delegate);
        [self.imagePopover presentPopoverFromBarButtonItem:sender
                                  permittedArrowDirections:UIPopoverArrowDirectionAny
                                                  animated:YES];
        self.imagePopover.delegate = self;
    }
}

The problem is is that when I check the delegate in my albumPicker.m by printing it, it is set to nil? Am I setting the delegate properly?

Daniel
  • 23,129
  • 12
  • 109
  • 154
Nate Mann
  • 695
  • 6
  • 17

1 Answers1

1

It seems that you have set delegate in the right way. I think if the delegate is working properly, it is probably due to the property of delegate .I vaguely remember that in Google(or Apple) coding guidelines, delegate's property should be set as assigned instead of retain.

In addition, your question seems to be somehow unclear to me. I think if you want to check if the delegate is working, you'd better set a delegate method and see if the method is called.

analysiser
  • 120
  • 11