CCMenuitem Multi Line?

时间:2012-04-04 18:13:26

标签: cocos2d-iphone line menuitem multiline break

有没有办法制作Menuitem多线? 我试过了

CCMenuItemFont mapPacks = [CCMenuItemFont itemFromString:@"Map\n Packs" target:self selector:@selector(mapPacks:)];

但这似乎不起作用

1 个答案:

答案 0 :(得分:2)

您忘记在代码段中添加CCMenuItemFont之后的'*'。 我使用标签来创建多行项目,如下所示:

CCLabelTTF *label = [CCLabelTTF labelWithString:@"Map\n Packs" dimensions:CGSizeMake(100, 100) 
                                           alignment:UITextAlignmentCenter 
                                           fontName:@"Arial" fontSize:22];
CCMenuItemFont *mapPacks = [CCMenuItemFont itemWithLabel:label target:self selector:@selector(mapPacks:)];
相关问题