如何理解第一行的这个符号?我对这种实例化 NSDictionary 的方式感到困惑(缺乏经验)。这是某种铸造吗?它来自 iOS TableViewController 教程,cellForRowAtIndexPath 方法。
NSDictionary *item = (NSDictionary *)[self.content objectAtIndex:indexPath.row];
cell.textLabel.text = [item objectForKey:@"mainTitleKey"];
cell.detailTextLabel.text = [item objectForKey:@"secondaryTitleKey"];
我希望得到以下结果,它可以工作:
NSDictionary *item = [arrayContainingDictionaries objectAtIndex:indexPath.row];
cell.textLabel.text = [item objectForKey:@"mainTitleKey"];
cell.detailTextLabel.text = [item objectForKey:@"secondaryTitleKey"];