2011-07-26 26 views
0

我在表格視圖中有一個客戶列表,我的應用程序支持方向,我將根據方向添加到表格單元格中更改按鈕的框架。但是這些更改沒有正確執行,當我導航到另一個視圖時會看到更改,並且我返回。但不是即刻。在iphone sdk中更改方向時加載表中的問題?

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 

if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) { 

    isLandscape = YES; 
    myTableView.frame = CGRectMake(0, 0, 1024, 768); 
    labelTitle.frame = CGRectMake(500, 120, 300, 30); 
    accessoryBtnImageView.frame = CGRectMake(870, 46, 58, 58); 
} 

else 
{ 
    isLandscape = NO; 
    myTableView.frame = CGRectMake(0, 0, 768,1024); 

    labelTitle.frame = CGRectMake(350, 120, 300, 30); 
    accessoryBtnImageView.frame = CGRectMake(600, 66, 58, 58); 
} 

return YES;  
} 

我在viewWillAppear(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath方法使用該編碼也但還是我得到的問題,我覺得我做了一些錯誤的地方。請任何人幫助我。 謝謝 Praveena

回答

0

您應該在視圖上使用autoresizingMask屬性,而不是手動調整它們的大小。

根據您設置的大小調整面膜,可以讓意見固守一方,當設備旋轉與超圖擴大等

documentation介紹如何做到這一點的詳細信息。