I recently started programming my first Cocoa app. I have ran into a problem i hope you can help me with.
I have a MainController who controls the user browsing his computer and sets some textfield = the chosen folder.
I need to retrieve that chosen folder in my AnalyzeController in order to do some work. How do i pass the textfield objectValue from the MainController to the AnalyzeController?
Thanks
Alright this it what i came up with:
MainController.h:
#import "AnalyzeController.h"
@interface MainController : NSObject {
AnalyzeController* analyzeControl;
}
MainController.c:
analyzeControl = [[AnalyzeController alloc]init];
[analyzeControl setDevelopmentPath:filename];
AnalyzeController.h:
@interface AnalyzeController : NSObject {
NSString* developmentPath;
}
@property(assign) NSString* developmentPath;
AnalyzeController.c:
@synthesize developmentPath;
NSLog(@"FINAL TEST: %@", developmentPath);
But i end up with the test returning NULL. I was a bit unsure about what the property parameter should be. Can you help? Or did i get it all wrong?
Do that.
I assume that either you bound the text field to the
mainFolderPathproperty, or you assigned to the property when the field’s value changed.I also assume that, in writing the AnalyzeController, you gave it a property named
folderPathor at least a setter namedsetFolderPath:.