• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Array help!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Array help!
      • From: Andy Lee <email@hidden>
    • Re: Array help!
      • From: Bob Warwick <email@hidden>
    • Re: Array help!
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: Inverse Regex Library?
  • Next by Date: Re: Array help!
  • Previous by thread: Re: Auxiliary Data with NSPersistentDocument
  • Next by thread: Re: Array help!
  • Index(es):
    • Date
    • Thread