views:

19

answers:

1

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 842x595 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 :(

+1  A: 

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 :

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIImage *image = [UIImage imageNamed:@"LASketch.png"];
    imageView = [[UIImageView alloc] initWithImage:image];

    [self.view addSubview:imageView];
    [(UIScrollView*)self.view setContentSize:[image size]];
}

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.

jv42
Oh and last thing: it is an iPhone app, not a iPad app, I don't know if it is intentional...
jv42
argh! i looked at that a hundred times! sometimes it's easier with fresh eyes i suppose! thanks for the tip with calling super though! i figured it might have been a graphics issue as the virtual machines graphics isn't too good. i'd like to be able to run vdmx but it just crashes out :( i'll edit this tomorrow morning and come back and verify your answer but im pretty sure it will work! thanks again for your help, legend.
iamneuron
the ipad thing was from the tutorial im following where the image was an ipad but thanks!
iamneuron