在变量名后添加一个整数以访问 [英] Adding a integer after variable name to access
本文介绍了在变量名后添加一个整数以访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试执行一项操作,但我想确定哪个.例如我有
I am trying to run an action, but i want to decide which. for example i have
[bullet runAction:bullet1];
我希望能够操纵变量的访问像
I want to be able to manipulate the variable its accessing something like
[bullet runAction:bullet%d, i];
推荐答案
使用一系列动作,并使用索引来访问它们
use an array of actions, and use the index to access them
NSArray bulletActions = @[bullet1, bubble2];
[bullet runAction:bulletActions[0]];
我认为它将满足您的需求
I think it will serve your needs
这篇关于在变量名后添加一个整数以访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文