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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:16:16+00:00 2026-06-06T02:16:16+00:00

I have a UIButton that I create in my sub class ViewController, and add

  • 0

I have a UIButton that I create in my sub class ViewController, and add it to my MainViewController.

Now, I added a target method to this button that should push another view controller to my Navigation controller (the one that in the MainViewController).

I know that the method did call when I push the button, but the view wasn’t push to the Navigation Controller.

I scanned this drawing – this is the drawing (I also added part of my code):

question Drawing

This is the code I’m using in my button:
(remember it’s in a deferent ViewController).

- (void)buttonPressed:(UIButton *)sender
{
    Photo_ScreenGlobalView *photo = [[Photo_ScreenGlobalView alloc] init];
    [self.navigationController pushViewController:photo animated: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-06-06T02:16:17+00:00Added an answer on June 6, 2026 at 2:16 am

    Usually I solve these situations with delegation. If there is a view controller which is subordinate to another (i.e. a “sub” view controller) but should have the ability to trigger navigation changes, etc… then it should have a weak pointer back to it’s ‘parent’. Then the parent VC should implement an appropriately named protocol with a callback for the child to use. The names of these things can be generic, such as @property navigationDelegate and requestNavigationToViewController: or they can be more semantic, such as @property userFormDelegate and userFormDoneButtonPressed:

    Generally speaking, a subordinate view controller should not be able to directly modify navigation at it’s parent’s level; but it can trigger it via more loosely-coupoled interfaces like these.

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

Sidebar

Related Questions

I have a method that accepts a sender and is called with a UIbutton.
I have seen 2 ways to create button. UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(10, 220,
I have a button that's created via a NIB file. I've derived a class
I have a UIButton that I create in a storyboard and assign to a
I want to create a method that will accept a UIButton, UIImageView, or any
Given that you have a method -(void)aSelector:(id)anyArgument; And have set up a UIButton programmatically
I have this code that changes the back button of my UINavigationBar // Set
I have a UIButton that is created inside of each table cell. I want
I have a UIButton that performs an Action when it is touched down. I
So, I have a UIButton that, when a UITextField is in editing mode, becomes

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.