您的位置:首页 > 移动开发 > IOS开发

iOS开发学习之#表视图#(3)移动行

2014-12-01 16:36 225 查看
继续上篇接下来介绍移动行:移动行我们用- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
(UITableView *)tableView用来指定表视图,(NSIndexPath *)sourceIndexPath用来指定要移动行的索引路径,(NSIndexPath *)destinationIndexPath用来指定行移动到目标位置的索引路径
核心代码:
<pre name="code" class="objc">//移动行- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{NSInteger fromRow = [sourceIndexPath row];NSInteger toRow = [destinationIndexPath row];id object = [a objectAtIndex:fromRow];[a removeObjectAtIndex:fromRow];[a insertObject:object atIndex:toRow];}

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS 表视图 移动行
相关文章推荐