• 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
Is awakeFromNib REALLY first to run?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is awakeFromNib REALLY first to run?


  • Subject: Is awakeFromNib REALLY first to run?
  • From: email@hidden
  • Date: Fri, 29 Jun 2001 21:29:54 -0500

Hi all,

I've been playing around with Cocoa, trying to get through the Oreilly book, and I've come across something that doesn't seem right. Although the Oreilly book says that awakeFromNib is always run first. However, in this code example derived from the books Very Simple Table, it appears that numberOfRowsInTableView gets run at least a couple of times. The result is that until I manually resize my table, I can't access the other items in my table (i.e. vertical scroll is inactive).

So what am I missing (other than a complete understanding of Objective C!)?

- (void) awakeFromNib
{
int index;

myArray = [[NSMutableArray alloc] init];

for (index = 0; index < 30; ++index)
{
NSDecimalNumber *myNumber = [NSDecimalNumber numberWithInt:index];
[myArray addObject: myNumber];
[myArray retain];
}
}

- (int)numberOfRowsInTableView:(NSTableView *)tableView
{
// printf("Arraysize = %d\n", [myArray count]); // when uncommented, prints zeros in the console THEN 30
return [myArray count];
}

- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
return [myArray objectAtIndex: row];
}


Lloyd
---
Canna Software Development


  • Follow-Ups:
    • Re: Is awakeFromNib REALLY first to run?
      • From: "Dennis C. De Mars" <email@hidden>
    • Re: Is awakeFromNib REALLY first to run?
      • From: Vince DeMarco <email@hidden>
    • Re: Is awakeFromNib REALLY first to run?
      • From: Fritz Anderson <email@hidden>
    • Re: Is awakeFromNib REALLY first to run?
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: Initializing a string with an NSData
  • Next by Date: Re: Is awakeFromNib REALLY first to run?
  • Previous by thread: memory stream syntax
  • Next by thread: Re: Is awakeFromNib REALLY first to run?
  • Index(es):
    • Date
    • Thread