我有两个项目的数组我想要如果 i=0 那么它可能显示 Ali 和 1 然后 Jawaad 但我不希望它是静态的我想要动态的如果数组中有 100 个项目所以它们必须根据它们的索引给出标签我正在使用循环,但这个循环总是将 Jawaad 设置为标签。
NSArray*myArray = [[NSArray alloc] initWithObjects:@"Ali",@"Jawaad",nil];
int countTest=[myArray count];
NSLog(@"count Test is %d",countTest);
for (int i=0; i<countTest; i++) {
DescriptionLabel = [[UILabel alloc ] initWithFrame:CGRectMake(50,20,206,84)];
DescriptionLabel.textAlignment = UITextAlignmentLeft;
DescriptionLabel.lineBreakMode = UILineBreakModeWordWrap;
DescriptionLabel.numberOfLines = 0;
DescriptionLabel.textColor = [UIColor blackColor];
NSString*testting=[myArray objectAtIndex:i];
DescriptionLabel.text=testting;
DescriptionLabel.font = [UIFont fontWithName:@"Helvetica" size:16];
[scrollView addSubview:DescriptionLabel];
}