【发布时间】:2012-01-12 09:58:27
【问题描述】:
我有一个功能
-(void) generateLevelFromPlist:(int)currentLevel{
NSString *mainPath = [[NSBundle mainBundle] bundlePath];
itemPositionPlistLocation = [mainPath stringByAppendingPathComponent:@"levelconfig.plist"];
NSDictionary * itemPositions = [[NSDictionary alloc] initWithContentsOfFile:itemPositionPlistLocation];
NSNumber *xVal = [[[[itemPositions objectForKey:@"level + STRING/NUMBER"]objectForKey:@"hexposition"]objectForKey:@"hexagon1"]objectForKey:@"xVal"];
int generatedXVal = [xVal integerValue];
NSLog(@"%d", generatedXVal);
NSLog(@"%@", itemPositionPlistLocation);
}
我想将变量 currentLevel 添加到字符串“level”中,如objectForKey:@"level + STRING/NUMBER"
我该怎么做?
【问题讨论】:
标签: objective-c string append