UIView の背景色/背景画像を設定する

2014年5月3日 Posted by PURGE

■UIViewに背景色を設定

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:0.3f
                                                green:0.5f
                                                 blue:0.8f
                                                alpha:1.0f];
}

■UIViewに背景画像を設定

- (void)viewDidLoad
{
    [super viewDidLoad];
    UIImage *backGroundImage = [UIImage imageNamed:@"backgroundImg"];
    self.view.backgroundColor = [UIColor colorWithPatternImage:backGroundImage];
}

ちなみに、backgroundImg の画像名は、Images.xcassets で読み込んだ画像です。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です