我有一个数组,它将一组字符串传递给tableViewController,然后传递给detailViewController。我希望能够在最终的detailViewController上更改所选数组的属性。在最后的detailViewController上我有:
NSDictionary *redAttrs = @{NSForegroundColorAttributeName:[UIColor redColor]};
NSDictionary *greenAttrs = @{NSForegroundColorAttributeName:[UIColor greenColor]};
[_WhatString setAttributes:redAttrs range:NSMakeRange(6, 5)];
[_WhatString setAttributes:greenAttrs range:NSMakeRange(20, 5)];
_WhatString = _DetailModal[2];
_WhatLabel.attributedText = _WhatString;
其中_DetailModal
是数组,特定数组项(我想编辑的字符串)位于[2]
位置。每个数组项的编辑都是相同的,所以我不需要担心动态更改它。这个代码应该在最终的detailViewController上,还是应该在我第一次声明和指定数组时实现?
这是正确的方法吗? 当我尝试加载detailViewController页面时,我发现'无法识别的选择器发送到实例' 错误。会导致这种情况的原因是什么?