2012-01-18 17 views
0

私のテーブルビューでカスタムセルを背景画像で使用していますか?向きが変更されていないセルのサイズが変更されたとき、私は向きの変更時にカスタムセルのサイズを自動的に変更する必要があります。これをどのように達成できますか?UItableviewカスタムセルの幅を変更する

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

あなたはYESでshouldAutorotateToInterfaceOrientation方法、ノーだけリターンに確認してください

+0

uセルをxibで作成してからautoresizeを使用すると、他の賢明なフレームを設定する – Ron

答えて

1

あなたは、デリゲートに、プログラムでテーブルビューの枠を設定することができますyの場合はフレームを設定する必要があります私たちのクラスはUITableViewControllerです。

// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    // Return YES for supported orientations 
    return YES; 
} 
0

をお楽しみください

[tableView setFrame:[self.view.frame]]; 

使用することができます -