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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:31:10+00:00 2026-06-04T19:31:10+00:00

//RootViewViewController.h #import <UIKit/UIKit.h> #import SettingsViewController.h #import OneSlotViewController.h #import TwoSlotViewController.h #import BingoSlotViewController.h #import SettingsViewController.h @interface

  • 0

//RootViewViewController.h

#import <UIKit/UIKit.h>
#import "SettingsViewController.h"
#import "OneSlotViewController.h"
#import "TwoSlotViewController.h"
#import "BingoSlotViewController.h"
#import "SettingsViewController.h"

@interface RootViewViewController : UIViewController{

    IBOutlet UIButton *owaru;
    OneSlotViewController *oneSlotViewController;
    TwoSlotViewController *button2ViewController;
    BingoSlotViewController *button3ViewController;
    UIViewController *pushedController;
    UIButton *hajimekara;
    SettingsViewController *settingsVc;


}
@property (retain, nonatomic) UIButton *hajimekara;
@property (strong, nonatomic) IBOutlet UIButton *owaru;
@property (nonatomic, retain) OneSlotViewController *button1ViewController;
@property (nonatomic, retain) TwoSlotViewController *button2ViewController;
@property (nonatomic, retain) BingoSlotViewController *button3ViewController;
@property (nonatomic, retain) UIViewController *pushedController;
@property (nonatomic, retain) SettingsViewController *settingsVc;

//RootViewViewController.m

@synthesize button1ViewController;
@synthesize button2ViewController;
@synthesize button3ViewController;
@synthesize pushedController;
@synthesize settingsVc;


-(IBAction) startButtonPressed:(id) sender { 
    if (self.settingsVc.pushedController!=nil) { 
        NSLog(@"push"); 
        [self presentViewController:self.settingsVc.pushedController animated:YES completion:NULL]; 
    } 
}

//SettingViewController.h

#import "OneSlotViewController.h"
#import "TwoSlotViewController.h"
#import "BingoSlotViewController.h"

#import "SettingsViewController.h"

#import "AGImagePickerController.h"


@class RootViewViewController;


@interface SettingsViewController : UIViewController<UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIPopoverControllerDelegate,UIScrollViewDelegate>{


    OneSlotViewController *oneSlotViewController;
    TwoSlotViewController *button2ViewController;
    BingoSlotViewController *button3ViewController;
    UIViewController *pushedController;
     RootViewViewController *mainVc;
    UIImageView *lastPriceView;
    CustomImagePicker *_imagePicker;
    UINavigationController *navController;

}


@property (nonatomic, retain) UIPopoverController *popoverController;
@property (nonatomic, retain) OneSlotViewController *button1ViewController;
@property (nonatomic, retain) TwoSlotViewController *button2ViewController;
@property (nonatomic, retain) BingoSlotViewController *button3ViewController;
@property (nonatomic, retain) UIViewController *pushedController;
@property (nonatomic, retain) RootViewViewController *mainVc;
@property (strong, nonatomic) IBOutlet UIImageView *lastPriceView;
@property (nonatomic, retain) CustomImagePicker *imagePicker;
@property (nonatomic, retain) IBOutlet UINavigationController *navController;

//SettingViewController.m

-(IBAction) button1Pressed:(id)sender {
    if (self.button1ViewController==nil) {
        button1ViewController = [[OneSlotViewController alloc] init];
    }
    self.pushedController = button1ViewController;
}

-(IBAction) button2Pressed:(id)sender {
    if (self.button2ViewController==nil) {
        button2ViewController = [[TwoSlotViewController alloc] init];
    }
    self.pushedController = button2ViewController;
}

-(IBAction) button3Pressed:(id)sender {
    if (self.button3ViewController==nil) {
        button3ViewController = [[BingoSlotViewController alloc] init];
    }
    self.pushedController = button3ViewController;
}

I have already declare there instances un the two controllers.
Whenever a button is pressed in the SettingsViewController it will pass the ViewController to the MainViewController’s startButton.
But I cant seem to make it work. Thanks for your help.

  • 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-04T19:31:12+00:00Added an answer on June 4, 2026 at 7:31 pm

    SettingsViewController.pushedController and MainViewController.pushedController are separate variables. Changing one will not effect the other.

    You have two options. You either need to store the SettingsViewController in the MainViewController, or pass the MainViewController to SettingsViewController.

    If MainViewController keeps a reference to the SettingsViewController, then you can:

    -(IBAction) startButtonPressed:(id) sender { 
        if (self.settingsViewController.pushedController!=nil) { 
            NSLog(@"push"); 
            [self presentViewController:self.settingsViewController.pushedController animated:YES completion:NULL]; 
        } 
    }
    

    If SettingsViewController is passed a reference to MainViewController, then you can:

    -(IBAction) button1Pressed:(id)sender {
        if (self.button1ViewController==nil) {
            button1ViewController = [[ViewOneController alloc] init];
        }
        self.mainViewController.pushedController = button1ViewController;
    }
    
    -(IBAction) button2Pressed:(id)sender {
        if (self.button2ViewController==nil) {
            button2ViewController = [[ViewTwoController alloc] init];
        }
        self.mainViewController.pushedController = button2ViewController;
    }
    
    -(IBAction) button3Pressed:(id)sender {
        if (self.button3ViewController==nil) {
            button3ViewController = [[ViewThreeController alloc] init];
        }
        self.mainViewController.pushedController = button3ViewController;
    }
    

    Pick one of these things and you should be OK.

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

Sidebar

Related Questions

No related questions found

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.