How to design a good application?
How to design a good application?
- Subject: How to design a good application?
- From: HAEUPL Friedrich <email@hidden>
- Date: Tue, 11 Dec 2001 13:26:35 +0100
I'm writing a program, that loads data from a data file into an NSData object.
Then the application should allow to open a window for visualisation.
For loading the data I use an instance of NSObject called MyObject:
@interface MyObject : NSObject
{
NSData *Data;
}
- (void) awakeFromNib;
- (BOOL) dataloaded;
- (NSData*) getsubData;
- (IBAction)myShowAction:(id)sender
- (IBAction)loadImage:(id)sender;
- (IBAction)saveImage:(id)sender;
@end
For the visualisation of the data I create programmatically
@interface MyView : NSView
{
}
- ...
- (void)drawRect:(NSRect)rects;
@end
The part of the program (im MyObject.m ) that creates the visualisation window is ...
- (IBAction)myShowAction:(id)sender
{
NSRect myRect=NSMakeRect(0, 0, 300, 300);
myWindow=[[NSWindow alloc] initWithContentRect:myRect
styleMask:NSTitledWindowMask .... backing:NSBackingStoreBuffered
defer:NO];
[myWindow useOptimizedDrawing:YES];
myView=[[MyView alloc] initWithFrame:myRect];
[myView setFrame:[myWindow frame]];
[myWindow setContentView:myView];
[myWindow makeKeyAndOrderFront:self];
....
}
In myview/drawRect I have to access the Data loaded in the NSData Object.
(methods dataloaded and getsubData). But somehow it seems, that this is
not possible.
How can I access the methods dataloaded and getsubData of MyObject
in the drawRect methode of MyView ?
Thanks,
Fritz