2011年7月20日水曜日

【メモ】UITableViewの背景に画像を利用する。

iPhoneアプリの作り方を勉強中。
UITableViewの背景に画像を使う方法がわからなくて
いろいろ挑戦してみたら、下の方法を利用するとうまくいった。

UITableVIewの背景を透明化してから背景をはめ込むイメージかんじなのかな?


- (void)viewDidLoad {
   [super viewDidLoad];

   //リストの背景透明化
   [self.tableView setBackgroundView:nil];
   [self.tableView setBackgroundView:[[[UIView alloc] init] autorelease]];
   self.tableView.backgroundColor = [UIColor clearColor];

   //背景画像指定
   UIColor *col = [[UIColor alloc] 
           initWithPatternImage:[UIImage imageNamed:@"background.jpg"]];
   [self.tableView setBackgroundColor:col];
   [col release];
}

0 件のコメント:

コメントを投稿