Note that there are some explanatory texts on larger screens.

plurals
  1. POCALayer - strange drawInContext bug
    primarykey
    data
    text
    <p>I'm currently having a very strange bug with regard to a CALayer subclass. This CALayer subclass is responsible for drawing a UI element, and is contained inside of a custom UIView class. When the UIView receives touch events, it changes the UIElementLayer's properties, causing the layer to be redrawn. </p> <p>However, the weird problem that I'm having is that occasionally the layer will freeze up. When I say freeze up, I mean that drawInContext() does not get called until the first second of the next minute. Literally every time it freezes up, I can count on it going back to normal at the :00 component of the next minute. I have tried debugging all of my functions, and I just can't find a reason why this is happening. Any ideas on what could be causing this?</p> <p>The details of that class are:</p> <pre><code>@interface UIElementLayer : CALayer @property (nonatomic) CGFloat beginningValue; @property (nonatomic) CGFloat endingValue; @property (nonatomic) BOOL shouldReset; @end @implementation UIElementLayer @dynamic beginningValue, endingValue, shouldReset; - (id)initWithLayer:(id)layer { if (self = [super initWithLayer:layer]) { if ([layer isKindOfClass:[UIElement class]]) { UIElement *element = (UIElement *)layer; self.shouldReset = element.shouldReset; self.startingValue = element.startingValue; self.endingValue = element.endingValue; } } return self; } + (BOOL)needsDisplayForKey:(NSString *)key { if ([key isEqualToString:@"startingValue"] || [key isEqualToString:@"endingValue"] || [key isEqualToString:@"shouldReset"]) { return YES; } return [super needsDisplayForKey:key]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload