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 3974268
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:32:53+00:00 2026-05-20T04:32:53+00:00

i have added a UIPopover to my navigationbar when the user touches the rightbarbuttonitem.

  • 0

i have added a UIPopover to my navigationbar when the user touches the rightbarbuttonitem.
I want to know whats the cleanest coding for showing and dismissing the popover. With the code below, it works, but not correct.
If the user touches the rightbarbuttonitem first, the popover appears. Now he can choose a cell,.. works. Or you can touch outside the popover and it disappears. Both ways correctly.

But when touching the rightbarbuttonitem and after that, the same touch on that icon again, you have to touch it twice to bring up that popover again. (Not on the first touch).

How should that correctfunction look like? Thanks for your time..

 -(void) downloads:(UIBarButtonItem*)button{
        NSLog(@"downloads");
        if(tableViewController == nil) {
        tableViewController = [[[TableViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];

        self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:tableViewController]autorelease] ;
        [self.popoverController presentPopoverFromBarButtonItem:barButtonItem permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
        tableViewController.delegate = self;
        }else {
            [self.popoverController dismissPopoverAnimated:NO];
            tableViewController.delegate = nil;
            tableViewController = nil;
            //[self.popoverController release];
            //self.popoverController = nil;
        }
    }

    //delegate
    -(void) selectedTable:(NSString*)text{
        NSLog(@"selectedTable: %@", text);
         [self.popoverController dismissPopoverAnimated:YES];
    }
  • 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-20T04:32:54+00:00Added an answer on May 20, 2026 at 4:32 am

    Comments

    Your downloads: method checks for tableViewController value and make decision if UIPopoverController should be displayed or dismissed. But yours selectedTable: method does dismiss popoverController and does not set tableViewController to nil thus it doesn’t work as expected by you.

    And I also don’t see UIPopoverControllerDelegate implementation, especially popoverControllerDidDismissPopover: which will tell you when UIPopoverController was dismissed (by touching outside your UIPopoverController for example).

    Memory Management

    Read memory management guide. [self.popoverController release] with self.popoverController = nil leads to crash – one release and second release during setting to nil. (I assume your popoverController property retains).

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

Sidebar

Related Questions

I have added a TextField to a UICell in order to allow a user
I have added a few buttons to self.view. When the user clicks on one
i have added an additional admin user and created a role for it, allowing
I have added geocode_ip_address in ApplicationController so I can get the user location info
I have added a foreign key to a user to a model, but when
I have added a textbox to my WinMo app's form and I want to
I have added a navigation controller inside a viewcontroller thats inside another navigation controller...
I have added a plugin called scrollpaper to a site I'm working on. The
I have added an UIImageView as a subview in UIView , and then I
I have added an HTML file to my solution in VS2010. How do you

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.