Objective-C (iOS): 画像を画面に表示

iOSシミュレータのスクリーンショット 2013.01.03 11.27.40

Objective-C: UIImageViewController.h

#import <UIKit/UIKit.h>

@interface UIImageViewController : UIViewController

@end

Objective-C: UIImageViewController.m

#import "UIImageViewController.h"

@interface UIImageViewController ()

@end

@implementation UIImageViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIImage *image = [UIImage imageNamed:@"sample"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    [self.view addSubview:imageView];
}

@end