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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:53:59+00:00 2026-06-06T10:53:59+00:00

I am using a UIButton , on clicking it I want to display the

  • 0

I am using a UIButton, on clicking it I want to display the contents that are present in my NSMutableArray in UITableView with the help of UIPopOverController i.e. I want a UITableView to pop up whose cells show the contents of my NSMutableArray.

I am using the following lines of code:

UITableViewController *table= [[UITableViewController alloc]init];

table.delegate = self;

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:table];
self.popoverController = popover;          
popoverController.delegate = self;


NSString *hDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *hFilePath = [hisDir stringByAppendingPathComponent:@"hhhh.txt"];

NSArray *array = [NSArray arrayWithContentsOfFile:hFilePath ];
NSMutableArray *kkkk = [[NSMutableArray alloc] init];
for (NSDictionary *dict in array) {
    [kkkk addObjectsFromArray:[dict allKeys]];    
}

table = [[UIImageView alloc] initWithFrame:[window bounds]];
// Set up the image view and add it to the view but make it hidden
[window addSubview:table];
table.hidden = YES;
[window makeKeyAndVisible];

I am unable to get the UITableView to pop up on the press of my UIButton. Can anyone help me to sort it out?

  • 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-06T10:54:00+00:00Added an answer on June 6, 2026 at 10:54 am

    One way to show the UITableView in the UIPopOverController is by creating a new UIViewController class. And invoking it in initWithContentViewController method of UIPopOverController.

    1. Create a new UIViewController or UITableViewController class. Create an instance of it.

    2. Use the instance in the initWithContentViewController method of UIPopOverController.

    3. Mention from where it should “pop”

    For Example in your Button action :

    -(IBAction)yourButtonAction:(id)sender
    
    {
       YourNewViewController*newVC=[[YourNewViewController alloc]init];
    
       UIPopoverController*somePopOver=[[UIPopoverController alloc]initWithContentViewController:catergoryVC]; //Tell which view controller should be shown
       [somePopOver setPopoverContentSize:CGSizeMake(200, 200)]; // set content size of popover
       [somePopOver presentPopoverFromRect:yourButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; //From where it should "pop"
    
    }
    

    It seems you want to present it from a UIBarButtonItem so instead of presentPopoverFromRect use presentPopoverFromBarButtonItem

     [somePopOver presentPopoverFromBarButtonItem:yourBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display a small refresh button using UIButton in a standard UIView
When using property/synthesize for a UITableView, UIButton, etc should self be included in the
I'm playing an audio clip using a UIButton that calls a method (see code
I'm using TouchDragOutside on a UIButton that I placed in IB, but it isn't
i m presenting modalviewcontroller without using delegate protocol. But want to dismiss modalviewcontroller using
How do you center text line-by-line in a UIButton using Interface Builder? I am
Im showing the AirPrint options from a UIButton using the presentFromRect method, everything is
I have a UIButton, and I'm adding an image to it using this code:
I want to drag and drop UIbutton in my app like iPhone main screen
I am facing a problem in using UIButton action and touchesmoved . The scenario

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.