我知道如何解决我即将概述的问题,但是,我有点困惑的是为什么代码方案在iOS模拟器中工作但在我的iPad上不起作用.
我有一个检查各种属性的方法,然后CALayer根据属性的状态设置a的背景颜色.以下代码与我的颜色分配方法类似:
//This will be the CALayer BGColor...
CGColor c = UIColor.blueColor.CGColor; //Blue is the default
switch (myState)
{
case state_one:
c = UIColor.greenColor.CGColor;
//... more code ...
break;
case state_two:
c = UIColor.redColor.CGColor;
//... more code ...
break;
case state_three: //multiple cases are like the state_three case.
//Other code, but I don't need to assign the color. Blue works...
}
myCALayer.backgroundColor = c; //Oh-noes!!! Here we get the dreaded EXC_BAD_ACCESS on iPad
//...more code dealing with the …Run Code Online (Sandbox Code Playgroud)