我的问题是关于删除UITableView中的“不可见”行。当我说“不可见”时,是指屏幕上未显示的行。例如,通过调用UITableView方法未返回的所有行- (NSArray *)visibleCells。
我问这个问题是因为我正在开发“可扩展” UITableView。有点像一棵树。您可以有一个这样的表:
当您单击"Menu 1"单元格时"Menu 1.1",它们"Menu 1.2"将出现或消失。我可以通过简单地插入或删除带有动画的单元格来实现。
问题是,如果菜单较长且用户滚动,则例如“菜单1”中的一半行被隐藏(不可见,不显示在屏幕上,仅当向下滚动时可见),并且用户想要减少“菜单1”,这将导致我的应用程序崩溃,因为我试图删除不可见的行。
实际的错误信息是:
*由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'无效的更新:第0节中的行数无效。更新(11)之后现有节中包含的行数必须等于该段中包含的行数更新前的那个部分(15),加上或减去从该部分中插入或删除的行数(插入0,删除0)和加上或减去移入或移出该部分的行数(移入0,移入0)搬出去)。'
如果我对所有可见行执行完全相同的操作,则该应用程序和菜单均不会出现问题。
我最近将blueimp JS gallery与我的angular 2(运行angular-cli)应用程序集成在一起.我通过NPM(npm install blueimp-gallery --save)安装它并通过.angular-cli.json以下方式导入:
"styles": [
"../node_modules/blueimp-gallery/css/blueimp-gallery.css",
"../node_modules/blueimp-gallery/css/blueimp-gallery-indicator.css"
],
"scripts": [
"../node_modules/blueimp-gallery/js/blueimp-helper.js",
"../node_modules/blueimp-gallery/js/blueimp-gallery.js",
"../node_modules/blueimp-gallery/js/blueimp-gallery-indicator.js"
]
Run Code Online (Sandbox Code Playgroud)
从那里,我在角度组件中使用它:
//from .angular-cli.json
declare const blueimp: any;
public show(event: any, images: any[]) {
const options = {
event: event || window.event,
};
blueimp.Gallery(images, options);
};
Run Code Online (Sandbox Code Playgroud)
到目前为止,这么好:它工作正常,我可以使用画廊.但是,我最近收到了移动设备客户的崩溃报告.我想打开一个github问题,但似乎在blueimp/Gallery github repo上是不可能的.
这是一个在Android设备上看到很多的崩溃:
TypeError: Cannot read property 'style' of undefined
at Gallery.translate (eval at P+fo.t.exports (/scripts.46c7e72cc98882b84ae5.bundle.js:1:18074), <anonymous>:492:37)
at Gallery.translateX (eval at P+fo.t.exports (/scripts.46c7e72cc98882b84ae5.bundle.js:1:18074), <anonymous>:501:12)
at Gallery.move (eval at P+fo.t.exports …Run Code Online (Sandbox Code Playgroud) angular ×1
blueimp ×1
ios ×1
javascript ×1
mobile ×1
objective-c ×1
typescript ×1
uitableview ×1