Try this and let me know, whether its working or not,
- (IBAction)add {
UIImage *mustImage = [UIImage imageNamed:@"themustache.png"];
UIImageView *must = [[UIImageView alloc] initWithImage:mustImage];
[self.view addSubview:must];
[mustImage release];
[must release];
}
or this,
- (IBAction)add {
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f);
UIImageView *must = [[UIImageView alloc] initWithFrame:myImageRect];
[must setImage:[UIImage imageNamed:@"themustache.png"]];
[self.view addSubview:must];
[must release];
}
Try, window
instead of self.view
if you are calling the function right from AppDelegate.m.
Both of the above, must work for you.