Skip to content

Commit

Permalink
Use the runtime, luke
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Zielenski committed Apr 30, 2012
1 parent 3e16741 commit a49a1bd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ZKRevealingTableViewCell/ZKRevealingTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
#import "ZKRevealingTableViewCell.h"
#import <QuartzCore/QuartzCore.h>

@interface ZKRevealingTableViewCell () {
BOOL _revealing;
ZKRevealingTableViewCellDirection _direction;
}
@interface ZKRevealingTableViewCell ()

@property (nonatomic, retain) UIPanGestureRecognizer *_panGesture;
@property (nonatomic, assign) CGFloat _initialTouchPositionX;
Expand Down Expand Up @@ -112,17 +109,20 @@ - (void)layoutSubviews
}

#pragma mark - Accessors
#import <objc/runtime.h>

static char BOOLRevealing;

- (BOOL)isRevealing
{
return _revealing;
return [(NSNumber *)objc_getAssociatedObject(self, &BOOLRevealing) boolValue];
}

- (void)setRevealing:(BOOL)revealing
{
// Don't change the value if its already that value.
// Reveal unless the delegate says no
if (revealing == _revealing ||
if (revealing == self.revealing ||
(revealing && self._shouldReveal))
return;

Expand All @@ -137,7 +137,7 @@ - (void)setRevealing:(BOOL)revealing
- (void)_setRevealing:(BOOL)revealing
{
[self willChangeValueForKey:@"isRevealing"];
_revealing = revealing;
objc_setAssociatedObject(self, &BOOLRevealing, [NSNumber numberWithBool:revealing], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
[self didChangeValueForKey:@"isRevealing"];

if (self.isRevealing && [self.delegate respondsToSelector:@selector(cellDidReveal:)])
Expand Down

0 comments on commit a49a1bd

Please sign in to comment.