【发布时间】:2015-08-04 06:24:25
【问题描述】:
我正在开发一个应用程序,我有一个 UITableView,我正在使用以下代码来管理重新排序:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}
-(NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath{
if(proposedDestinationIndexPath.section==0 && proposedDestinationIndexPath!=sourceIndexPath){
return proposedDestinationIndexPath;
}
else{
return sourceIndexPath;
}
}
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;
}
-(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{
//move rows
}
它工作正常,但我想更改重新排序按钮的位置并在 iOS 8.4 上实现音乐队列列表之类的东西。
我想将重新排序按钮更改为滚动视图上的单元格内容,并随单元格一起移动。 截屏:
提前致谢:)
【问题讨论】:
-
看看这些现有的线程,也许他们能帮上忙? stackoverflow.com/questions/5109250/…stackoverflow.com/questions/2313252/…
-
@GurtejSingh 谢谢,我正在为我的表格视图使用自定义单元格来管理滑动以一起删除和重新排序,但是重新排序按钮的位置与删除冲突,所以我需要更改重新排序按钮
-
您能否发布一些屏幕截图,说明您所面临的问题到底是什么?谢谢
-
@GurtejSingh 谢谢,我已经添加了屏幕截图,如果你看到,重新排序按钮和删除按钮已折叠!
-
感谢您添加屏幕截图。您能否显示如何将重新订购按钮添加到单元格中的代码?一旦您向我展示添加按钮的代码,我将能够发表评论。谢谢!
标签: ios objective-c uitableview