I am working on an iOS
app using 5.1 iPhone SDK
. The app has 2 view controllers and a tab view controller. I am allocating a UIImageView
from a library
which is being linked to the app. The code to allocate the UIIMageView
is being called from a function which is invoked after the app is initialised and launched. I use the code below to add the UIImageView.
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIImageView *imgView = [[UIImageView alloc] initWithFrame:[window bounds]];
[window addSubview:imgView];
[window bringSubviewToFront:imgView];
The problem is that the imageView
is not showing up when the app is run. I can't move the code out of the library or the function from where it is being called.
Appreciate any pointers.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIImageView *imgView = [[UIImageView alloc] initWithFrame:[self.window bounds]];
imgView.backgroundColor = [UIColor redColor];
[self.window addSubview:imgView];
[self.window bringSubviewToFront:imgView];
[self.window makeKeyAndVisible];
return YES;
}