-[CALayer release]: message sent to deallocated instance

后端 未结 2 1214
-上瘾入骨i
-上瘾入骨i 2020-12-10 09:40

I\'m having a problem with some code in the loadView: method of one of my view controllers. Essentially I have a view which centres itself in a larger view (on an iPad) and

2条回答
  •  暖寄归人
    2020-12-10 10:08

    The over-releasing could be occurring during the objects life time and not just when they're being created. A few tips:

    • use accessors to ensure that pointers are set to nil
    • be consistent with your use of release/autorelease. Personally I prefer to have [[[Class alloc] init] autorelease] all on 1 line.
    • Learn the difference between release/autorelease. Let's Build NSAutoreleasePool is a good place to start.

提交回复
热议问题