diff --git a/Waver/Source/Waver.m b/Waver/Source/Waver.m index f1d1280..84bc676 100644 --- a/Waver/Source/Waver.m +++ b/Waver/Source/Waver.m @@ -47,6 +47,12 @@ - (void)awakeFromNib [self setup]; } +- (void)removeFromSuperview +{ + [_displayLink invalidate]; + _displayLink = nil; +} + - (void)setup { self.waves = [NSMutableArray new]; @@ -121,16 +127,13 @@ - (void)updateMeters UIGraphicsBeginImageContext(self.frame.size); for(int i=0; i < self.numberOfWaves; i++) { - UIBezierPath *wavelinePath = [UIBezierPath bezierPath]; // Progress is a value between 1.0 and -0.5, determined by the current wave idx, which is used to alter the wave's amplitude. CGFloat progress = 1.0f - (CGFloat)i / self.numberOfWaves; CGFloat normedAmplitude = (1.5f * progress - 0.5f) * self.amplitude; - for(CGFloat x = 0; x