I have UIView which has the following structure:
UIView
|- layer (CALayer)
|- depthLayer (CALayer)
|- bodyLayer (CALayer)
For
The delays you see in your CALayer's frames
are cause because the
Animations -> when you making a change to the CALayer's
appearance
It tries to animate it (and it often successes -> well this is why they called animations layers).
To disable this behavior (animations) you should call the disable transactions like this:
CATransaction.setValue(kCFBooleanTrue, forKey:kCATransactionDisableActions)
//..Make Change to the frames here
CATransaction.commit()
Also I don't know wether you have a real need to override the drawRect
for this matter -> if you set the UIView's
Frame via setFrame:
method,
it is better to override the setFrame:
method itself and adjust the Frames of subLayers there.
Lot of Luck!