I see printouts of the "initWithFrame" methode being called but not the drawRect. Shouldn't drawRect be triggerd for the setNeedsDispaly call?
Question nr 2.
How do i get my view "chartView" into the IB? I read that you are supposed to be able to drag it into the window with "File Owner" and that stuff, and then it should be available. I see the green + sign when I drag it there but it doesnt show up anywhere i the library window. I want to make that view smaller and fit in on the view togheter with a few textinputs and buttons.
I see printouts of the "initWithFrame" methode being called but not the drawRect. Shouldn't drawRect be triggerd for the setNeedsDispaly call?
Question nr 2.
How do i get my view "chartView" into the IB? I read that you are supposed to be able to drag it into the window with "File Owner" and that stuff, and then it should be available. I see the green + sign when I drag it there but it doesnt show up anywhere i the library window. I want to make that view smaller and fit in on the view togheter with a few textinputs and buttons.
Thanks for your time.
/x
drawRect is send to the DELEGATE of the view. Did you set chartview.delegate?
Also, why did you create the view to be only 1 pixel wide and high?
Do you use a ViewController? Then the .view property of it needs to point to your view as well.
Question 2: Just create a new UIView from the Library and put it where you want the view to be. Then go to the rightmost tab in the inspector and change the class to be ChartView.
How do i set the delegate? Can you show me? I thought a controller and a delegate was the same thing...
thanks for your time.
/x
set delegate like this:
GraphView *myGraphView; // variable to hold pointer, could be in header of viewcontroller
myGraphView.delegate = self; // sets it to where you are currently
you don't need to set it to itself though, I think. Usually you would have delegate functions in the viewcontroller.
A Viewcontroller has some things that a view itself cannot do, like being pushed ontop of a navigationcontroller. Check the docs: UIViewController versus UIView. You very rarely need to subclass UIView only if you have very special drawing logic.
Unfortunately my MBP is being serviced as we speak, otherwise I would have offered that you send me the source and I find the problem for you.
GraphView *myGraphView; // variable to hold pointer, could be in header of viewcontroller
myGraphView.delegate = self; // sets it to where you are currently
you don't need to set it to itself though, I think. Usually you would have delegate functions in the viewcontroller.
A Viewcontroller has some things that a view itself cannot do, like being pushed ontop of a navigationcontroller. Check the docs: UIViewController versus UIView. You very rarely need to subclass UIView only if you have very special drawing logic.
Unfortunately my MBP is being serviced as we speak, otherwise I would have offered that you send me the source and I find the problem for you.