NSImage at app start
-
07-07-2021 - |
Frage
I have an image view object. I can get it to load images when a buttun is pressed but I want to know if there is a way to get it to load at the start of the app.
The code im using is
NSURL *lURL = nil;
NSData *lData = nil;
NSImage *lImage = nil;
lData = [lURL resourceDataUsingCache:YES];
lImage = [[NSImage allocWithZone:[self zone]] initWithData:lData];
lURL = [[NSURL alloc] initWithString:@"urltoimage"];
[imageView setImage:lImage];
any help is appreciated
Lösung
Use -[UIViewController viewDidLoad]
method which is called exactly once when the controller is first loaded into the memory.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow