Merge pull request #42 from jwilling/fix-tablecellview

Modify NSTableCellView a bit.
This commit is contained in:
Justin Spahr-Summers 2012-10-25 18:41:10 -07:00
Родитель 5ed7ec3bd9 959d726b32
Коммит 65cdfe4454
3 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -13,9 +13,12 @@
// Useful to clear properties and bindings before reuse. // Useful to clear properties and bindings before reuse.
@interface RBLTableCellView : NSTableCellView @interface RBLTableCellView : NSTableCellView
// Called immediately before the cell view is going to be added
// to a new table row view. At the time this is called, the cell // Called when the cell view has either been removed from
// view will not have a superview. // its superview (the row view), or has just been created.
//
// Either way, the cell will not have a superview during this
// time and will be in an enqueued state.
- (void)prepareForReuse; - (void)prepareForReuse;
@end @end

Просмотреть файл

@ -10,12 +10,12 @@
@implementation RBLTableCellView @implementation RBLTableCellView
- (void)viewWillMoveToSuperview:(NSView *)newSuperview { - (void)viewDidMoveToSuperview {
[super viewWillMoveToSuperview:newSuperview]; if (self.superview == nil) {
if (self.superview == nil && newSuperview != nil) {
[self prepareForReuse]; [self prepareForReuse];
} }
[super viewDidMoveToSuperview];
} }
- (void)prepareForReuse { - (void)prepareForReuse {

Просмотреть файл

@ -15,3 +15,4 @@
#import <Rebel/RBLView.h> #import <Rebel/RBLView.h>
#import <Rebel/CAAnimation+RBLBlockAdditions.h> #import <Rebel/CAAnimation+RBLBlockAdditions.h>
#import <Rebel/RBLPopover.h> #import <Rebel/RBLPopover.h>
#import <Rebel/RBLTableCellView.h>