I'm new to Cocoa programming and brand new to this list, so I hope it's 
appropriate to ask this question here.

I've run into a showstopper with my first project on my own (i.e. not a project 
from a book). I've created a custom View subclass, and when I try to 
instantiate an array of another custom subclass, it completely fails to do so, 
but doesn't produce any meaningful errors. I can see that it's failing in the 
debugger because after stepping after the line "TileColumn 
*allColumns[boardDimension - 1]", the array remains with a member count of -1. 
In the for loop, the line "allColumns[i] = column;" doesn't produce any errors 
but doesn't change the array. I'm stumped as to what I've done wrong here. I DO 
have an instance of MMGameView in the main window.

Here's the first part of my class's m file:

#import "MMGameView.h"
#import "TileColumn.h"
#import "GameTile.h"


int boardDimension = 16;

@implementation MMGameView

-(BOOL) acceptsFirstResponder{
        return YES;     
}

- (id)initWithFrame:(NSRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code here.
                TileColumn *allColumns[boardDimension - 1];
                for (int i = 0; i < boardDimension; i++)
                {
                        TileColumn *column = [[TileColumn alloc] init];
                        allColumns[i] = column;
                }
                
                gameColumns = [NSArray arrayWithObjects:allColumns count: 
boardDimension];
        }
    return self;
}_______________________________________________

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 arch...@mail-archive.com

Reply via email to