objective-c - 如何在xcode中打印数组的值?

标签 objective-c ios xcode

我的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/

相关文章:

ios - 这是一个 objective-c block 吗?

ios - 显示最近帖子的最佳方式 - Objective C

ios - MKMapView 因 setRegion 而崩溃

iphone - XCode/Objective C 基于调用者的条件断点

iphone - UIModalTransitionStylePartialCurl 不会返回到以前的状态。 (不解雇)

ios - ReplayKit - 在 ObjectiveC 中保留对 RPPreviewViewController 的引用

c# - MonoTouch 中的自定义 UIButton 颜色

ios - 获取请求以按最新消息的日期对对话进行排序

ios - 自定义 UITableViewCell 在滚动时显示完整单元格之前不显示数据

xcode - 从另一个类调用方法,而不重新初始化它