在編輯,調整大小或正確移動標籤和圖像時,如何縮進我的CUSTOM CELL?編輯時縮進UITableViewCell
我用:
- (BOOL) tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
沒有影響。
有什麼想法?
在編輯,調整大小或正確移動標籤和圖像時,如何縮進我的CUSTOM CELL?編輯時縮進UITableViewCell
我用:
- (BOOL) tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
沒有影響。
有什麼想法?
解決了動畫的所有組件以這種方式(改變frame.origin.x
):
- (BOOL) tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.3];
[cell.CellTitle setFrame:cgrectMake(x+20, y, w, h)]; // +x
[...]
[cell.CellAddress setFrame:f2];
[UIView commitAnimations];
return YES;
}
上編輯/保存動畫「縮進」控制左側或右側。
謝謝
我不知道我是否理解你的問題,但是如果你希望你的單元格內容在編輯模式下進行切換時正確縮進,那麼你應該把所有的單元格子視圖放在UITableViewCell contentView中,這是討論:
UITableViewCell對象的內容視圖是由單元顯示的內容的默認超級視圖 。如果要通過 簡單添加其他視圖來自定義單元格,則應將它們添加到內容 視圖中,以便在單元格轉換爲 進入和退出編輯模式時它們將被正確定位。
如果您正確設置了自動調整大小的掩碼,那麼所有大小調整都應該正確。
雖然這可能會工作,我會去與jbat100的解決方案,並避免完全寫這個代碼。 – nmdias