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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:47:14+00:00 2026-06-16T05:47:14+00:00

I have a view controller that I want to present from my root view

  • 0

I have a view controller that I want to present from my root view controller when the view is load.

I have set the presenting view controller as the delegate for the presented view.

I have a UIBarbutton that when I tap, the view is presented with no problem using a method that does the exact same thing as the viewDidLoad, in the viewDidLoad method I try to present the view:

modalViewController.delegate = self;
modalViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:modalViewController animated:YES];

it’s not working.

Is it a problem to try to present the view in the viewDidLoad method?

The whole viewDidLoad method:

- (void)viewDidLoad {
[super viewDidLoad];

UINavigationBar *navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
navigationBar.tintColor = [UIColor blackColor];
UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc] initWithTitle:@"              "
                                                                  style:UIBarButtonItemStyleDone
                                                                 target:self
                                                                 action:@selector(changePlayersNames)];//Check how to highlight the button
//Label for UIBarButton text
UILabel *barButtonLabel = [[UILabel alloc] initWithFrame:CGRectMake(3, 5, 70, 30)];
barButtonLabel.text = @"Players";
[barButtonLabel setFont:[UIFont fontWithName:@"ChalkboardSE-Bold" size:15.0]];
barButtonLabel.textAlignment = UITextAlignmentCenter;
barButtonLabel.backgroundColor = [UIColor clearColor];
barButtonLabel.textColor = [UIColor whiteColor];

//Set UINavigation item
UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@""];
item.leftBarButtonItem = leftBarButton;
item.hidesBackButton = YES;
[navigationBar pushNavigationItem:item animated:YES];

//Label for the navigation title
UILabel *barTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 160, 30)];
barTitleLabel.center = navigationBar.center;
barTitleLabel.text = @"Tic-Tac-Toe";
[barTitleLabel setFont:[UIFont fontWithName:@"ChalkboardSE-Bold" size:20.0]];
barTitleLabel.textAlignment = UITextAlignmentCenter;
barTitleLabel.backgroundColor = [UIColor clearColor];
barTitleLabel.textColor = [UIColor whiteColor];
[self.view setBackgroundColor:[UIColor whiteColor]];

[self.view addSubview:navigationBar];
[self.view addSubview:barTitleLabel];
[self.view addSubview:barButtonLabel];

self.player1 = [[ORDPlayer alloc] init];
self.player2 = [[ORDPlayer alloc] init];

[self setNamesLabels:@"Player 1" :@"Player 2"];


//TapRecognizer
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc]
                                     initWithTarget:self action:@selector(tapRecognized:)];
singleTap.numberOfTapsRequired = 1;
singleTap.numberOfTouchesRequired = 1;
singleTap.delegate = self;
[self.view addGestureRecognizer:singleTap];

//Present modal view
self.playerChangeController = [[ORDPlayerChangeController alloc]
                               initWithNibName:@"ORDPlayerChangeController" bundle:nil];
playerChangeController.delegate = self;
playerChangeController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:playerChangeController 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-16T05:47:15+00:00Added an answer on June 16, 2026 at 5:47 am

    You cannot present your view controller from viewDidLoad, especially not animated. At that point you might still be creating subviews, so the view is not even rendered yet.

    Instead, you should try presenting your modal view controller in viewDidAppear.

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

Sidebar

Related Questions

I have a view controller that houses a UIWebView. I want to display an
I have a view controller that gets presented modally and changes some data that
I have a view controller that has a tableView in it. When I set
I have a modal view controller that I am presenting on iPad via: vc.modalPresentationStyle
I want to present a view controller where I have one Background imageView. Alpha
I have a view controller that is inside a popover, and I want to
I have a root view controller that opens up a new modal view controller.
I want to have a ViewController that has a table view on the top
If I have a view controller that has an NSOperationQueue as an instance variable,
I know this is extremely silly. I have a view controller that scans a

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.