我试过几种方法,但似乎我错过了一些东西......
这是我使用的代码:
- (void)configureView
{
// Update the user interface for the detail item.
if (self.detailItem) {
for (int idx=0; idx<16; idx++) {
NSIndexPath *indexPath = [[NSIndexPath alloc] initWithIndex:idx];
[self.tableView cellForRowAtIndexPath:indexPath].detailTextLabel.text = [param objectAtIndex:idx];
}
self.detailDescriptionLabel.text = [self.detailItem description];
}
}
Run Code Online (Sandbox Code Playgroud)
我在viewDidLoad上调用它.我的tableview有16个静态单元格,我正在使用标准的"Subtitle"类型单元格,所以在这方面不需要定制.textLabel.text在设计时填充.我的tableview也在tableViewController中.我也试过了tableview的标准群体,但似乎静态细胞不同意这种方式.
我究竟做错了什么?
@jrturton我做了一些修改,看看发生了什么:
我补充下这三条线的线,看看是否有什么事有:
UITableView *tv = self.tableView;
UITableViewCell *cell = [tv cellForRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:0]];
NSString *label = [[NSString alloc] initWithString:cell.textLabel.text];
Run Code Online (Sandbox Code Playgroud)
首先,电视是正确分配的,我可以看到.但除了那个细胞和标签之外,它是空的.甚至电视似乎没有行信息..
可能是因为tableview将数据源和委托分配给tableviewcontroller ..我想我听说它应该不是那样的东西......
@jrturton这是:



希望这可以帮助.
我想将此数据声明为C#的数组:
file1: data1 [rect1] , data2 [rect2] , data3 [rect3]
file2: data1 [rect1] , data2 [rect2]
file3: data1 [rect1] , data2 [rect2] , data3 [rect3], data4 [rect4]
...
Run Code Online (Sandbox Code Playgroud)
文件和数据是字符串,rect是Rectangle对象
它不一定是一个数组,但我认为数组将是最好的解决方案.
我需要访问存储在数组中的数据.
例如,当我给"file1"时,我应该能够读取所有dataX ..
另外,当我给"file1"和"data1"时,我应该能够访问"rect1"..
你能解释我怎么做吗?