如何通过数组向表视图传递数据?
我想将字符串传递到表视图。首先,我可以传递到表视图,但如果我将第二个字符串传递到表视图将替换数据。我将数据传递到表视图,如下所示:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *myString = [defaults stringForKey:@"keyToLookupString"];
NomberArray = [[NSMutableArray alloc] init];
[NomberArray addObject:myString];
NSLog(@"nomber array = %@",NomberArray);
NSString *nomber = [NomberArray objectAtIndex:indexPath.row];
[cell.textLabel setText:nomber];
How do I pass more than 2 data to table view?
I want pass string to table view. In 1st, I can pass to table view but if I pass second string to table view will replace the data. I pass data to table view like this:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *myString = [defaults stringForKey:@"keyToLookupString"];
NomberArray = [[NSMutableArray alloc] init];
[NomberArray addObject:myString];
NSLog(@"nomber array = %@",NomberArray);
NSString *nomber = [NomberArray objectAtIndex:indexPath.row];
[cell.textLabel setText:nomber];
How do I pass more then 2 data to table view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要首先阅读 uitableview 编程指南。但是,您的问题似乎与填充表格视图有关。这是一个 示例说明如何操作。
You probably need to first read the uitableview programming guide. However, your problem seems to be related to populating the tableview. Here's an example of how you do it.