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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:16:20+00:00 2026-06-03T21:16:20+00:00

I call a View to be presented with the following code: #import infoView.h …

  • 0

I call a View to be presented with the following code:

#import "infoView.h"
...
infoView *viewInfo = [[infoView alloc] initWithNibName:nil bundle:nil];
viewInfo.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:viewInfo animated:YES];

But when it is presented in run-time the view that is loaded turns out black.
Currently I am using storyboard, but I need to use this code, for it is a lot more efficient in my case, because I am dealing with multiple views!

It works fine if I connect it via StoryBoard.

I should be seeing 2 labels, 1 UITextView, and 2 UIButton.

The view was created using StoryBoard, when the .m and .h files for the view where created I did not add a .xib for it. And also it is linked through the “Custom Class” section in StoryBoard.

Thanks, hope someone can 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-03T21:16:22+00:00Added an answer on June 3, 2026 at 9:16 pm

    It’s generally pretty bad form to mock people who are taking the time and effort to help you.

    Naming is important it makes your code easier to work with and allows other people to use it. Not following the conventions for the language you are working in is dangerous and means that your code is not compatible with other developers as things are interpreted differently.

    If you look at the docuemntation for UIViewController you’ll see this note in the initWithNibName:bundle: method description

    If your app uses a storyboard to define a view controller and its associated views, your app never initializes objects of that class directly. Instead, view controllers are either instantiated by the storyboard—either automatically by iOS when a segue is triggered or programmatically when your app calls the storyboard object’s instantiateViewControllerWithIdentifier: method. When instantiating a view controller from a storyboard, iOS initializes the new view controller by calling its initWithCoder: method instead. iOS automatically sets the nibName property to a nib file stored inside the storyboard.

    Therefore you are instantiating your controller wrong, the storyboard should be instantiating it. Which is done like this (naming corrected)

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle bundleForClass:[self class]]];
    InfoViewController *infoViewController = [storyboard instantiateViewControllerWithIdentifier:@"InfoViewController"];
    infoViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self infoViewController animated:YES];
    

    Side note

    infoView is a bad name for the class not only because you didn’t start with a capital but also because it’s completely deceiving. Anyone reading this would assume that InfoView is a subclass of UIView not UIViewController.

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

Sidebar

Related Questions

I have a UIViewController (call it NumberTwo) which I presented as a modal view
I presented a View using a call to presentModalViewController . My new View didn't
We have a View (call it X) that is the base view called by
I'm trying to return a JSON response from a Django view call via an
I implemented 4 views in AppDelegate depends on requirement it will call the view.I
I want to call a new view controller and remove the current view controller
I was wondering when to call from the view a Custom View Helper like
I am developing an application that currently has a View Controller (call it ViewControllerX).
hello how can i call in the current view, a method implemented in the
How to call codeigniter controller function from view? When i call the function 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.