views:

229

answers:

1

From withing a UIViewController that is tied to a UIView (drawn in a nib file), i try to add another view, as a subview to the first view.

In case you are confused: UIViewController -> UIView + GraphView (extends UIView)

So i am saying:

GraphView *myGraphView = [[GraphView alloc] init];
graphView = myGraphView;
[self.view addSubview:graphView];
[myGraphView release];

I have also tried with insertSubview.

The UIView shows up and the GraphView subview is instantiated correctly (its properties are there and i can access its methods). But it never shows on the screen! Its drawRect method is never called (i have an NSLog in there that never shows), even if i manually call [graphView setNeedsDisplay].

Does anyone have a clue?

Thanks a lot!!!

+1  A: 

Doesn't look like you're setting the GraphView frame rectangle, it will not display if it's offscreen. Also you probably should be calling the UIView initWithFrame: initializer if you aren't.

duncanwilcox
Genius!I only did "init" not "initWithFrame" and that alone did it.Thanks!!
Dimitris