所以我已经尝试过这个并且在大多数情况下它都有效,但是它有问题。我需要重新开始这个。那么有人可以解释我在我的应用程序中有一个数组的最佳方式,它允许其他类访问它,编辑它,从中删除项目并添加新项目吗?
答案 0 :(得分:1)
您可以将它声明为appDelegate
中的实例变量,以便其他类可以轻松访问
YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
//and then access the variable by appDelegate.variable
答案 1 :(得分:0)
如果您在appDelegate中声明数组,则可以使用主appDelegate实例访问所有其他类中的数组。