I keep reading that dot syntax is possible but I keep getting errors that the struct does not contain members I am referencing. Perhaps its not the dot syntax so I have included details of what I am doing in hopes of a solution:
// MobRec.h - used as the objects in the MobInfo array
#import <Foundation/Foundation.h>
@interface MobRec : NSObject {
@public NSString *mName;
@public int mSpeed;
}
@property (nonatomic, retain) NSString *mName;
@property (nonatomic) int mSpeed;
// MobDefs.h - array of MobRecords
@interface Mobdefs : NSObject {
@public NSMutableArray *mobInfo;
}
@property(assign) NSMutableArray *mobInfo; // is this the right property?
-(void) initMobTable;
@end
// MobDefs.m
#import "Mobdefs.h"
#import "Mobrec.h"
@implementation Mobdefs
@synthesize mobInfo;
-(void) initMobTable
{
// if I use traditional method I get may not respond
[mobInfo objectAtIndex:0 setmName: @"doug"];
// if I use dot syntax I get struct has no member named mName
mobInfo[1].MName = @"eric";
}
// main.h
MobDefs *mobdef;
// main.m
mobdef = [[Mobdefs alloc] init];
[mobdef initMobTable];
although both methods should work I get erros on both. What am I doing wrong? My best thoughts have been that I am using the wrong @property but I think I have tried all. I am performing alloc in main. Ideally I would like to for this use dot syntax and cant see why its not allowing it.