Hi at all, I have a little problem, I create a simple document based project, is very simple.
I habe an action
that save one value on my array.
This method is for save and load file
and this method is for set label with array value.
The problem is that when I load a file the label was not set. The array was loaded correctly ( with NSLog I see the correct value) but I can't set the label with array content.
Where is the error?
I habe an action
Code:
- (IBAction)salva:(id)sender {
[array addObject:@"Hello"];
[nomeLabel setStringValue:@"ciao"];
NSLog(@"%@",[array objectAtIndex:0]);
}
that save one value on my array.
This method is for save and load file
Code:
- (BOOL) writeToURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError **)outError {
return [array writeToURL:url atomically:YES];
}
- (BOOL) readFromURL:(NSURL *)url ofType:(NSString *)type error:(NSError **)outError{
[ array release];
array = [[NSMutableArray alloc] initWithContentsOfURL:url];
NSLog(@"%@",[array objectAtIndex:0]);
return YES;
}
and this method is for set label with array value.
Code:
- (void) imposta {
[nomeLabel setStringValue:[array objectAtIndex:0]];
NSLog(@"Ciao");
}
The problem is that when I load a file the label was not set. The array was loaded correctly ( with NSLog I see the correct value) but I can't set the label with array content.
Where is the error?