Я запустил 2d игру на основе тайлов для iphone, я перейду прямо к классу, который у меня есть, и к проблеме.Сейчас у меня есть 2 класса. Плитка, таблица и основной класс. Плитка
<code>`@interface Tile : NSObject {
CCSprite *sprite;
CCSprite *outline;
int row,column;
BOOL highLight;
}</p>
<p>@property (nonatomic , retain)CCSprite *sprite;
@property (nonatomic , retain)CCSprite *outline;</p>
<p>@property (nonatomic, readonly) int row, column;
@property (nonatomic , readwrite)BOOL highLight;
-(id) initWithSpriteName: (NSString*)argSpriteName Row:(int)argRow Column:(int)argColumn Position:(CGPoint)argPosition;</p>
<p>@end`
Таблица
<code>`@interface Table : NSObject {
CCLayer *layer;
CGSize size;
NSArray *icons;
NSMutableArray *content;</p>
<p>}
@property(nonatomic, retain) NSMutableArray *content;
@property(nonatomic, retain) CCLayer *layer;
@property(nonatomic, readonly) CGSize size;
-(id) initWithTableSize:(CGSize)argSize;
-(void)render;
-(Tile *) objectAtX: (int) x Y: (int) y;
`
Класс вызова (основной)
<code>@interface HelloWorld : CCLayer
{
CGSize size;
Table *tableLayer;
}
@property (retain) Table *tableLayer;
Реализация
<code>-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init] )) {
......
tableLayer = [[Table alloc] initWithTableSize:CGSizeMake(4,7) ];
tableLayer.layer = self;
[tableLayer render];
self.isTouchEnabled = YES;
self.isAccelerometerEnabled = YES;
[self schedule:@selector(render:)];
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / 30)];</p>
<p>}
return self;
}</p>
<p>.
.
.</p>
<p>-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView: [touch view]];
CGPoint touchCorrected;
touchCorrected.x = location.x;
touchCorrected.y = 480 - location.y;
int x = (int)(touchCorrected.x/48);
int y = (int)(touchCorrected.y/48);
printf("X = %d Y = %d \n",x,y);
if (x!=0 && y!=0) {
Tile *tile = [tableLayer objectAtX:(1) Y:(1)];
[tile setHighLight:YES];
}
}</p>
<p>
Моя программа аварийно завершает работу при вызове следующего оператора внутри ответного обратного вызова
Tile *tile = [tableLayer objectAtX:(1) Y:(1)];
Я прочитал несколько блогов, но на самом деле мне сложно понять концепцию обмена сообщениями. Не могли бы вы объяснить мне, что является причиной сбоя приложения и заканчивается "objc_msgsend".