2010-12-08 89 views

回答

3

一個UIViewController有一個-setEditing:animated:方法,您可以覆蓋。在這種方法中,您可以撥打-setRightBarButtonItem-setLeftBarButtonItem。你可以看看UITableViewDataSource。有一種方法叫做-tableView:moveRowAtIndexPath:toIndexPath

編輯:如果要在UITableViewCell中輸入文本,則必須在-tableView:cellForRowAtIndexPath:中放置一個UITextField。看看here

+0

乾杯的幫助隊友! – 2010-12-12 17:36:52

+0

很高興我能幫到你。請使用勾號將其標記爲正確答案,以便其他人也可以看到它。 – fabian789 2010-12-12 17:41:24

3

要在左側創建一個Cancel按鈕,請執行setEditing:animated:方法並在其中放置以下內容。

self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelEdit:)] autorelease]; 

,並添加一個按鈕Save

self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(SaveEdit:)] autorelease]; 

確保您實現cancelEdit:saveEdit:

1

要兩個答案,我要補充以下內容:

要刪除添加的按鈕,設置right/leftBarButtonItemnil

相關問題