sAguinaga
sAguinaga

Reputation: 659

How to add s7graphview to a subview on ViewController nib?

I have a xib with a subview that I set to Class: S7GraphView (if I select it and click on the identity inspector)

When all I have in the (void) didViewLoad { ...

    s7graphView = [[S7GraphView alloc] initWithFrame:[self.view bounds]];
    //[self.view addSubview:s7graphView];  
    s7graphView.dataSource = self;
    ... 
}

In the nib, I control-hold the file's owner to the subview and select - S7GraphView and it still shows up empty in the simulator.

If I comment all this out, I get a black subview (I do set the background to black) but not graph:

//    s7graphView = [[S7GraphView alloc] initWithFrame:[self.view bounds]];
//    //[self.view addSubview:s7graphView]; 
//    s7graphView.dataSource = self;
//    [s7graphView release];

If I remove the subview from my view and instead add it programmatically, it works when I add it like this:

s7graphView = [[S7GraphView alloc] initWithFrame:CGRectMake(20., 70., 280.0, 240.0 )];
[self.view addSubview:s7graphView];
s7graphView.dataSource = self; [s7graphView release];

I should be able to add it via the xib too, right? What do youz think I'm doing wrong?

Thanks!!

Upvotes: 0

Views: 407

Answers (1)

albianto
albianto

Reputation: 4152

Have you implemented the delegate and the datasource?

Upvotes: 0

Related Questions