2014-02-22 86 views
0

我已經實現了一些專門的表格編輯,刪除,但是當UITableViewCell子類進入編輯模式時,它不會「移動」單元的內容。UITableViewCell在進入編輯模式時不滾動內容

過去,我在將子視圖添加到單元格而不是contentView時遇到過這種情況,但在這種情況下,所有子視圖確實都在單元格的contentView上。

這是一個在界面構建器中創建的單元格。

任何人都知道這個問題的解決方法?

謝謝!

下面是相關遞歸描述:

| | | | | | | | | <DDPaymentCardCell: 0x125e6c690; baseClass = UITableViewCell; frame = (0 35; 320 44); autoresize = W; gestureRecognizers = <NSArray: 0x17805b660>; layer = <CALayer: 0x1782240e0>> 
    | | | | | | | | | | <UITableViewCellScrollView: 0x125e6c990; frame = (0 0; 320 44); autoresize = W+H; gestureRecognizers = <NSArray: 0x178241920>; layer = <CALayer: 0x17822a4c0>; contentOffset: {82, 0}> 
    | | | | | | | | | | | <UITableViewCellDeleteConfirmationView: 0x1781ac400; frame = (320 0; 82 44); layer = <CALayer: 0x17803dd40>> 
    | | | | | | | | | | | | <UITableViewCellDeleteConfirmationButton: 0x125e50f30; frame = (0 0; 82 43.5); opaque = NO; autoresize = LM; layer = <CALayer: 0x17803dec0>> 
    | | | | | | | | | | | | | <UILabel: 0x125e32880; frame = (15 11; 52 22); text = 'Delete'; userInteractionEnabled = NO; layer = <CALayer: 0x17822ce20>> 
    | | | | | | | | | | | <UITableViewCellContentView: 0x178174c40; frame = (38 0; 282 43.5); opaque = NO; gestureRecognizers = <NSArray: 0x178240180>; layer = <CALayer: 0x17822c840>> 
    | | | | | | | | | | | | <UILabel: 0x125e3cb40; frame = (100 11; 227 21); text = 'Ending in 4242'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x17803fe00>> 
    | | | | | | | | | | | | <UIImageView: 0x125e19620; frame = (61 12; 32 20); opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x1782256a0>> 
    | | | | | | | | | | | | <UILabel: 0x125e55e90; frame = (248 11; 86 21); text = 'Exp 4/2024'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x178229740>> 
    | | | | | | | | | | | <_UITableViewCellSeparatorView: 0x178191100; frame = (82 43.5; 320 0.5); layer = <CALayer: 0x17822bd20>> 
    | | | | | | | | | | | <_UITableViewCellSeparatorView: 0x170190b50; frame = (82 0; 320 0.5); layer = <CALayer: 0x170236e00>> 
    | | | | | | | | | | | <UITableViewCellEditControl: 0x125d2f370; frame = (0 0; 47 44); opaque = NO; layer = <CALayer: 0x17023d360>> 
    | | | | | | | | | | | | <UIImageView: 0x125d31640; frame = (12 14; 22 22); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x170232300>> 
    | | | | | | | | | | | | <UIImageView: 0x125d20c20; frame = (12 12; 22 22); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x17023acc0>> 
+0

一些代碼

[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.priceLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-kCellRightMargin]]; 

Eveything將工作/截圖將是很好。並且在crapshoot中,您是否添加了自動佈局約束/自動調整掩碼? – Can

+0

@Can Autolayout約束也應該是針對內容視圖,所以理論上不應該是這樣的問題。 –

+0

Sean,你可以輸入編輯,重現bug,點擊暫停,併發布'po [[UIApplication sharedApplication] .keyWindow recursiveDescription]'的調試輸出。謝謝 –

回答

0

對於它的價值,答案是要確保你能正確地使用自動版式。如果添加約束:根據需要

相關問題