This is pretty simple but I cannot figure it out. I am trying to display an image which you can simply slide around the screen. For some reason however, i’m simply getting a white background.
header
#import <UIKit/UIKit.h>
@interface ScrolliPadViewController : UIViewController {
UIImageView *imageView;
}
@end
main
@implementation ScrolliPadViewController
- (void)viewDidload{
UIImage *image = [UIImage imageNamed:@"LASketch.png"];
imageView = [[UIImageView alloc] initWithImage:image];
[self.view addSubview:imageView];
[(UIScrollView*)self.view setContentSize:[image size]];
}
imageView is released also.
The image is 983kb 842×595 and 72dpi
I’m running the latest 4.1SDK however I am running OSX 10.6.3 virtualised via VMWare
Could this be an issue?
Project files available here > http://www.mediafire.com/?74c5xd0q50tw1
The code compiles fine and the image reference is right. Could someone compile the source code and see if it displays for them as i’m pretty sure the code is right, i’m just afraid that it’s due to the simulation being on a virtual machine 🙁
Downloaded, not working (white screen).
The execution never enters
viewDidLoadin your ViewController.EDIT: Found it…
Because of a spelling mistake. You rewrote viewDidLoad instead of using the one from Xcode’s template, and you mispelt viewDidload. Missing uppercase L. Fixed method below :
Please note, it’s advised to always call
[super ...]in your view controller’s methods, first thing (except for dealloc, where it’s last). I’ve encountered nasty bugs due to that.