Array help!
Array help!
- Subject: Array help!
- From: Eric Lee <email@hidden>
- Date: Thu, 17 Jul 2008 15:50:38 -0500
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:
This email sent to email@hidden