سؤال

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

هل كانت مفيدة؟

المحلول

Use -[UIViewController viewDidLoad] method which is called exactly once when the controller is first loaded into the memory.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top