2012-06-12 45 views

回答

1

您是否嘗試過在視圖上設置自動調整大小的遮罩?

theView.autoresizingMask = UIViewAutoresizingNone; 

您可能需要設置它的內容視圖和/或圖像視圖 - 這不是清楚你的視圖層次究竟是如何構成的。但是,框架可能會被框架顯式設置(而不是自動調整大小),在這種情況下,這將不起作用。

如果你想對整個表格單元格的背景圖像,你可能也想嘗試另一種方法,它是這樣設置單元格的backgroundColor

UIImage* someImage = [UIImage imageNamed:@"someImage"]; 
cell.backgroundColor = [UIColor colorWithPatternImage:someImage]; 

記住要確定您放置在裏面的所有其他視圖的backgroundColor都是[UIColor clearColor],這樣您就可以看到背景圖片。

+0

不知道該功能是否工作,當我進入編輯模式時,內容視圖的框架和邊界改變(寬度減小)。 – kukushkin

0

你可以隨時與indexpath一個tableviewcell。使用tableviewcell重用標識符,可以避免調整tableview單元格內容的大小。我需要實現類似的功能以避免調整單獨的單元格。 PFB的代碼。

-(BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath{ 

BOOL shouldIndentWhileEditingRow = NO; 

UITableViewCell *lTableViewCell = [tableView cellForRowAtIndexPath:indexPath]; 

/*Change the position of the target rect based on Sending messages or Receiving messages*/ 
if ([lTableViewCell.reuseIdentifier isEqualToString:@"SendingChatCellIdentifier"]) { 

    shouldIndentWhileEditingRow = NO; 

}else if ([lTableViewCell.reuseIdentifier isEqualToString:@"ReceivingChatCellIdentifier"]){ 

    shouldIndentWhileEditingRow = YES; 
} 

return shouldIndentWhileEditingRow; 
} 
相關問題