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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:54:27+00:00 2026-05-24T23:54:27+00:00

I am using a popover view to present a large amount of flags of

  • 0

I am using a popover view to present a large amount of flags of which the your can select.
There is something wrong with my code since soon after I open this popover memory is not released (the viewcontroller “flagsViewController” is ok and clean, it does init and release each and every item inside of it.

What am I doing wrong? How can I free memory as soon as the popover is closed?

    -(void)presentFlags
    {
        [self.popoverController dismissPopoverAnimated:YES];

        FlagsViewController *controller = [[FlagsViewController alloc] 
                                            initWithNibName:@"FlagsViewController" 
                                            bundle:[NSBundle mainBundle]] ;

        UINavigationController *container = [[UINavigationController alloc] initWithRootViewController:controller];

        UISegmentedControl *ctrl = [[UISegmentedControl alloc] initWithItems:segmentedItems];
        ctrl.frame = CGRectMake(0, 6, 500, 30);
        [ctrl addTarget:self action:@selector(changeSeg:) forControlEvents:UIControlEventValueChanged];
        ctrl.segmentedControlStyle = UISegmentedControlStyleBar;
        //ctrl.momentary = YES; 
        ctrl.tintColor  = [UIColor darkGrayColor];
        UIImage *theImage = [UIImage imageNamed:@"highlight_country.png"];

        [ctrl setImage:theImage forSegmentAtIndex:0];

        [container.navigationBar addSubview:ctrl];
        [ctrl release];
        //
        //create a popover controller
        self.popoverController = [[[UIPopoverController alloc]
                                   initWithContentViewController:container] autorelease];
        [container  release];
        [popoverController setPopoverContentSize:CGSizeMake(500, 600)];
        //present the popover view non-modal with a
        //refrence to the button pressed within the current view
        [popoverController presentPopoverFromRect:CGRectMake(popoverArrowPossition, 0.0, 0.0, 52.0) inView:super.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
        [controller release];
}
  • 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-24T23:54:28+00:00Added an answer on May 24, 2026 at 11:54 pm

    Working with the UIPopoverController has been pretty difficult but I solved this problem by doing the following setting the Delegate of the Popover Controller to self (popoverController.delegate = self) and adding the UIPopoverControllerDelegate Protocol to your Class Header

    Next, I implemented the - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController delegate method and here I released the popoverController and set it to nil.

    - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
        [self.popoverController release];
        self.popoverController = nil;
    }
    

    Please note: This delegate method won’t be called if you dismiss the popover via code (i.e. using dismissPopoverAnimated), it’ll only be called if this User dismisses it by tapping outside the popover etc.

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

Sidebar

Related Questions

Is that possible to present a UIImagePickerController inside a view, instead of using it
Simple: A view, i present a UIPopoverController in a CGRect using presentPopoverFromRect... and neither
i am using an popover view in my application,when i went through the samples
I am using a POPover View in my application where i have a action
I'm using a UIStoryboardPopoverSegue to present a popover for an iOS 5 iPad app.
I'm using this code to show a popover from the toolbar of the detail
Merry Christmas. I have a view which contains a uitableview. Iam using wepopover to
I'm using the popover object from Twitter's Bootstrap library in manual mode and I
Using LINQ on collections, what is the difference between the following lines of code?
Using PHP, I can convert MySQL data or static table data to csv, Excel,

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.