I want to change an image of an UIImageView from the applicationDidFinishLaunching method of the app delegate class. But I am afraid that this class doesnt know much about the controller outlet. What must I do in this case?
views:
75answers:
2
A:
You would probably need to put an outlet for your UIImageView or its controller in your application delegate to make it accessible there.
Eric Petroelje
2009-04-01 16:48:32
+2
A:
You have to define the ViewController that the UIImageView is on, to the AppDelegate Class, so the applicationDidFinishLaunching can reference it.
In the AppDelegate add @class whateverViewController before the interface statement, and define the instance.
#import <UIKit/UIKit.h>
@class WhateverViewController;
@interface WebDemoAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
WhateverViewController *whateverViewController;
}
Now your app has a reference to whateverViewController. You can then call a method in whateverViewController to change the UIImageView or set the UIImageView directly. Of course this assumes that the whateverViewController is instantiated (e.g. alloc/init or loaded from nib); before you try to set anything, it must exist.
Jordan
2009-04-01 16:59:33