问题标签 [nsindexpath]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2826 浏览

iphone - Is it possible to get array of all index paths for the cells in a UITableView?

Is there a simple way to get array of all index paths for the cells in a UITableView?

0 投票
2 回答
1940 浏览

iphone - Converting between unique NSIndexPath and unique NSUInteger (or int)

Is there a better way than what is proposed here to create a one-to-one mapping between an table view cell's NSIndexPath and a unique NSUInteger or int, in order to create a unique tag property value for a widget in the cell (a UIProgressView)?

The link adds methods through a UIKit category extension that converts between NSIndexPath and int, but they only work for less than a certain number of rows.

Granted, I may not run into that limit, but I'm wondering if there is a mapping that someone has come up with that can be guaranteed to work for any number of rows.

0 投票
2 回答
2470 浏览

objective-c - Obj-C 中的 NSIndexPath 警告

我在创建 NSIndexPath 时收到警告,

warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness

警告是由于什么原因??如何让它发挥作用?

谢谢

0 投票
4 回答
201028 浏览

ios - 如何为 TableView 创建 NSIndexPath

我需要在我定义的函数中删除表的第 1 行。为了使用deleteRowAtIndexPath,您必须使用IndexPath定义了节和行的 an。如何创建这样的索引路径?

以 int {1} 作为唯一成员的数组将崩溃;NSLog 消息指出该部分也需要定义。

*编辑->与单元格删除相关的代码:

0 投票
3 回答
607 浏览

iphone - 如何在向下钻取 UITableViewController 结构中恢复用户位置?

我有一个 CoreData 模型,其中包含可以再次包含 childLevels 的 Levels。

我用UITableViewController列出所有 childLevels 来表示每个级别。当用户点击一行时,一个新UITableViewController的被推送到navigationController. 这里没问题。

我将如何在此表结构中存储用户位置。是否有这样做的最佳实践?如果结构的深度是已知的,我这样做是没有问题的,但不知何故不知道如何以未定义的深度来处理这个问题。

我应该NSIndexPath将用户点击的数据存储到一个数组中并将其写入磁盘吗?

0 投票
2 回答
303 浏览

objective-c - 根据部分自定义 TableviewCell

如何UITableViewCell根据他们所在的部分自定义 a 的背景图像?例如,在第一节中,单元格应该有一个绿色的 .png 图像作为背景图像,而在第二节中,单元格应该有一个红色的 .png 图像作为背景。

0 投票
8 回答
128791 浏览

iphone - 如何通过 indexPath 获取 uitableViewCell?

我怎样才能得到UITableViewCell一个indexPath?像这样:

我使用UIActionSheet,当我单击确认时,UIButton我想更改单元格文本。

我定义为属性的 nowIndex

0 投票
4 回答
30634 浏览

iphone - UITableView 单元格索引路径

谁能告诉我如何获得单元格 IndexPath?我将 IndexPath 保存在 tableView: cellForRowAtIndexPath: 方法中,但这仅在查看单元格时加载,我需要在 viewDidLoad 方法上知道它的索引路径。这导致了一个空值,因为正如我所说,它只在单元格被查看一次后才加载它的值。

谢谢你。

编辑

目的是能够跳转到具有特定编号但与部分和行数不成线性关系的特定单元格。

0 投票
1 回答
6273 浏览

iphone - containsObject - 为什么这不起作用?

我有一个数组,我正在尝试检查 indexPath(.row) 是否存在。

我使用这段代码:

该数组由数字 3、8 和 2 组成。索引路径在循环中加载从 0 到 8 的数字。

谁能明白为什么这不起作用?

0 投票
2 回答
4361 浏览

iphone - 数组,找到具有值的对象并获取其 indexPath

我试图NSMutableArray从它的值中找到一个项目,只是为了找到它的 indexPath。

我完全不知道如何做到这一点,因为我对编程很陌生。

谢谢!