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学习应用开发就业课_010:定时器和视图移动
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程4
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程2
- IOS开发学习笔记(六)——多视图应用程序之StoryBoard实践
- iOS开发学习笔记 (一)表视图基础 Table Views
- IOS学习笔记(十一)之IOS开发之表视图(UITableView)的基本介绍(一)
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程4
- ios开发学习--文字视图(Text)效果源码分享--系列教程
- 移动开发:iOS学习之 编译错误汇总
- iOS开发学习笔记 -- (三)动态创建视图
- 2011年冬斯坦福大学公开课 iOS应用开发教程学习笔记(第四课) Views 视图
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程1
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程2
- 2011年冬斯坦福大学公开课 iOS应用开发教程学习笔记(第四课) Views 视图
- IOS开发基础教程学习笔记3 使用Tab Bar切换视图
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程1
- ios开发学习--视图切换(View Transition)效果源码分享--系列教程
- ios开发学习--视图切换(View Transition)效果源码分享--系列教程
- IOS学习笔记(十一)之IOS开发之表视图(UITableView)的基本介绍(一) 推荐
- Cocoa Touch 入门记——《精通 iOS 开发》学习心得(3) [标签栏实现多视图的方法(运用 xib)]