My code:

#import <Cocoa/Cocoa.h>
#import <RSTrixiePlugin/RSTrixieRule.h>

@interface RSTrixieTable : NSWindowController < NSTableViewDataSource >

@property (retain) IBOutlet NSMutableArray * rules;
@property (retain) IBOutlet NSTableView * table;

- (void) appendRule:(NSNotification*)note;

- (NSInteger) numberOfRowsInTableView:(NSTableView *)aTableView;

@end


#import "RSTrixieTable.h"

@interface RSTrixieTable ()

@end

@implementation RSTrixieTable

@synthesize rules = _rules;
@synthesize table;

- (id)init
{
    self = [super initWithWindowNibName:@"RSTrixieTable" owner:self];
    if (self) {
                NSLog(@"%s- [%04d] %@", __PRETTY_FUNCTION__, __LINE__, @"");
                
                _rules = [[NSMutableArray alloc] init];
                
        [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(appendRule:) name:nnRSTrixieStoreNewRuleNotification 
object:nil];
    }
    
    return self;
}


- (void)windowDidLoad
{
    [super windowDidLoad];
}

- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView {
        NSInteger ret = 0;
        if([_rules count]) ret = [_rules count];
        return ret;
}


- (void) appendRule:(NSNotification*)note {

        RSTrixieRule * rule = [note object];
        [_rules addObject: rule];
        [table reloadData];
        [table setNeedsDisplay:YES];
}

@end





Erik Stainsby
[email protected]
-------------------------------------
Consistently place constants on the LHS of an expression: you cannot 
accidentally assign when you meant to compare.




On 2012-02-28, at 9:50 PM, Brian Lambert wrote:

> Post your code.
> 
> On Tue, Feb 28, 2012 at 8:39 PM, Erik Stainsby <[email protected]> 
> wrote:
> Learning a new language makes me humble.
> 
> NSTableView - I have an NSTableViewDataSource with an array holding the 
> objects to be represented in the table.
> I add a new object to the array, I call [table reloadData]; and I follow that 
> with [table setNeedsDisplay:YES];
> Bupkiss. Nada.  However, when I tap a column header to resort the view, 
> presto. Content.
> 
> What am I missing ?
> 
> - (void) appendRule:(NSNotification *) note {
>        RSTrixieRule * rule = [note object];
>        [_rules addObject: rule];
>        [table reloadData];
>        [table setNeedsDisplay:YES];
> }
> 
> 
> 
> 
> Erik Stainsby
> [email protected]
> -------------------------------------
> Consistently place constants on the LHS of an expression: you cannot 
> accidentally assign when you meant to compare.
> 
> 
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/brianlambert%40gmail.com
> 
> This email sent to [email protected]
> 


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to