From a quick glance, I'd say you've connected your tableview outlet to the scrollview in Interface Builder, not the tableview. Tableviews are contained within scrollviews. You can confirm by checking what the outlet's connected to under the 'outlets' tab of the info panel in IB.

-Bob Warwick

On 17-Jul-08, at 5:50 PM, Eric Lee wrote:

I'm doing Challenge from Chapter 6 in the 3rd edition of the Cocoa Programming for mac OS X book, and I've ran into some trouble.

While I'm trying to reload data, there's always this warning the says:

Warning: 'NSScrollView' may not respond to '-reloadData' (Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments)

I have no idea what it means, and no idea how to correct it.

here's the code:

App Controller.m

-----------------------------------------

#import "AppController.h"


@implementation AppController

- (id) init
{
        [super init];
        array = [[NSMutableArray alloc] init];
        
        return self;
}

- (NSInteger)numberOfRowsInTableView:aTableView
{
        return [array count];
}

- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
                        row:(NSInteger)rowIndex
{
        return [array objectAtIndex:rowIndex];
}

- (void)tableView:(NSTableView *)anotherTableView
setObjectValue:(id)anObject
forTableColumn:(NSTableColumn *)anotherTableColumn
                          row:(NSInteger)rowIndex
{
        [array replaceObjectAtIndex:rowIndex withObject:anObject];
}

- (IBAction)addThing:(id) sender
{
        NSString *string = [textField stringValue];
        NSLog(@"Got string %@ from textfield", string);
        
        [array addObject:string];
        [tableView reloadData];
}

@end

AppController.h
----------------------------------

#import <Cocoa/Cocoa.h>


@interface AppController : NSObject {
        NSMutableArray *array;
        IBOutlet NSTextField *textField;
        IBOutlet NSScrollView *tableView;
}

- (IBAction)addThing:(id)sender;

@end
-------

I've connected everything. Also, I think there are other problems, since when I press a button that's supposed to add an object into the TableView, nothing happens, even though a log appears on the console.

Thanks!
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/warwick%40codehackers.net

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to