2012-08-28 30 views
0

我有一個表格視圖,我想在某個位置插入一個新行。我已經這樣做了,但它給了意想不到的輸出。我在這裏做錯了什麼?在位置插入一行UITableView

NSIndexPath *indexpath = [NSIndexPath indexPathForRow:position inSection:0]; 

NSArray *temp_array = [[NSArray alloc] initWithObjects:indexpath, nil]; 

[self.table insertRowsAtIndexPaths:temp_array withRowAnimation:UITableViewRowAnimationBottom]; 

我需要做任何事情比這更。這是我正在做一個單獨的函數(insert_at_position :) 任何幫助表示讚賞...

+0

你得到什麼意想不到的結果? –

+0

Pandey-許多行都是白色的,這裏和那裏有一些行存在。 – Newbee

+0

您可以從以下鏈接獲得幫助: http://stackoverflow.com/questions/1470898/using-insert-rows-in-a-uitableview –

回答

1

試試這個

[self.table beginUpdates]; 
[self.table insertRowsAtIndexPaths:temp_array withRowAnimation:UITableViewRowAnimationBottom]; 
[self.table endUpdates];