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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:47:05+00:00 2026-06-10T09:47:05+00:00

In my main view controller, I have a button that calls a popover. Since

  • 0

In my main view controller, I have a button that calls a popover. Since the popover has it’s own view controller, its buttons call methods in the popover’s view controller. But how would I call a method from the main view controller?

I tried this. In the popover view controller I added a property in the .h

@class ViewController;

@interface PopoverContent : UIViewController <UITextFieldDelegate>
...
@property (strong, nonatomic) ViewController *parentView;

In my popover implementation I did this in viewDidLoad:

self.parentView = [[ViewController alloc] initWithNibName:nil bundle:nil];

In ViewController I have a method called generateHash so I tried

[parentView generateHash];

But I get the error:

No visible @interface for 'ViewController' declares selector 'generateHash'

Any idea what I’m doing wrong? 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-06-10T09:47:07+00:00Added an answer on June 10, 2026 at 9:47 am

    remove this line, don’t want to create a new instance of view controller

    self.parentView = [[ViewController alloc] initWithNibName:nil bundle:nil];
    

    change this line

    @property (strong, nonatomic) ViewController *parentView;
    

    to this, so your parent view pointer is of the right class type

    @property (weak) ParentView *parentView;
    

    now inside parent views .m file

    - (void) createPopup
    {
        PopoverView *popoverV = [[PopoverView alloc] init];
        popoverV.parentView = self;
    
        //And some command to show your popup, addSubview, or presentModal, or whatever
    }
    

    Then in PopoverView.m file, you can call methods of the parentView like so

    [self.parentView SomeMethod];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a main view controller that consists of 1 button that when tapped,
I have a view MainView that has a navigation bar without any navigation controller,
I have a modal view controller that is presented from my main view, I
I have a main ViewController that has two buttons that each segue to their
I have a Navigation Controller with a View Controller displaying a button. The button
I have an application that has a button and a label. When the button
I currently have a view that is contained on a view. The main view
I have a main view controller which loads a tableviewcontroller when you press a
I have 2 UIImageView's in the main view controller of my app. They are
We have a page which has quite a few (close to 20) buttons/links that

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.