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

■UIViewに背景色を設定
[objc]
– (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithRed:0.3f
green:0.5f
blue:0.8f
alpha:1.0f];
}
[/objc]

■UIViewに背景画像を設定
[objc]
– (void)viewDidLoad
{
[super viewDidLoad];
UIImage *backGroundImage = [UIImage imageNamed:@"backgroundImg"];
self.view.backgroundColor = [UIColor colorWithPatternImage:backGroundImage];
}
[/objc]

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

This entry was posted in Objective-C, 技術情報. Bookmark the permalink.

コメントを残す

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