Help on displaying view in window-based app

Discussion in 'iOS Programming' started by crazyapple777, May 19, 2010.

  1. crazyapple777 macrumors newbie

    May 19, 2010
    Hi, I'm a new member and I've just started getting used to Objective-C after being proficient with Java (huge difference!). So far I've gone through this tutorial:

    My problem is that whatever I do, I can't get the view to display on the window-based application. I've looked through all the steps in the above tutorial a thousand times, and I'm not getting an error either. Specifically, I think the problem is with the part where you're supposed to create a subview from passing the ViewController object which contains the controller for all the UI objects. Can anyone help? (If you need more specifics, just ask) Thanks in advance.
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    Post your code. Otherwise we're just guessing.
  3. Svinja macrumors newbie

    Oct 27, 2008
    In you appDelegate.applicationDidFinishLaunching use something like this:
    MyViewController *viewController=[[MyViewController alloc] init];
    [self.window addSubview:viewController.view];
    dont forget to import "MyViewController.h"...
    this is without using ib...i never use it...
  4. crazyapple777 thread starter macrumors newbie

    May 19, 2010
    Yeah, it was something like this. Unfortunately, I don't have a Mac, so I have to use the ones at my school (which is why this is so frustrating). I'll post the code when I can, but I think it was something like that above. Everything seems fine, no errors, but there's just a black screen when I simulate it. (I've tried a different HelloWorld tutorial with a drawRect method, and I can get text to display on a screen, but that's about it.)

    Everything seems to work in the window-based section and in the view-based part of the code, it's just the passing of the controller containing the view that's my problem...

Share This Page