Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Array help!



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 (email@hidden)

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/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.