0

Does UIPopOverController have a tag property?

I have multiple UIPopOverControllers, how do I distinguish between them from the delegate methods?

Thanks.

CLDev
  • 1,076
  • 3
  • 12
  • 20

2 Answers2

2

No, tag properties are only on views and bar button items, not view controllers.

However all UIPopoverViewControllerDelegate methods get passed a popoverViewController variable. You can tell which one is calling the delegate method by comparing that variable to your popover controller objects.

- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
    if (popoverController == myFirstPopoverController) {
        // do something
    }
}

Note that this is true for all delegate methods in iOS, UITableViewDelegate methods all receive a tableView variable and so on.

nevan king
  • 112,709
  • 45
  • 203
  • 241
0

According to the apple documentation there is no tag property. The tag property comes from being a subclass of UIView which UIPopoverController is not. In fact, UIPopoverController inherits directly from NSObject.

When your delegate callbacks run they will pass in exact instance of whichever UIPopoverController invoked the callback.

You can observe this on the UIPopoverControllerDelegate documentation with the following two protocol methods:

– popoverControllerShouldDismissPopover:
– popoverControllerDidDismissPopover:
Ralph Caraveo
  • 10,025
  • 7
  • 40
  • 52