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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:47:14+00:00 2026-05-23T01:47:14+00:00

I have a root view controller which contains an outlet for my login view

  • 0

I have a root view controller which contains an outlet for my login view controller. the root view should control the flow to the next view, yet my login view has the button to continue. how would I set the button’s touch up inside to the IBAction in my root controller?

One method I have though of was keep a pointer to the root class where I create the login class (new code is commented out):

// RootViewController.m

- (void)viewDidLoad {
    LoginViewController *loginController = 
        [[LoginViewController alloc]initWithNibName:@"LoginView" bundle:nil];
    self.loginViewController = loginController;
    //loginViewController.parent = self;
    [self.view insertSubview:loginController.view atIndex:0];
    [loginController release];
    [super viewDidLoad];
}

- (IBAction)loginPressed: (id)sender
{
    self.loginViewController.loginButton.enabled = NO; //yea... doesnt work
}

So in IB I add a UIViewController to the Nib and give it parent as an outlet, and then assign button’s touch up inside event to loginPressed which is defined in the root controller (parent)… this didnt work so well explicitly refering to the controls from self.loginViewController in the RootViewController.

is there a correct way to do this.

-frustrated c++ / c# / java coder

  • 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-23T01:47:14+00:00Added an answer on May 23, 2026 at 1:47 am

    Create the button pressed method outlet in the same class as that XIB and hook it up. I assume your login view is created by the root controller… create an assign property for the root view on the login view, and then assign the root controller to that when creating the login view. Then, in the login view’s method for “button pressed” you can reference the root view controller. Spelled out:

    in LoginController’s .h file:

    @property (nonatomic, assign) RootViewController* rvc;
    

    in LoginController’s .m file:

    @synthesize rvc;
    

    in Root View Controller’s “make the login controller code”, after you’ve initialized it but before you’ve presented it:

    [loginController setRvc:self];
    

    in your LoginController’s button touched method:

    [[self rvc] whateverMethodThatDoesLoginStuff];
    

    This way you have your path between when the user presses the button and your “do-login” code.

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

Sidebar

Related Questions

I have a root view controller which has few buttons. On click of these
I have a main window which has the UITabViewController as its root controller. I
I have a xib with a view which contains two views which each contain
I have a view that contains a UITableView and a UILabel which works perfectly
I have a root UIViewController which has a property called webView. WebView is a
I have a login.jsp page which contains a login form. Once logged in the
I have a root view controller as the navigation controller. In the root view
I have an Image, which contains carrierwave uploads: Image.find(:first).image.url #=> /uploads/image/4d90/display_foo.jpg In my view,
I have an app with a navigation controller as the root view. There are
I am using a machine on which I do not have root access and

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.