2011-12-04 63 views
2

我已經在索引0中創建一個UITableView編程方式與3箇中的細胞部分現在,當我在該節它動畫第三小區的插入翻轉在細胞中UISwitch在索引0處。UITableViewRowAnimation具有可見缺陷

不幸的是,如下圖所示,我在UITableViewRowAnimation的最後得到了那些奇怪的行。刪除單元格動畫時也會發生同樣的情況。

http://cl.ly/0l120K091b3s0h3J1l3m

有人能告訴我如何解決這一問題?它看起來非常醜陋。

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 

NSArray *rowAtIndex2inSectionAtIndex0 = 
     [NSArray arrayWithObject: 
     [NSIndexPath indexPathForRow:2 inSection:0]]; 

if ([defaults boolForKey:@"one"] == 1 && 
    [defaults boolForKey:@"two"] == 1 && 
    numberOfRowsInSection0 == 2) 
{ 
    numberOfRowsInSection0++; 

    [self.tableView 
    insertRowsAtIndexPaths:rowAtIndex2inSectionAtIndex0 
    withRowAnimation:UITableViewRowAnimationTop]; 
} 

回答

1

檢查你正在返回的行高,並確保他們全是數字,而不是分數:在這裏當UISwitch是對被執行的代碼。

+0

你的意思是細胞行高?我沒有爲細胞設定自定義高度。 – iMaddin

+0

如何通過tableviewdelegate指定tableview行高? –

+0

因爲我沒有設置自定義高度,所以表格視圖會選擇我認爲的默認值。我希望我的桌子視圖看上去完全像蘋果的例子。 Settings.app。我唯一指定的是頁腳和頁眉高度。 – iMaddin

0

我已經找到了任意中線你提到轉變可以使用以下將其刪除: -

[self.tableView setSeparatorStyle:UITableViewCellSelectionStyleNone];