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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:10:32+00:00 2026-05-25T00:10:32+00:00

I have following code: LoginViewController *lvc = [[LoginViewController alloc] initWithNibName:@LoginViewController bundle:nil]; [self presentModalViewController:lvc animated:false];

  • 0

I have following code:

     LoginViewController *lvc = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
 [self presentModalViewController:lvc animated:false];
 [lvc release];

That is called from my MainViewController.

Now, when the LoginViewController will be dismissed (of course this only happens when the login is correct) I must call a method in my MainViewController to load the initial data for my app.

I read a lot about delegate and tried it, but don’t get it to work.
Could someone help me please?

(if possible, please with a few lines of code)
Any help is welcome!

  • 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-25T00:10:32+00:00Added an answer on May 25, 2026 at 12:10 am

    I read a lot about delegate and tried it, but don’t get it to work.

    What have you tried really? Your LoginViewController must define a simple delegate protocol, and your MainViewController must conform to it.

    All you need to do is add something like this in LoginViewController.h above @interface:

    @protocol LoginViewControllerDelegate
    
    - (void)loginViewControllerDidFinish;
    
    @end
    

    Which declares a protocol with one method. Then add this between @interface and @end:

    @property (nonatomic, assign) id <LoginViewControllerDelegate> delegate;
    

    Which means your login view controller will have a property called delegate which will point to an instance of any class (that’s what id means) that conforms to it’s delegate protocol (the thing between < and >). Don’t forget to @synthesize delegate; inside .m file.

    Now what you need to do is inside MainViewController.h add to @interface line like this:

    @interface MainViewController : UIViewController <LoginViewControllerDelegate>
    

    Which tells the compiler your MainViewController class conforms to this LoginViewControllerDelegate delegate protocol. Now implement the - (void)loginViewControllerDidFinish; method inside MainViewController.m and before presenting the login view controller modally set it’s delegate to self (login.delegate = self;). When you are done inside your login view controller, before you dismiss it, call the delegate method on your delegate:

    [self.delegate loginViewControllerDidFinish];
    

    And that’s it. Any more questions?

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

Sidebar

Related Questions

I have following code in my application. [self.navigationController pushViewController:x animated:YES]; It will push a
I have following code snippet that i use to compile class at the run
I have following code that is accepting a form submission [ActionName(TestingTemp), AcceptVerbs(HttpVerbs.Post)] public ActionResult
I have following code in my Application. tmp=[[UILabel alloc] initWithFrame:label1Frame]; tmp.tag=1; tmp.textColor=[UIColor blackColor]; [tmp
I have following code snippet: self.xmlHttpReq = new XMLHttpRequest(); self.xmlHttpReq.onreadystatechange = function() { if(self.xmlHttpReq.readyState
I have following code (I checked objCur is not Nil before free}: try objCur.Free;
I have following code i want that window opened uses Ext.layout.BorderLayout and also on
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section
I have following code in my application: // to set tip - photo in

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.