【发布时间】:2011-09-24 00:43:15
【问题描述】:
例如,我如何迭代方法调用。
[self revertBox1];
[self revertBox2];
[self revertBox3];
[self revertBox4];
[self revertBox5];
// They are as many as 20.
example1 * xmp = [[example1 alloc] initWithNibName:@"example1" bundle:nil];
// How can I iterate the class instantiation example1, example2, example3
// If I use this method..
NSString *classNameStr = [NSString stringWithFormat:@"example%d", i];
Class cls = NSClassFromString(classNameStr);
cls *obj = [[[cls alloc] initWithNibName:classNameStr bundle:nil];
//I receive an error [ Use of undeclared identifier 'obj' ]
【问题讨论】:
标签: iphone objective-c ios methods call