Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-24-2009, 07:57 AM   #5 (permalink)
xworker
Registered Member
 
Join Date: Mar 2009
Posts: 27
xworker is on a distinguished road
Default

Quote:
Originally Posted by Oliver Drobnik View Post
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.

cheers
Oliver

Dr. Touch
Thanks!

I did set the view in my controller header file, but not the self thing.
Looks like this:

Code:
#import <UIKit/UIKit.h>
#import "ChartView.h"

@interface WeightApp2ViewController : UIViewController {

	IBOutlet UITextField *txtWeight;
	IBOutlet UITextField *txtHeight;
	IBOutlet UILabel *lblBmi;
	ChartView *chartView;
}

@property(nonatomic,retain) IBOutlet UITextField *txtWeight;
@property(nonatomic,retain) IBOutlet UITextField *txtHeight;
@property(nonatomic,retain) IBOutlet UILabel *lblBmi;

- (IBAction) calculateBmi:(id) sender;

@end
and the implementation of the controller:

Code:
#import "WeightApp2ViewController.h"

@implementation WeightApp2ViewController

@synthesize txtWeight, txtWeight, lblBmi;



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}



- (void)loadView {
	NSLog(@"chartView loading");
	chartView = [[ChartView alloc] initWithFrame:CGRectMake(1.0, 0.0, 1.0, 1.0)];
	[chartView setNeedsDisplay];

	
}
Gona test your solution when I get home from work

/x
xworker is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,630
Threads: 94,089
Posts: 402,801
Top Poster: BrianSlick (7,990)
Welcome to our newest member, RickyGervaiss
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:00 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.