NSMutableArray から画像を読み込む 1 つのアプリを開発しています。ランダムな画像を生成し、iOS の UIImageview にロードします。別の配列にロードした後、その配列を保存したいのですが、どうすればよいですか。前もって感謝します。
以下の私のコード。
//FrontsCards は私の配列です
for(m=0; m<[FrontsCards count];m++)
{
ImgView.alpha=1;
ImgView.tag=m;
NSLog(@"Img View Tag %d",ImgView.tag);
randIdx=arc4random()%[FrontsCards count];
NSString *imageName=[FrontsCards objectAtIndex:randIdx];
NSString *fullImageName=[NSString stringWithFormat:@"%@",imageName];
int padding=0;
CGRect imageViewFrame=CGRectMake(scrollView.frame.size.width*m+padding, scrollView.frame.origin.y, scrollView.frame.size.width-2*padding, scrollView.frame.size.height);
ImgView=[[UIImageView alloc]initWithFrame:imageViewFrame];
[ImgView setImage:[UIImage imageNamed:fullImageName]];
[scrollView addSubview:ImgView];
[ImgView setAccessibilityIdentifier:[FrontsCards objectAtIndex:randIdx]];
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTapImgView:)];
doubleTap.numberOfTapsRequired = 2;
doubleTap.delegate = self;
[self.ImgView setImage:[UIImage imageNamed:fullImageName]];
NSLog(@"full image name %@",fullImageName);
NSLog(@"Image Name = %@", fullImageName);
[self.ImgView setTag:randIdx];
[self.ImgView addGestureRecognizer:doubleTap];
self.ImgView.userInteractionEnabled=YES;
}
CGSize scrollViewSize=CGSizeMake(scrollView.frame.size.width*[FrontsCards count], scrollView.frame.size.height);
[scrollView setContentSize:scrollViewSize];
[self.view addSubview:scrollView];