CLDev
CLDev

Reputation: 1074

ios UIPopOverController tag property

Does UIPopOverController have a tag property?

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

Thanks.

Upvotes: 0

Views: 324

Answers (2)

nevan king
nevan king

Reputation: 113757

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.

Upvotes: 2

Ralph Caraveo
Ralph Caraveo

Reputation: 10225

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:

Upvotes: 0

Related Questions