what's wrong in this Nsarray definition
I want to initialize an array of nsstrings I use the following code
@interface Modalities : UITableViewController {
NSArray * Modalities ;
NSArray* SelectedOnes ;
}
@property (nonatomic, retain) NSArray * Modalities ;
@end
- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
Modalities = [NSArray arrayWithObjects:
@"XA",
@"CT",
@"RF",
@"PR",
@"US",
@"OT",
@"SR",
@"MG",
@"MR",
开发者_运维技巧 @"NM",
@"CR" , nil];
}
it raise
error: expected unqualified-id before '=' token
any suggestion to solve that
You used the name of the Class for your field, this will cause a collision.
Change names of the field to
NSArray * modalities;
and then:
modalities = [NSArray arrayWithObjects:
@"XA",
@"CT",
@"RF",
@"PR",
@"US",
@"OT",
@"SR",
@"MG",
@"MR",
@"NM",
@"CR" , nil];
精彩评论