目标C变量计数 [英] Objective C variable counting

查看:47
本文介绍了目标C变量计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些变量,例如vh1 vh2 vh3等. 是否可以在for循环中使用i变量进行计数?

I have some variables like vh1 vh2 vh3 etc. Is it possible in a for-loop to count with the i variable?

我的意思是类似for(int i = 1; blablabla) { [[vh + i] setBackGroundColor blablabla];}

致谢

vh1等都是UILabels !!!

vh1 etc. are UILabels!!!

推荐答案

虽然可以通过

While this is possible through introspection, if you have such variables you better put them in an NSArray, and access them with an index.

这篇关于目标C变量计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆