Executing this code:
mainLyr = [[CALayer layer] retain]; [mainLyr setFrame:CGRectMake(0.0,0.0,23.0,23.0)];
in debugger, I found that after retain, the reference count of mainLyr is 2. This is correct.
But after setFrame, the reference count increased to 3. Why? And how to find out if a method will increase or decrease the reference count (can not find that in reference manual).
As has been said many times on stackoverflow, don’t rely on the refcount for your memory management. Follow the memory management rules and you’ll do just fine.