本篇文章主要介绍了iOS中tableview 两级cell的展开与收回的示例代码,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
由于文章内容的限制,我们接着在上文的内容展开,上文的方案中还是存在一个问题的,如果我们展开了多个section,并且展开的section不在屏幕上面,当我们滑动的时候,section再次回到屏幕的时候,展开的图标就不是再往下了,如下图所示:
//数据重新加载的时候,展开图标的重新设置
f (Title [(int)section].ExplandFlag) {
headerView.ExplandButton.SetImage (UIImage.FromBundle ("arrowD"), UIControlState.Normal);
else {
headerView.ExplandButton.SetImage (UIImage.FromBundle ("arrow"), UIControlState.Normal);
当你会发现,程序还有一些漏洞,当你在收回一些section(这些个section是从复用池操作过来的),图标缺收回不过来。如下图所示:
//标志位改变
Title[(int)section].ExplandFlag=false;
//图标的复位
UIButton explandButton=(UIButton)sender;
explandButton.SetImage (UIImage.FromBundle ("arrow"), UIControlState.Normal);
myTabViSource.ReturnRotate(explandButton);
//数据插入
int length=Title[(int)section].SecondTitle.Count;
NSIndexPath[] arrayIndexPath=new NSIndexPath[length];
for(int i=0;i<length;i++)
{
arrayIndexPath[i]=NSIndexPath.FromRowSection((nint)i,section);
}
tableview.DeleteRows(arrayIndexPath,UITableViewRowAnimation.Automatic);
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程学习网。
沃梦达教程
本文标题为:iOS中tableview 两级cell的展开与收回的示例代码
猜你喜欢
- 详解flutter engine 那些没被释放的东西 2022-12-04
- Android实现监听音量的变化 2023-03-30
- SurfaceView播放视频发送弹幕并实现滚动歌词 2023-01-02
- Android实现轮询的三种方式 2023-02-17
- Android studio实现动态背景页面 2023-05-23
- 最好用的ios数据恢复软件:PhoneRescue for Mac 2023-09-14
- iOS 对当前webView进行截屏的方法 2023-03-01
- 作为iOS开发,这道面试题你能答出来,说明你基础很OK! 2023-09-14
- Android MaterialButton使用实例详解(告别shape、selector) 2023-06-16
- Flutter实现底部和顶部导航栏 2022-08-31
