【发布时间】:2014-11-21 04:29:35
【问题描述】:
我是 iOS 开发的新手,我想在 UIScrolView 中缩放 UIImageView 图像,为此我在 UIView 中添加了我的 UIImageView,然后我在 UIScrollView 中添加了我的 UIView,但它在视图上不显示任何图像。以下是我的代码
for(int index=0; index < [self.imagesa count]; index++)
{
NSDictionary *dict=[self.imagesa objectAtIndex:index];
NSString *image=[dict valueForKey:@"link"];
self.viewImages=[[UIView alloc]initWithFrame:CGRectMake(index*bigimage.frame.size.width, 0, bigimage.frame.size.width, bigimage.frame.size.height)];
bigImage=[[UIImageView alloc]init];
bigImage.userInteractionEnabled=TRUE;
bigImage.tag=123;
bigImage.tag=index;
bigImage.userInteractionEnabled=TRUE;
bigImage.frame=CGRectMake(index * self.viewImages.frame.size.width, 0, self.viewImages.frame.size.width, self.viewImages.frame.size.height);
[bigImage setMultipleTouchEnabled:YES];
[bigImage sd_setImageWithURL:[NSURL URLWithString:image] placeholderImage:[UIImage imageNamed:@"1.png"]];
[bigImage setUserInteractionEnabled:TRUE];
[self.objectarray insertObject:bigImage atIndex:index];
[self.viewImages addSubview:bigImage];
[self.viewImages addSubview:[self.objectarray objectAtIndex:index]];
[self.zoomScroll addSubview:self.viewImages];
self.zoomScroll.contentSize=self.viewImages.frame.size;
请给我缩放UIScrolView 图像的解决方案,并将我的所有图像数组添加到我的UIScrolView。这里的大图是我的UIImageView,self.viewImages 是我的UIView。
【问题讨论】:
标签: ios iphone uiscrollview