0
我試圖改變imageview中的圖像,但我似乎無法做到這一點。 我的代碼如下所示爲每個要顯示的圖像創建一個新的子視圖。然而,圖像只是重疊,並顯示在不應該是結束的重疊圖像。如何刪除重疊的uiimageview?
.M:
for (int i = 0; i < [imageArr count]; i++) {
NSArray *imageNameArr = [[imageArr objectAtIndex:i] componentsSeparatedByString:@"."];
check=line;
NSString *msg = [textView.text stringByAppendingString:[NSString stringWithFormat:@"Opening image: %@\n",[imageArr objectAtIndex:i]]];
[textView performSelectorOnMainThread:@selector(setText:) withObject:msg waitUntilDone:NO];
line=line+1;
NSString *imagePath = [NSString stringWithFormat:@"%@/%@",jName,[imageArr objectAtIndex:i]];
NSString *imageFile = [NSHomeDirectory() stringByAppendingPathComponent:imagePath];
NSLog(@"------------------------------");
NSLog(@"ImageFile: %@\n",imageFile);
NSLog(@"Interger value: %i\n",i);
UIImage *myImage = [UIImage imageWithContentsOfFile:imageFile];
UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
imageView.contentMode = UIViewContentModeScaleAspectFit;
[scrollView addSubview:imageView];
[imageView release];
.....
.....
}
如何單獨顯示圖像,沒有重疊?