Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3431038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:16:37+00:00 2026-05-18T07:16:37+00:00

We have common views that we use in our application in many locations inside

  • 0

We have common views that we use in our application in many locations inside of UINavigationControllers. Occasionally the UINavigationControllers are inside of popover views. Now the views we put into the nav controllers modify their navigation controller’s toolbar buttons and, in some cases, use custom buttons that we’ve created. We need to be able to figure out from the UIViewcontroller itself if the view is inside of a popoverview so we can display the correctly colored buttons.

We can easily get the Navigation controller reference from the UIViewController, using UIViewController.navigationController, but there doesn’t seem to be anything for finding a UIPopoverController.

Does anyone have any good ideas for how to do this?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:16:38+00:00Added an answer on May 18, 2026 at 7:16 am

    I was recently looking for a way to determine wether or not a view was being displayed in a popover. This is what I came up with:

        UIView *v=theViewInQuestion;        
        for (;v.superview != nil; v=v.superview) {
            if (!strcmp(object_getClassName(v), "UIPopoverView")) {
                NSLog(@"\n\n\nIM IN A POPOVER!\n\n\n\n");
            }
    

    Basically you climb the view’s superview tree looking to see if any of its superviews is a UIPopoverView. The one caveat here is that the class UIPopoverView is an undocumented private class. I’m relying on the fact that the class name won’t change in the future. YMMV.

    In your case:

    theViewInQuestion =  theViewControllerInQuestion.view;
    

    I’d be interested to see if anyone else comes up with a better solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have more than 10 files (Views) which many of them use common namespaces
I have a common comms library that i have written to communicate with our
It's common to have many pages in a website that request the same model
I have some common javascript functionality that I want to share across several views/pages.
I have a 2 views that I want to use before the create action.
Assume some domain and view objects (that have no common base class) public class
I am implementing view controllers that shall have different behaviour. They have a common
I have few common views in most of my viewControllers . What I noticed
I have common functionality that I need to access from all screens of my
We have several common libs. Ideally we want them all to use the latest

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.