我有一个图像数组imageFilesArray
,正在第一个视图控制器CaptureVC
的集合视图中使用。然后我创建了第二个视图控制器CreateVideoVC
。第二个视图控制器将为视频使用图像数组。我在CreateVideoVC
中创建了一个名为NSArray *imagesArrayForVideo
的属性并合成了它。但我似乎不知道如何让新的imagesArrayForVideo
包含相同的imageFilesArray
。如果有任何关于如何纠正这个问题的帮助,我将不胜感激。
From CaptureVC.m
-(void)createVideo:(id)sender{
CreateVideoVC *newVideo = [CreateVideoVC new];
//Set imagesFilesArray equal to new Array Property
NSLog(@"Start of CreateVideo Log: n%@",imageFilesArray); //check to see if array is filled which it is
imageFilesArray = newVideo.imagesArrayForVideo;
[self.navigationController pushViewController:newVideo animated:YES];
}
CreateVideoVC.m
- (void)viewDidLoad
{
[super viewDidLoad];
anArrayForImages = [[NSArray alloc] initWithArray:self.imagesArrayForVideo];
NSLog(@" Log for stupid thing %@", anArrayForImages);
}
变量的赋值是颠倒的。
您已经确定imageFilesArray
包含一系列图像。你想要将这个数据跨视图控制器持久化到CreateVideoVC。您正在为已填充的数组分配newVideo.imagesArrayForVideo
的值(可能是nil)。
imageFilesArray = newVideo.imagesArrayForVideo;
是
newVideo.imagesArrayForVideo = imageFilesArray;