Reputation: 1004
I'm trying to explore UIImageView so I added an image "Logo.jpg" to my projet (I'm new to iPad programming) which is LoadImageProject but iI can't get this image load to my view?
In my Interface builder (LoadImageViweController.xib) I drag a UIImageView and added it then connect it to the File's owner
My code :
LoadImageViweController.h
{
IBOutlet UIImageView *image;
}
@property (nonatomic, retain) IBOutlet UIImageView *image;
@end
and in the implementation file LoadImageViweController.m i added this to the viewDidLoad method :
- (void)viewDidLoad
{
[super viewDidLoad];
//declare the Image
UIImage *logo = [UIImage imageNamed:@"Logo.jpg"];
// init the UIImageView with the logo image
[self.image initWithImage:logo];
}
When iI run it iI got always get blank screen? Why? Thanks.
Upvotes: 0
Views: 1002
Reputation: 15147
Just use this in your viewDidLoad method..
image.image = logo;
This will help you definitely....
Upvotes: 2
Reputation: 4319
Did you add the file correctly to your project? Sometimes I find it tricky to add it properly. You have to clean and run your project when adding new resources (such as images in your case) for the script to recognize your resources.
Upvotes: 0