我的XIB中有一个名为“txt”的文本框和一个名为“next”的按钮。
现在,单击下一步按钮,我要打印myArray的值。
NSArray *myArray
myArray = [NSArray arrayWithObjects:@"1",@"3",@"5",@"45",@"67",nil];
谁能帮我这个。
最佳答案
NSArray *myArray = [NSArray arrayWithObjects:@"1",@"3",@"5",@"45",@"67",nil];
-(IBAction)nextAction:(id)sender{
NSString *currentObj = txt.text;
int index = -1;
if(currentObj != nil&&[myArray containsObject:currentObj]){
index = [myArray indexOfObject:currentObj];
}
index++;
if(index<myArray.count)
txt.text = [myArray objectAtIndex:index];
}
关于objective-c - 如何在xcode中打印数组的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8937573/