2010-12-08 96 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

相关问题