テーブルビューの背景として png イメージを設定しようとしています。次のコードですべて問題ありません。ただし、iPhone シミュレーターでのみです。iPhone デバイスでアプリケーションを実行しようとすると、テーブルビューの背景は白 (または透明) のままになります。背景色を設定しようとした方法に問題があると思われますか。次の方法までさまざまな方法を試しましたが、すべて同じ問題が発生します。
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.opaque = NO;
self.tableView.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBackground.png"]];
よろしくお願いします!
ベストアンサー1
以下のコードを使用してください。
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBackground.png"]];
[tempImageView setFrame:self.tableView.frame];
self.tableView.backgroundView = tempImageView;
[tempImageView release];
ありがとう、