[[self.view viewWithTag:thisTag].layer setTextColor:[UIColor redColor]];
这行不通。
我假设你没有收到错误消息;否则你可能会发布它。所以我假设如下:
thisTag
是视图层次结构中不存在的标记。在这种情况下,viewWithTag:
将返回nil
。然后你layer
发送消息,然后setTextColor:
nil
,这什么也不做。
如果viewWithTag:
将返回一个UIView
对象,您将获取其layer
属性,然后将其发送到setTextColor:
,这不是为CALayer
对象定义的,因此会给您一条错误消息。