I can get UIImageView to display the image, if I set the image in the Interface Builder. But nothing shows when I set the parameters programmatically.
Here is the code:
ImageTestViewController.h:
ImageTestViewController.m:
I connected the UIImageView in the interface to the IBOutlet. The image is in the Resources. I still won't display. What have I done wrong?
Thanks.
Here is the code:
ImageTestViewController.h:
Code:
#import <UIKit/UIKit.h>
@interface ImageTestViewController : UIViewController {
UIImageView *imageView;
}
@property (nonatomic, retain) IBOutlet UIImageView *imageView;
@end
ImageTestViewController.m:
Code:
#import "ImageTestViewController.h"
@implementation ImageTestViewController
@synthesize imageView;
- (void)viewDidLoad {
UIImage *image = [UIImage imageNamed:@"apress_logo.png"];
imageView = [[UIImageView alloc] initWithImage:image];
[super viewDidLoad];
}
- (void)viewDidUnload {
imageView = nil;
[super viewDidUnload];
}
- (void)dealloc {
[imageView release];
[super dealloc];
}
@end
I connected the UIImageView in the interface to the IBOutlet. The image is in the Resources. I still won't display. What have I done wrong?
Thanks.