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

  • SEARCH
  • Home
  • 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 8613487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:53:21+00:00 2026-06-12T04:53:21+00:00

As I understand from reading documentation, UIPopoverControllers are only supported on the iPad. Therefore

  • 0

As I understand from reading documentation, UIPopoverControllers are only supported on the iPad. Therefore if you try to declare a variable as a UIPopoverController and run the app in the iPhone simulator or on an iPhone, you get an error such as:

UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad

So I have a universal monotouch app I am trying out, where I would like to use a UIPopoverController when the user is using an iPad, for the iPhone I have another solution.

This is how I am declaring it at the moment, but obviously running on the iPhone does not work, and I get the above error message.

public partial class IOPSCalculatorViewController : UIViewController
{

    static bool UserInterfaceIdiomIsPhone {
        get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
    }

    static bool UserInterfaceIdiomIsIPAD {
        get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad; }
    }

    UIPopoverController DetailViewPopover = new UIPopoverController(new PopoverContentViewController());
}

How can I only declare the:

UIPopoverController DetailViewPopover = new UIPopoverController(new PopoverContentViewController());

part if the device is an iPad? I need the UIPopoverController to be in the public partial class so that I can access it publically in other places.

  • 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-06-12T04:53:22+00:00Added an answer on June 12, 2026 at 4:53 am

    Instead of declaring and allocating in one line just split it in two lines. E.g.

    UIPopoverController DetailViewPopover = null;
    
    if (IOPSCalculatorViewController.UserInterfaceIdiomIsIPAD) {
        DetailViewPopover = new UIPopoverController (new PopoverContentViewController ());
    }
    

    That will also work if DetailViewPopover is a (public) field instead of an instance variable and, as long as the UIPopoverController constructor is not invoked, you won’t be getting the error.

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

Sidebar

Related Questions

From my reading of some android forensic articles i understand that sqlite records can
As far as I understand from the documentation the QUdpSocket are async but, still,
I try to understand the ICommand from wpf. In my Event class I implement
I try to understand this example from jquery api in this snippet var tags
I'm reading through the D3.js documentation, and am finding it hard to understand the
I'm reading the following about UIScrollView from Apple UIScrollView Class Reference Documentation: Because a
I was reading the documentation of std::sub_match<BidirectionalIterator> and saw that it publicly inherits from
I'm trying to learn from reading Mozilla documentation for regular expressions, but there's one
I was reading this paper from Apple: http://developer.apple.com/library/mac/documentation/cocoa/conceptual/OOP_ObjC/OOP_ObjC.pdf where it talks about OOP which
I'm reading the documentation for Google App Engine and stumbled upon something that I

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.